Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

mgOptFontSettingsPanel Class Reference

#include <OptFontSettings.h>

Inheritance diagram for mgOptFontSettingsPanel:

mgOptBasePanel List of all members.

Detailed Description

The panel which handles font options inside a mgOptDlg.

This panel contains a great number of controls due to the high number of customizable variables regarding the fonts, their foreground and background colors. The panel also contains a preview window which helps the user to choose its preferred settings.

Definition at line 122 of file OptFontSettings.h.

Protected Member Functions

virtual void Setup (const wxString &itemLabel)
 The alter ego of the constructor.
virtual mgOptDlg::mgOptChangedType CommitChanges (wxConfig *config)
 Commits the changes made by the user.
void BuildCtrls ()
 Creates all the controls contained in this panel; specially the font settings rows.
void BuildFontSettings (wxFlexGridSizer *table, const wxString &label, int id)
 Builds a font settings row, which contains these controls: | label | wxComboBox with facename list | pointsize | fg colour | bg colour |.
void ReadSettings (int id, const mcTextSettings &p)
 Updates the controls of the font settings row whose base ID matches the given ID, reading the informations from the given mcTextSettings object.
void SaveSettings (int id, mcTextSettings &p)
 Stores inside the given mcTextSettings object, the informations of the controls of the font settings row whose base ID matches the given ID.
void OnExpDepthChange (wxCommandEvent &)
 Handles changes in the exponent depth combo box.
void OnActiveElemChange (wxCommandEvent &ev)
 Handles the change of the active element of the preview window.
const mcTextSettings & GetSettingsFromBaseID (const mcStyle *p, int id)
 Returns the mcTextSettings object associated with the font settings row whose base ID matches the given ID.
const mcTextSettings & GetSettingsFromBaseID (int expdepth, int id)
 Returns the mcTextSettings object associated with the font settings row whose base ID matches the given ID.

Protected Attributes

int m_nBaseID [OPTIONSDLG_FONTPANEL_NUMSETTINGS]
 The IDs usd for the first control placed in each font settings row (see BuildFontSettings for more info).
mgMathBoxm_pPreviewBox
 The mgMathBox which is used to show a preview of the fonts to the user.
wxChoice * m_pExpDepthChoice
 The listbox with the exponent depth codes which can be chosen.
wxString * m_pFontFaces
 The last array retrieved by m_pExpDepthChoice.
mgOptFontEnumerator m_fntEnumerator
 The font list available on this system.

Static Protected Attributes

static wxString m_strSettingsLabel [OPTIONSDLG_FONTPANEL_NUMSETTINGS]
 The labels of the font settings rows.


Member Function Documentation

void mgOptFontSettingsPanel::BuildFontSettings wxFlexGridSizer *  table,
const wxString &  label,
int  id
[protected]
 

Builds a font settings row, which contains these controls: | label | wxComboBox with facename list | pointsize | fg colour | bg colour |.

The ID of the first control of the new font settings row is the given one. All the controls are added inside the given sizer.

Definition at line 150 of file OptFontSettings.cpp.

References mgOptFontEnumerator::GetCount(), m_fntEnumerator, and m_pFontFaces.

Referenced by Setup().

mgOptDlg::mgOptChangedType mgOptFontSettingsPanel::CommitChanges wxConfig *  config  )  [protected, virtual]
 

Commits the changes made by the user.

The virtual function is called with a pointer to a wxConfig object by the mgOptDlg::CommitChanges function when the user clicks the OK or Apply button.

The function should change the variables used by MathCore and MathGUI in order to reflect changes in the configuration. In other words, if the user changed the font family and / or size this function should delete the font object used by the application and replace it with a new font ehich caracteristics are those specified by the user and store the pointer of the newly created font object in the MathCore library.

There is no need for the function to store the settings in the configuration objevt because they will be stored automatically at program exit in CMathApp::OnExit() function.

In order to refresh the application apareance when the user changes options settings (such as a font), the function returns a constant value, which is an enum, that represent what aspect of the application is to be refreshed. It is the caller responsability to do the actual work.

