mirror of https://github.com/OpenTTD/OpenTTD
(svn r24724) -Codechange: Move drawing of editboxes to the widget drawing code.
parent
8cd77b6f6e
commit
17025fa6ea
|
@ -1099,8 +1099,6 @@ struct AIDebugWindow : public QueryStringBaseWindow {
|
||||||
|
|
||||||
if (this->IsShaded()) return; // Don't draw anything when the window is shaded.
|
if (this->IsShaded()) return; // Don't draw anything when the window is shaded.
|
||||||
|
|
||||||
if (this->show_break_box) this->DrawEditBox(WID_AID_BREAK_STR_EDIT_BOX);
|
|
||||||
|
|
||||||
/* Paint the company icons */
|
/* Paint the company icons */
|
||||||
for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
|
for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
|
||||||
NWidgetCore *button = this->GetWidget<NWidgetCore>(i + WID_AID_COMPANY_BUTTON_START);
|
NWidgetCore *button = this->GetWidget<NWidgetCore>(i + WID_AID_COMPANY_BUTTON_START);
|
||||||
|
|
|
@ -491,10 +491,6 @@ public:
|
||||||
|
|
||||||
this->vscroll->SetCount(_fios_items.Length());
|
this->vscroll->SetCount(_fios_items.Length());
|
||||||
this->DrawWidgets();
|
this->DrawWidgets();
|
||||||
|
|
||||||
if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) {
|
|
||||||
this->DrawEditBox(WID_SL_SAVE_OSK_TITLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnClick(Point pt, int widget, int click_count)
|
virtual void OnClick(Point pt, int widget, int click_count)
|
||||||
|
|
|
@ -521,12 +521,6 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPaint()
|
|
||||||
{
|
|
||||||
this->DrawWidgets();
|
|
||||||
this->DrawEditBox(WID_GL_RANDOM_EDITBOX);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnClick(Point pt, int widget, int click_count)
|
virtual void OnClick(Point pt, int widget, int click_count)
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
|
|
|
@ -773,7 +773,7 @@ void QueryString::HandleEditBox(Window *w, int wid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryString::DrawEditBox(Window *w, int wid)
|
void QueryString::DrawEditBox(const Window *w, int wid) const
|
||||||
{
|
{
|
||||||
const NWidgetBase *wi = w->GetWidget<NWidgetBase>(wid);
|
const NWidgetBase *wi = w->GetWidget<NWidgetBase>(wid);
|
||||||
|
|
||||||
|
@ -818,11 +818,6 @@ void QueryStringBaseWindow::HandleEditBox(int wid)
|
||||||
this->QueryString::HandleEditBox(this, wid);
|
this->QueryString::HandleEditBox(this, wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryStringBaseWindow::DrawEditBox(int wid)
|
|
||||||
{
|
|
||||||
this->QueryString::DrawEditBox(this, wid);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QueryStringBaseWindow::OnOpenOSKWindow(int wid)
|
void QueryStringBaseWindow::OnOpenOSKWindow(int wid)
|
||||||
{
|
{
|
||||||
ShowOnScreenKeyboard(this, wid, 0, 0);
|
ShowOnScreenKeyboard(this, wid, 0, 0);
|
||||||
|
@ -870,13 +865,6 @@ struct QueryStringWindow : public QueryStringBaseWindow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPaint()
|
|
||||||
{
|
|
||||||
this->DrawWidgets();
|
|
||||||
|
|
||||||
this->DrawEditBox(WID_QS_TEXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void SetStringParameters(int widget) const
|
virtual void SetStringParameters(int widget) const
|
||||||
{
|
{
|
||||||
if (widget == WID_QS_CAPTION) SetDParam(0, this->caption);
|
if (widget == WID_QS_CAPTION) SetDParam(0, this->caption);
|
||||||
|
|
|
@ -463,12 +463,6 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
|
||||||
free(pre_buf);
|
free(pre_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPaint()
|
|
||||||
{
|
|
||||||
this->DrawWidgets();
|
|
||||||
this->DrawEditBox(WID_NC_TEXTBOX);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
|
virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
|
||||||
{
|
{
|
||||||
Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height };
|
Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height };
|
||||||
|
|
|
@ -489,9 +489,6 @@ public:
|
||||||
|
|
||||||
this->DrawWidgets();
|
this->DrawWidgets();
|
||||||
|
|
||||||
/* Edit box to filter for keywords */
|
|
||||||
this->DrawEditBox(WID_NCL_FILTER);
|
|
||||||
|
|
||||||
switch (this->content.SortType()) {
|
switch (this->content.SortType()) {
|
||||||
case WID_NCL_CHECKBOX - WID_NCL_CHECKBOX: this->DrawSortButtonState(WID_NCL_CHECKBOX, arrow); break;
|
case WID_NCL_CHECKBOX - WID_NCL_CHECKBOX: this->DrawSortButtonState(WID_NCL_CHECKBOX, arrow); break;
|
||||||
case WID_NCL_TYPE - WID_NCL_CHECKBOX: this->DrawSortButtonState(WID_NCL_TYPE, arrow); break;
|
case WID_NCL_TYPE - WID_NCL_CHECKBOX: this->DrawSortButtonState(WID_NCL_TYPE, arrow); break;
|
||||||
|
|
|
@ -588,8 +588,6 @@ public:
|
||||||
this->GetWidget<NWidgetStacked>(WID_NG_NEWGRF_MISSING_SEL)->SetDisplayedPlane(sel == NULL || !sel->online || sel->info.grfconfig == NULL || !sel->info.version_compatible || sel->info.compatible);
|
this->GetWidget<NWidgetStacked>(WID_NG_NEWGRF_MISSING_SEL)->SetDisplayedPlane(sel == NULL || !sel->online || sel->info.grfconfig == NULL || !sel->info.version_compatible || sel->info.compatible);
|
||||||
|
|
||||||
this->DrawWidgets();
|
this->DrawWidgets();
|
||||||
/* Edit box to set client name */
|
|
||||||
this->DrawEditBox(WID_NG_CLIENT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawDetails(const Rect &r) const
|
void DrawDetails(const Rect &r) const
|
||||||
|
@ -1070,15 +1068,6 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPaint()
|
|
||||||
{
|
|
||||||
/* draw basic widgets */
|
|
||||||
this->DrawWidgets();
|
|
||||||
|
|
||||||
/* editbox to set game name */
|
|
||||||
this->DrawEditBox(WID_NSS_GAMENAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnClick(Point pt, int widget, int click_count)
|
virtual void OnClick(Point pt, int widget, int click_count)
|
||||||
{
|
{
|
||||||
this->field = widget;
|
this->field = widget;
|
||||||
|
@ -2155,12 +2144,6 @@ struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
|
||||||
NetworkChangeCompanyPassword(_local_company, this->edit_str_buf);
|
NetworkChangeCompanyPassword(_local_company, this->edit_str_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPaint()
|
|
||||||
{
|
|
||||||
this->DrawWidgets();
|
|
||||||
this->DrawEditBox(WID_NCP_PASSWORD);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnClick(Point pt, int widget, int click_count)
|
virtual void OnClick(Point pt, int widget, int click_count)
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
|
|
|
@ -736,12 +736,6 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPaint()
|
|
||||||
{
|
|
||||||
this->DrawWidgets();
|
|
||||||
if (this->editable) this->DrawEditBox(WID_NS_FILTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pick the palette for the sprite of the grf to display.
|
* Pick the palette for the sprite of the grf to display.
|
||||||
* @param c grf to display.
|
* @param c grf to display.
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct QueryString {
|
||||||
private:
|
private:
|
||||||
bool HasEditBoxFocus(const Window *w, int wid) const;
|
bool HasEditBoxFocus(const Window *w, int wid) const;
|
||||||
public:
|
public:
|
||||||
void DrawEditBox(Window *w, int wid);
|
void DrawEditBox(const Window *w, int wid) const;
|
||||||
void HandleEditBox(Window *w, int wid);
|
void HandleEditBox(Window *w, int wid);
|
||||||
HandleEditBoxResult HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, EventState &state);
|
HandleEditBoxResult HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, EventState &state);
|
||||||
};
|
};
|
||||||
|
@ -76,7 +76,6 @@ struct QueryStringBaseWindow : public Window, public QueryString {
|
||||||
free(this->edit_str_buf);
|
free(this->edit_str_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawEditBox(int wid);
|
|
||||||
void HandleEditBox(int wid);
|
void HandleEditBox(int wid);
|
||||||
HandleEditBoxResult HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state);
|
HandleEditBoxResult HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state);
|
||||||
|
|
||||||
|
|
|
@ -2047,7 +2047,6 @@ struct GameSettingsWindow : QueryStringBaseWindow {
|
||||||
this->valuedropdown_entry = NULL;
|
this->valuedropdown_entry = NULL;
|
||||||
}
|
}
|
||||||
this->DrawWidgets();
|
this->DrawWidgets();
|
||||||
this->DrawEditBox(WID_GS_FILTER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetStringParameters(int widget) const
|
virtual void SetStringParameters(int widget) const
|
||||||
|
|
|
@ -204,7 +204,6 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
|
||||||
{
|
{
|
||||||
if (this->signs.NeedRebuild()) this->BuildSortSignList();
|
if (this->signs.NeedRebuild()) this->BuildSortSignList();
|
||||||
this->DrawWidgets();
|
this->DrawWidgets();
|
||||||
if (!this->IsShaded()) this->DrawEditBox(WID_SIL_FILTER_TEXT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void DrawWidget(const Rect &r, int widget) const
|
virtual void DrawWidget(const Rect &r, int widget) const
|
||||||
|
@ -523,12 +522,6 @@ struct SignWindow : QueryStringBaseWindow, SignList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPaint()
|
|
||||||
{
|
|
||||||
this->DrawWidgets();
|
|
||||||
if (!this->IsShaded()) this->DrawEditBox(WID_QES_TEXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnClick(Point pt, int widget, int click_count)
|
virtual void OnClick(Point pt, int widget, int click_count)
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
|
|
|
@ -1056,12 +1056,6 @@ public:
|
||||||
if (success) this->RandomTownName();
|
if (success) this->RandomTownName();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPaint()
|
|
||||||
{
|
|
||||||
this->DrawWidgets();
|
|
||||||
if (!this->IsShaded()) this->DrawEditBox(WID_TF_TOWN_NAME_EDITBOX);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnClick(Point pt, int widget, int click_count)
|
virtual void OnClick(Point pt, int widget, int click_count)
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "transparency.h"
|
#include "transparency.h"
|
||||||
#include "core/geometry_func.hpp"
|
#include "core/geometry_func.hpp"
|
||||||
#include "settings_type.h"
|
#include "settings_type.h"
|
||||||
|
#include "querystring_gui.h"
|
||||||
|
|
||||||
#include "table/sprites.h"
|
#include "table/sprites.h"
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
@ -2364,9 +2365,12 @@ void NWidgetLeaf::Draw(const Window *w)
|
||||||
DrawMatrix(r, this->colour, clicked, this->widget_data);
|
DrawMatrix(r, this->colour, clicked, this->widget_data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WWT_EDITBOX:
|
case WWT_EDITBOX: {
|
||||||
DrawFrameRect(r.left, r.top, r.right, r.bottom, this->colour, FR_LOWERED | FR_DARKENED);
|
DrawFrameRect(r.left, r.top, r.right, r.bottom, this->colour, FR_LOWERED | FR_DARKENED);
|
||||||
|
const QueryString *query = dynamic_cast<const QueryString*>(w);
|
||||||
|
if (query != NULL) query->DrawEditBox(w, this->index);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WWT_CAPTION:
|
case WWT_CAPTION:
|
||||||
if (this->index >= 0) w->SetStringParameters(this->index);
|
if (this->index >= 0) w->SetStringParameters(this->index);
|
||||||
|
|
Loading…
Reference in New Issue