Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

SelectCompanyManagerFaceWindow Class Reference

Management class for customizing the face of the company manager. More...

Inheritance diagram for SelectCompanyManagerFaceWindow:
Window ZeroedMemoryAllocator

Public Member Functions

 SelectCompanyManagerFaceWindow (WindowDesc *desc, Window *parent)
void SelectDisplayPlanes (bool advanced)
 Select planes to display to the user with the NWID_SELECTION widgets WID_SCMF_SEL_LOADSAVE, WID_SCMF_SEL_MALEFEMALE, and WID_SCMF_SEL_PARTS.
virtual void OnInit ()
 Notification that the nested widget tree gets initialized.
virtual void UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 Update size and resize step of a widget in the window.
virtual void OnPaint ()
 The window must be repainted.
virtual void DrawWidget (const Rect &r, int widget) const
 Draw the contents of a nested widget.
virtual void OnClick (Point pt, int widget, int click_count)
 A click with the left mouse button has been made on the window.
virtual void OnQueryTextFinished (char *str)
 The query window opened from this window has closed.

Private Member Functions

void DrawFaceStringLabel (byte widget_index, uint8 val, bool is_bool_widget) const
 Draw dynamic a label to the left of the button and a value in the button.
void UpdateData ()

Private Attributes

CompanyManagerFace face
 company manager face bits
bool advanced
 advanced company manager face selection window
GenderEthnicity ge
 Gender and ethnicity.
bool is_female
 Female face.
bool is_moust_male
 Male face with a moustache.
Dimension yesno_dim
 Dimension of a yes/no button of a part in the advanced face window.
Dimension number_dim
 Dimension of a number widget of a part in the advanced face window.

Static Private Attributes

static const StringID PART_TEXTS_IS_FEMALE []
 Strings depending on is_female, used to describe parts (2 entries for a part).
static const StringID PART_TEXTS []
 Fixed strings to describe parts of the face.

Detailed Description

Management class for customizing the face of the company manager.

Definition at line 1030 of file company_gui.cpp.


Member Function Documentation

void SelectCompanyManagerFaceWindow::DrawFaceStringLabel ( byte  widget_index,
uint8  val,
bool  is_bool_widget 
) const [inline, private]

Draw dynamic a label to the left of the button and a value in the button.

Parameters:
widget_index index of this widget in the window
val the value which will be draw
is_bool_widget is it a bool button

Definition at line 1052 of file company_gui.cpp.

References NWidgetBase::current_x, DrawString(), NWidgetCore::IsDisabled(), NWidgetCore::IsLowered(), NWidgetBase::pos_x, NWidgetBase::pos_y, and SetDParam().

Referenced by DrawWidget().

virtual void SelectCompanyManagerFaceWindow::OnInit (  )  [inline, virtual]

Notification that the nested widget tree gets initialized.

The event can be used to perform general computations.

Note:
nested_root and/or nested_array (normally accessed via GetWidget()) may not exist during this call.

Reimplemented from Window.

Definition at line 1112 of file company_gui.cpp.

References GetSpriteSize(), GetStringBoundingBox(), max(), maxdim(), number_dim, SetDParam(), WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_IMGBTN_LEFT, and yesno_dim.

virtual void SelectCompanyManagerFaceWindow::OnQueryTextFinished ( char *  str  )  [inline, virtual]

The query window opened from this window has closed.

Parameters:
str the new value of the string, NULL if the window was cancelled or an empty string when the default button was pressed, i.e. StrEmpty(str).

Reimplemented from Window.

Definition at line 1446 of file company_gui.cpp.

References face, INVALID_STRING_ID, ScaleAllCompanyManagerFaceBits(), Window::SetDirty(), ShowErrorMessage(), StrEmpty(), and WL_INFO.

void SelectCompanyManagerFaceWindow::SelectDisplayPlanes ( bool  advanced  )  [inline]

Select planes to display to the user with the NWID_SELECTION widgets WID_SCMF_SEL_LOADSAVE, WID_SCMF_SEL_MALEFEMALE, and WID_SCMF_SEL_PARTS.

Parameters:
advanced Display advanced face management window.

Definition at line 1097 of file company_gui.cpp.

References SZSP_NONE.

Referenced by OnClick().

virtual void SelectCompanyManagerFaceWindow::UpdateWidgetSize ( int  widget,
Dimension size,
const Dimension padding,
Dimension fill,
Dimension resize 
) [inline, virtual]

Update size and resize step of a widget in the window.

After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.

Parameters:
widget Widget number.
size Size of the widget.
padding Recommended amount of space between the widget content and the widget edge.
fill Fill step of the widget.
resize Resize step of the widget.

Reimplemented from Window.

Definition at line 1135 of file company_gui.cpp.

References GetStringBoundingBox(), maxdim(), number_dim, PART_TEXTS, PART_TEXTS_IS_FEMALE, WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WID_SCMF_CHIN, WID_SCMF_CHIN_TEXT, WID_SCMF_COLLAR, WID_SCMF_COLLAR_TEXT, WID_SCMF_EYEBROWS, WID_SCMF_EYEBROWS_TEXT, WID_SCMF_EYECOLOUR, WID_SCMF_EYECOLOUR_TEXT, WID_SCMF_GLASSES, WID_SCMF_GLASSES_TEXT, WID_SCMF_HAIR, WID_SCMF_HAIR_TEXT, WID_SCMF_HAS_GLASSES, WID_SCMF_HAS_GLASSES_TEXT, WID_SCMF_HAS_MOUSTACHE_EARRING, WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT, WID_SCMF_JACKET, WID_SCMF_JACKET_TEXT, WID_SCMF_LIPS_MOUSTACHE, WID_SCMF_LIPS_MOUSTACHE_TEXT, WID_SCMF_NOSE, WID_SCMF_NOSE_TEXT, WID_SCMF_TIE_EARRING, WID_SCMF_TIE_EARRING_TEXT, and yesno_dim.


Field Documentation

Initial value:
 {
  STR_FACE_GLASSES,   
  STR_FACE_HAIR,      
  STR_FACE_EYEBROWS,  
  STR_FACE_EYECOLOUR, 
  STR_FACE_GLASSES,   
  STR_FACE_NOSE,      
  STR_FACE_CHIN,      
  STR_FACE_JACKET,    
  STR_FACE_COLLAR,    
}

Fixed strings to describe parts of the face.

Textual names for parts of the face.

Definition at line 1043 of file company_gui.cpp.

Referenced by DrawWidget(), and UpdateWidgetSize().

Initial value:
 {
  STR_FACE_MOUSTACHE, STR_FACE_EARRING, 
  STR_FACE_TIE,       STR_FACE_EARRING, 
}

Strings depending on is_female, used to describe parts (2 entries for a part).

Both text values of parts of the face that depend on the is_female boolean value.

Definition at line 1042 of file company_gui.cpp.

Referenced by DrawWidget(), and UpdateWidgetSize().


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