BuildIndustryWindow Class Reference

Build (fund or prospect) a new industry,. More...

Inheritance diagram for BuildIndustryWindow:
Window ZeroedMemoryAllocator

Public Member Functions

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 SetStringParameters (int widget) const
 Initialize string parameters for a widget.
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 OnResize ()
 Called after the window got resized.
virtual void OnPlaceObject (Point pt, TileIndex tile)
 The user clicked some place on the map when a tile highlight mode has been set.
virtual void OnTick ()
 Called once per (game) tick.
virtual void OnTimeout ()
 Called when this window's timeout has been reached.
virtual void OnPlaceObjectAbort ()
 The user cancelled a tile highlight mode that has been set.
virtual void OnInvalidateData (int data=0)
 Some data on this window has become invalid.

Private Member Functions

void SetupArrays ()
void SetButtons ()
 Update status of the fund and display-chain widgets.

Private Attributes

int selected_index
 index of the element in the matrix
IndustryType selected_type
 industry corresponding to the above index
uint16 callback_timer
 timer counter for callback eventual verification
bool timer_enabled
 timer can be used
uint16 count
 How many industries are loaded.
IndustryType index [NUM_INDUSTRYTYPES+1]
 Type of industry, in the order it was loaded.
bool enabled [NUM_INDUSTRYTYPES+1]
 availability state, coming from CBID_INDUSTRY_AVAILABLE (if ever)
Scrollbarvscroll

Static Private Attributes

static const int MATRIX_TEXT_OFFSET = 17
 The offset for the text in the matrix.

Detailed Description

Build (fund or prospect) a new industry,.

Definition at line 203 of file industry_gui.cpp.


Member Function Documentation

virtual void BuildIndustryWindow::DrawWidget ( const Rect r,
int  widget 
) const [inline, virtual]
virtual void BuildIndustryWindow::OnClick ( Point  pt,
int  widget,
int  click_count 
) [inline, virtual]
virtual void BuildIndustryWindow::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 289 of file industry_gui.cpp.

virtual void BuildIndustryWindow::OnInvalidateData ( int  data = 0  )  [inline, virtual]

Some data on this window has become invalid.

Parameters:
data information about the changed data.

Reimplemented from Window.

Definition at line 601 of file industry_gui.cpp.

References _settings_game, GameSettings::difficulty, enabled, GetIndustrySpec(), INVALID_INDUSTRYTYPE, DifficultySettings::number_industries, selected_index, selected_type, and SetButtons().

virtual void BuildIndustryWindow::OnPlaceObject ( Point  pt,
TileIndex  tile 
) [inline, virtual]

The user clicked some place on the map when a tile highlight mode has been set.

Parameters:
pt the exact point on the map that has been clicked.
tile the tile on the map that has been clicked.

Reimplemented from Window.

Definition at line 534 of file industry_gui.cpp.

References _current_company, _generating_world, _settings_client, CcBuildIndustry(), CMD_BUILD_INDUSTRY, CMD_MSG, DoCommandP(), GetIndustrySpec(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_town_pool >::GetNumItems(), ClientSettings::gui, IndustrySpec::name, IndustrySpec::num_table, OWNER_NONE, GUISettings::persistent_buildingtools, Backup< T >::Restore(), selected_type, SetDParam(), ShowErrorMessage(), and WL_INFO.

virtual void BuildIndustryWindow::OnResize (  )  [inline, virtual]

Called after the window got resized.

For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.

Reimplemented from Window.

Definition at line 527 of file industry_gui.cpp.

References Scrollbar::GetCapacity(), MAT_COL_START, MAT_ROW_START, and Scrollbar::SetCapacityFromWidget().

void BuildIndustryWindow::SetButtons (  )  [inline, private]

Update status of the fund and display-chain widgets.

Definition at line 266 of file industry_gui.cpp.

References enabled, INVALID_INDUSTRYTYPE, selected_index, selected_type, and Window::SetWidgetDisabledState().

Referenced by OnClick(), OnInvalidateData(), and OnTick().

virtual void BuildIndustryWindow::SetStringParameters ( int  widget  )  const [inline, virtual]

Initialize string parameters for a widget.

Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.

Parameters:
widget Widget number.

Reimplemented from Window.

Definition at line 366 of file industry_gui.cpp.

References _settings_game, GameSettings::construction, GetIndustrySpec(), index, IndustrySpec::IsRawIndustry(), ConstructionSettings::raw_industry_construction, selected_index, and SetDParam().

virtual void BuildIndustryWindow::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 294 of file industry_gui.cpp.

References IndustrySpec::accepts_cargo, count, CST_FUND, CT_INVALID, FONT_HEIGHT_NORMAL, CargoSpec::Get(), GetAllCargoSuffixes(), GetIndustrySpec(), GetStringBoundingBox(), GRFLoadedFeatures::has_newindustries, Window::height, index, INVALID_INDUSTRYTYPE, lengthof, MATRIX_TEXT_OFFSET, maxdim(), CargoSpec::name, SetDParam(), SetDParamStr(), WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, WD_MATRIX_BOTTOM, and WD_MATRIX_TOP.


Field Documentation

const int BuildIndustryWindow::MATRIX_TEXT_OFFSET = 17 [static, private]

The offset for the text in the matrix.

Definition at line 214 of file industry_gui.cpp.

Referenced by DrawWidget(), and UpdateWidgetSize().


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

Generated on Fri Dec 31 17:16:20 2010 for OpenTTD by  doxygen 1.6.1