object_gui.cpp File Reference

The GUI for objects. More...

#include "stdafx.h"
#include "command_func.h"
#include "core/geometry_func.hpp"
#include "newgrf.h"
#include "newgrf_object.h"
#include "newgrf_text.h"
#include "sprite.h"
#include "strings_func.h"
#include "viewport_func.h"
#include "widgets/dropdown_type.h"
#include "window_gui.h"
#include "table/strings.h"

Go to the source code of this file.

Data Structures

class  BuildObjectWindow
 The window used for building objects. More...

Enumerations

enum  BuildObjectWidgets {
  BOW_CLASS_DROPDOWN, BOW_OBJECT_LIST, BOW_SCROLLBAR, BOW_OBJECT_MATRIX,
  BOW_OBJECT_SPRITE, BOW_OBJECT_SIZE, BOW_INFO
}
 

Object widgets in the object picker window.

More...

Functions

void ShowBuildObjectPicker (Window *w)
 Show our object picker.
void InitializeObjectGui ()
 Reset all data of the object GUI.
void PlaceProc_Object (TileIndex tile)
 PlaceProc function, called when someone pressed the button if the object-tool is selected.

Variables

static ObjectClassID _selected_object_class
 the currently visible object class
static int _selected_object_index
 the index of the selected object in the current class or -1
static uint8 _selected_object_view
 the view of the selected object
static const NWidgetPart _nested_build_object_widgets []
static const WindowDesc _build_object_desc (WDP_AUTO, 0, 0, WC_BUILD_OBJECT, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_build_object_widgets, lengthof(_nested_build_object_widgets))

Detailed Description

The GUI for objects.

Definition in file object_gui.cpp.


Enumeration Type Documentation

Object widgets in the object picker window.

Enumerator:
BOW_CLASS_DROPDOWN 

The dropdown with classes.

BOW_OBJECT_LIST 

The list with objects of a given class.

BOW_SCROLLBAR 

The scrollbar associated with the list.

BOW_OBJECT_MATRIX 

The matrix with preview sprites.

BOW_OBJECT_SPRITE 

A preview sprite of the object.

BOW_OBJECT_SIZE 

The size of an object.

BOW_INFO 

Other information about the object (from the NewGRF).

Definition at line 31 of file object_gui.cpp.


Function Documentation

void InitializeObjectGui (  ) 

Reset all data of the object GUI.

Definition at line 384 of file object_gui.cpp.

References _selected_object_class.

void PlaceProc_Object ( TileIndex  tile  ) 

PlaceProc function, called when someone pressed the button if the object-tool is selected.

Parameters:
tile on which to place the object

Definition at line 394 of file object_gui.cpp.

References _selected_object_class, _selected_object_index, _selected_object_view, CMD_BUILD_OBJECT, CMD_MSG, DoCommandP(), and NewGRFClass< Tspec, Tid, Tmax >::Get().

Referenced by ScenarioEditorLandscapeGenerationWindow::OnPlaceObject(), and TerraformToolbarWindow::OnPlaceObject().

void ShowBuildObjectPicker ( Window w  ) 

Show our object picker.

Parameters:
w The toolbar window we're associated with.

Definition at line 378 of file object_gui.cpp.

Referenced by ScenarioEditorLandscapeGenerationWindow::OnClick(), and TerraformToolbarWindow::OnClick().


Variable Documentation

const NWidgetPart _nested_build_object_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
    NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_OBJECT_BUILD_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0),
    NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetPadding(2, 5, 2, 5), SetDataTip(STR_OBJECT_BUILD_CLASS_LABEL, STR_NULL), SetFill(1, 0),
    NWidget(WWT_DROPDOWN, COLOUR_GREY, BOW_CLASS_DROPDOWN), SetPadding(0, 5, 2, 5), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_OBJECT_BUILD_TOOLTIP),
    NWidget(NWID_HORIZONTAL), SetPadding(0, 5, 2, 5),
      NWidget(WWT_MATRIX, COLOUR_GREY, BOW_OBJECT_LIST), SetFill(1, 0), SetDataTip(0x501, STR_OBJECT_BUILD_TOOLTIP), SetScrollbar(BOW_SCROLLBAR),
      NWidget(NWID_VSCROLLBAR, COLOUR_GREY, BOW_SCROLLBAR),
    EndContainer(),
    NWidget(NWID_HORIZONTAL), SetPadding(0, 5, 0, 5),
      NWidget(NWID_MATRIX, COLOUR_DARK_GREEN, BOW_OBJECT_MATRIX), SetPIP(0, 2, 0),
        NWidget(WWT_PANEL, COLOUR_GREY, BOW_OBJECT_SPRITE), SetDataTip(0x0, STR_OBJECT_BUILD_PREVIEW_TOOLTIP), EndContainer(),
      EndContainer(),
    EndContainer(),
    NWidget(WWT_TEXT, COLOUR_DARK_GREEN, BOW_OBJECT_SIZE), SetDataTip(STR_OBJECT_BUILD_SIZE, STR_NULL), SetPadding(2, 5, 2, 5),
    NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, BOW_INFO), SetPadding(2, 5, 0, 5),
  EndContainer(),
}

Definition at line 345 of file object_gui.cpp.


Generated on Sun Jan 9 16:02:12 2011 for OpenTTD by  doxygen 1.6.1