# SelectCompanyManagerFaceWindow Class Reference

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

Inheritance diagram for SelectCompanyManagerFaceWindow:

## Public Member Functions
| SelectCompanyManagerFaceWindow (const WindowDesc *desc, Window *parent)
void | SelectDisplayPlanes (bool advanced)
| Select planes to display to the user with the NWID_SELECTION widgets SCMFW_WIDGET_SEL_LOADSAVE, SCMFW_WIDGET_SEL_MALEFEMALE, and SCMFW_WIDGET_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 1114 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 1136 of file company_gui.cpp.

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

Referenced by DrawWidget().

virtual void SelectCompanyManagerFaceWindow::DrawWidget | ( | const Rect & | r,
|  | int | widget |
| ) |  |  | const`[inline, virtual]`

Draw the contents of a nested widget.

Parameters:

  | r | Rectangle occupied by the widget.
  | widget | Number of the widget to draw.

Note:
  This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 1332 of file company_gui.cpp.

References DrawCompanyManagerFace(), DrawFaceStringLabel(), DrawString(), face, ge, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetCompanyManagerFaceBits(), is_female, is_moust_male, PART_TEXTS, PART_TEXTS_IS_FEMALE, SA_RIGHT, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, and Window::window_number.

virtual void SelectCompanyManagerFaceWindow::OnClick | ( | Point | pt,
|  | int | widget,
|  | int | click_count |
| ) |  |  | `[inline, virtual]`

A click with the left mouse button has been made on the window.

Parameters:

  | pt | the point inside the window that has been clicked.
  | widget | the clicked widget.
  | click_count | Number of fast consecutive clicks at same position

Reimplemented from Window.

Definition at line 1432 of file company_gui.cpp.

References _company_manager_face, advanced, CMD_SET_COMPANY_MANAGER_FACE, CS_NUMERAL, DoCommandP(), face, ge, GetCompanyManagerFaceBits(), IncreaseCompanyManagerFaceBits(), INVALID_STRING_ID, is_female, is_moust_male, RandomCompanyManagerFaceBits(), Window::ReInit(), ScaleAllCompanyManagerFaceBits(), SCMFW_WIDGET_FEMALE, SCMFW_WIDGET_FEMALE2, SCMFW_WIDGET_MALE, SCMFW_WIDGET_MALE2, SelectDisplayPlanes(), SetCompanyManagerFaceBits(), Window::SetDirty(), SetDParam(), ShowErrorMessage(), ShowQueryString(), and WL_INFO.

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 1196 of file company_gui.cpp.

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

virtual void SelectCompanyManagerFaceWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

Note:
  This method should not change any state, it should only use drawing functions.

Reimplemented from Window.

Definition at line 1271 of file company_gui.cpp.

References _cmf_info, Window::DrawWidgets(), ETHNICITY_BLACK, face, ge, GetCompanyManagerFaceBits(), HasBit(), is_female, is_moust_male, SCMFW_WIDGET_FEMALE, SCMFW_WIDGET_FEMALE2, SCMFW_WIDGET_MALE, SCMFW_WIDGET_MALE2, Window::SetWidgetLoweredState(), Window::SetWidgetsDisabledState(), Window::SetWidgetsLoweredState(), and WIDGET_LIST_END.

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 1541 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 SCMFW_WIDGET_SEL_LOADSAVE, SCMFW_WIDGET_SEL_MALEFEMALE, and SCMFW_WIDGET_SEL_PARTS.

Parameters:

  | advanced | Display advanced face management window.

Definition at line 1181 of file company_gui.cpp.

References SCMFW_WIDGET_SEL_LOADSAVE, SCMFW_WIDGET_SEL_MALEFEMALE, SCMFW_WIDGET_SEL_PARTS, and 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 1219 of file company_gui.cpp.

References GetStringBoundingBox(), maxdim(), number_dim, PART_TEXTS, PART_TEXTS_IS_FEMALE, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, and yesno_dim.

## Field Documentation

const StringID SelectCompanyManagerFaceWindow::PART_TEXTS`[static, private]`

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 1127 of file company_gui.cpp.

Referenced by DrawWidget(), and UpdateWidgetSize().

const StringID SelectCompanyManagerFaceWindow::PART_TEXTS_IS_FEMALE`[static, private]`

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 1126 of file company_gui.cpp.

Referenced by DrawWidget(), and UpdateWidgetSize().

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

- src/company_gui.cpp