See also:
mgOptDlg::CommitChanges mgOptDlg::mgOptChangedType

Implements mgOptBasePanel.

Definition at line 262 of file OptFontSettings.cpp.

References GetSettingsFromBaseID(), m_nBaseID, and SaveSettings().

const mcTextSettings & mgOptFontSettingsPanel::GetSettingsFromBaseID int  expdepth,
int  id
[protected]
 

Returns the mcTextSettings object associated with the font settings row whose base ID matches the given ID.

Parameters:
expdepth The exponent depth which is used to choose the style where the mcTextSettings object is taken from.

Definition at line 115 of file OptFontSettings.cpp.

References mgMathBox::GetMathObj(), GetSettingsFromBaseID(), and m_pPreviewBox.

const mcTextSettings & mgOptFontSettingsPanel::GetSettingsFromBaseID const mcStyle *  p,
int  id
[protected]
 

Returns the mcTextSettings object associated with the font settings row whose base ID matches the given ID.

Parameters:
p The style where the mcTextSettings object is taken from.

Definition at line 102 of file OptFontSettings.cpp.

References m_nBaseID.

Referenced by CommitChanges(), GetSettingsFromBaseID(), and OnExpDepthChange().

void mgOptFontSettingsPanel::Setup const wxString &  itemLabel  )  [protected, virtual]
 

The alter ego of the constructor.

This function is the real ctor of the class. It is called from mgOptDlg::CreatePanel function just after the dynamic istantiation of the class and after calling wxPanel::Create.

As you cannot set properies for the panel such as fonts, background color atc. in the class's ctor you have to set them in this function.

The itemLabel string contains the label of the treelist's item associated with this option's panel.

The default implementation of this class just creates a wxStaticBoxSizer equal to the size of the panel and sets its label as the treelist's item's label. Specialized derived classes should construct the child controls and the sizer or layout constarints objects to be bounded to childs.

Implements mgOptBasePanel.

Definition at line 173 of file OptFontSettings.cpp.

References BuildCtrls(), BuildFontSettings(), mgOptFontEnumerator::GetFacenamesArray(), m_fntEnumerator, m_nBaseID, m_pExpDepthChoice, m_pFontFaces, m_pPreviewBox, m_strSettingsLabel, and OnExpDepthChange().


Member Data Documentation

int mgOptFontSettingsPanel::m_nBaseID[OPTIONSDLG_FONTPANEL_NUMSETTINGS] [protected]
 

The IDs usd for the first control placed in each font settings row (see BuildFontSettings for more info).

All the following controls in the same font settings panel uses their entry in this array as base id, incrementing it (using the OPTIONSDLG_FONTPANEL_*****_IDOFFSET defines). All the entries of this array contains OPTIONSDLG_FONTPANEL_SETTING_IDOFFSET multiples, so this is the maximum number of IDs which can be used inside each row.

Definition at line 134 of file OptFontSettings.h.

Referenced by CommitChanges(), GetSettingsFromBaseID(), OnExpDepthChange(), and Setup().

mgMathBox* mgOptFontSettingsPanel::m_pPreviewBox [protected]
 

The mgMathBox which is used to show a preview of the fonts to the user.

The input-system and the selection system of this box is diabled so it works in read-only mode.

Definition at line 143 of file OptFontSettings.h.

Referenced by BuildCtrls(), GetSettingsFromBaseID(), OnActiveElemChange(), OnExpDepthChange(), and Setup().

wxString mgOptFontSettingsPanel::m_strSettingsLabel [static, protected]
 

Initial value:

 {
   wxT("Operators"), wxT("Numbers"), wxT("Functions"), 
      wxT("Subscripts"), wxT("Symbols"), wxT("Specials") 
}
The labels of the font settings rows.

This array is trictly tied to the mcStyle::GetGetIndexFor() function.

Definition at line 55 of file OptFontSettings.cpp.

Referenced by Setup().


The documentation for this class was generated from the following files:

Documentation generated with Doxygen on Sun Feb 6 17:19:27 2005
Visit MathStudio home page for more info

[ Top ]