BuildIndustryWindow Class Reference

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

Inheritance diagram for BuildIndustryWindow:
Window ZeroedMemoryAllocator

Public Member Functions

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 OnPaint ()
 The window must be repainted.
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 ()

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)

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 135 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::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 519 of file industry_gui.cpp.

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

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

References Window::DrawWidgets().

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 451 of file industry_gui.cpp.

References _settings_client, 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, selected_type, SetDParam(), and ShowErrorMessage().

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 444 of file industry_gui.cpp.

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

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 283 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 212 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 145 of file industry_gui.cpp.

Referenced by DrawWidget(), and UpdateWidgetSize().


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

Generated on Tue Sep 14 17:07:25 2010 for OpenTTD by  doxygen 1.6.1