File diff r23496:661d21df67d7 → r23497:a0ab44ebd2fa
src/toolbar_gui.cpp
Show inline comments
 
@@ -1329,13 +1329,13 @@ public:
 
	 */
 
	bool IsButton(WidgetType type) const
 
	{
 
		return type == WWT_IMGBTN || type == WWT_IMGBTN_2 || type == WWT_PUSHIMGBTN;
 
	}
 

	
 
	void SetupSmallestSize(Window *w, bool init_array)
 
	void SetupSmallestSize(Window *w, bool init_array) override
 
	{
 
		this->smallest_x = 0; // Biggest child
 
		this->smallest_y = 0; // Biggest child
 
		this->fill_x = 1;
 
		this->fill_y = 0;
 
		this->resize_x = 1; // We only resize in this direction
 
@@ -1362,13 +1362,13 @@ public:
 
				child_wid->current_x = child_wid->smallest_x;
 
			}
 
		}
 
		_toolbar_width = nbuttons * this->smallest_x;
 
	}
 

	
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
 
	{
 
		assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
 

	
 
		this->pos_x = x;
 
		this->pos_y = y;
 
		this->current_x = given_width;
 
@@ -1425,13 +1425,13 @@ public:
 
			} else {
 
				cur_wid++;
 
			}
 
		}
 
	}
 

	
 
	/* virtual */ void Draw(const Window *w)
 
	void Draw(const Window *w) override
 
	{
 
		/* Draw brown-red toolbar bg. */
 
		GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, PC_VERY_DARK_RED);
 
		GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, PC_DARK_RED, FILLRECT_CHECKER);
 

	
 
		bool rtl = _current_text_dir == TD_RTL;
 
@@ -1440,13 +1440,13 @@ public:
 
			if (!this->visible[((NWidgetCore*)child_wid)->index]) continue;
 

	
 
			child_wid->Draw(w);
 
		}
 
	}
 

	
 
	/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y)
 
	NWidgetCore *GetWidgetFromPos(int x, int y) override
 
	{
 
		if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return NULL;
 

	
 
		for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
 
			if (child_wid->type == NWID_SPACER) continue;
 
			if (!this->visible[((NWidgetCore*)child_wid)->index]) continue;
 
@@ -1467,13 +1467,13 @@ public:
 
	 */
 
	virtual const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const = 0;
 
};
 

	
 
/** Container for the 'normal' main toolbar */
 
class NWidgetMainToolbarContainer : public NWidgetToolbarContainer {
 
	/* virtual */ const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const
 
	const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const override
 
	{
 
		static const uint SMALLEST_ARRANGEMENT = 14;
 
		static const uint BIGGEST_ARRANGEMENT  = 20;
 

	
 
		/* The number of buttons of each row of the toolbar should match the number of items which we want to be visible.
 
		 * The total number of buttons should be equal to arrangable_count * 2.
 
@@ -1790,13 +1790,13 @@ class NWidgetMainToolbarContainer : publ
 
};
 

	
 
/** Container for the scenario editor's toolbar */
 
class NWidgetScenarioToolbarContainer : public NWidgetToolbarContainer {
 
	uint panel_widths[2]; ///< The width of the two panels (the text panel and date panel)
 

	
 
	void SetupSmallestSize(Window *w, bool init_array)
 
	void SetupSmallestSize(Window *w, bool init_array) override
 
	{
 
		this->NWidgetToolbarContainer::SetupSmallestSize(w, init_array);
 

	
 
		/* Find the size of panel_widths */
 
		uint i = 0;
 
		for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
 
@@ -1805,13 +1805,13 @@ class NWidgetScenarioToolbarContainer : 
 
			assert(i < lengthof(this->panel_widths));
 
			this->panel_widths[i++] = child_wid->current_x;
 
			_toolbar_width += child_wid->current_x;
 
		}
 
	}
 

	
 
	/* virtual */ const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const
 
	const byte *GetButtonArrangement(uint &width, uint &arrangable_count, uint &button_count, uint &spacer_count) const override
 
	{
 
		static const byte arrange_all[] = {
 
			WID_TE_PAUSE,
 
			WID_TE_FAST_FORWARD,
 
			WID_TE_SETTINGS,
 
			WID_TE_SAVE,