forked from aburch/simutrans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextend_edit.h
172 lines (131 loc) · 3.88 KB
/
extend_edit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
* This file is part of the Simutrans project under the Artistic License.
* (see LICENSE.txt)
*/
#ifndef GUI_EXTEND_EDIT_H
#define GUI_EXTEND_EDIT_H
#include "gui_frame.h"
#include "components/gui_textinput.h"
#include "components/gui_scrolled_list.h"
#include "components/gui_scrollpane.h"
#include "components/gui_tab_panel.h"
#include "components/gui_button.h"
#include "components/gui_image.h"
#include "components/gui_fixedwidth_textarea.h"
#include "components/gui_building.h"
#include "components/gui_combobox.h"
#include "components/gui_numberinput.h"
#include "components/gui_divider.h"
#include "../utils/cbuffer_t.h"
#include "../simtypes.h"
class player_t;
/**
* Entries for rotation selection.
*/
class gui_rotation_item_t : public gui_scrolled_list_t::const_text_scrollitem_t
{
private:
const char *text;
uint8 rotation; ///< 0-3, 255 = random
public:
enum special_rotations_t {
automatic = 254,
random = 255
};
gui_rotation_item_t(uint8 r);
char const* get_text () const OVERRIDE { return text; }
sint8 get_rotation() const { return rotation; }
};
/**
* Entries for climate selection.
*/
class gui_climates_item_t : public gui_scrolled_list_t::const_text_scrollitem_t
{
private:
const char *text;
uint8 climate_;
public:
gui_climates_item_t(uint8 r);
char const* get_text () const OVERRIDE { return text; }
sint8 get_climate() const { return climate_; }
};
/**
* Entries for sorting selection.
*/
class gui_sorting_item_t : public gui_scrolled_list_t::const_text_scrollitem_t
{
private:
const char *text;
uint8 sorted_by;
public:
enum sorting_options {
BY_NAME_TRANSLATED,
BY_NAME_OBJECT,
BY_LEVEL_PAX,
BY_LEVEL_MAIL,
BY_DATE_INTRO,
BY_DATE_RETIRE,
BY_SIZE,
BY_COST,
BY_GOODS_NUMBER,
BY_REMOVAL
};
gui_sorting_item_t(uint8 r);
char const* get_text () const OVERRIDE { return text; }
sint8 get_sortedby() const { return sorted_by; }
};
/**
* Base class map editor dialogues to select object to place on map.
*/
class extend_edit_gui_t :
public gui_frame_t,
public action_listener_t
{
protected:
player_t *player;
/// cont_left: left column, cont_right: right column
gui_aligned_container_t cont_left, cont_right;
/// cont_filter: Settings about the content of the list (above list)
/// cont_timeline: timeline-related filter settings
/// cont_options: Settings about the active object (eg. rotation)
/// cont_scrolly: the scrollable container (image + desc)
gui_aligned_container_t cont_filter, cont_options, cont_timeline, cont_scrolly;
cbuffer_t buf;
gui_fixedwidth_textarea_t info_text;
//container for object description
gui_scrollpane_t scrolly;
gui_scrolled_list_t scl;
//image
gui_building_t building_image;
button_t bt_obsolete, bt_timeline, bt_climates, bt_timeline_custom;
// we make this available for child classes
gui_combobox_t cb_rotation, cb_climates, cb_sortedby;
gui_numberinput_t ni_timeline_year, ni_timeline_month;
virtual void fill_list() {}
virtual void change_item_info( sint32 /*entry, -1= none */ ) {}
/**
* @returns selected rotation of cb_rotation.
* assumes that cb_rotation only contains gui_rotation_item_t-items.
* defaults to zero.
*/
uint8 get_rotation() const;
/**
* @returns selected climate of cb_climates.
*/
uint8 get_climate() const;
/**
* @returns selected sorting method.
*/
uint8 get_sortedby() const;
public:
extend_edit_gui_t(const char *name, player_t* player_);
/**
* Does this window need a min size button in the title bar?
* @return true if such a button is needed
*/
bool has_min_sizer() const OVERRIDE {return true;}
void set_windowsize( scr_size s ) OVERRIDE;
bool infowin_event(event_t const*) OVERRIDE;
bool action_triggered(gui_action_creator_t*, value_t) OVERRIDE;
};
#endif