Changeset - r19789:9fa6b47aa718
[Not reviewed]
master
0 3 0
frosch - 12 years ago 2012-11-14 22:50:42
frosch@openttd.org
(svn r24744) -Codechange: Handle clicking on editboxed also via QueryString.
3 files changed with 15 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/misc_gui.cpp
Show inline comments
 
@@ -811,6 +811,14 @@ void QueryString::DrawEditBox(const Wind
 
	_cur_dpi = old_dpi;
 
}
 

	
 
void QueryString::ClickEditBox(Window *w, Point pt, int wid, int click_count, bool focus_changed)
 
{
 
	if (!focus_changed && w->window_class != WC_OSK) {
 
		/* Open the OSK window if clicked on an edit box, while not changing focus */
 
		ShowOnScreenKeyboard(w, wid);
 
	}
 
}
 

	
 
/** Class for the string query window. */
 
struct QueryStringWindow : public Window
 
{
src/querystring_gui.h
Show inline comments
 
@@ -65,6 +65,7 @@ private:
 
	bool HasEditBoxFocus(const Window *w, int wid) const;
 
public:
 
	void DrawEditBox(const Window *w, int wid) const;
 
	void ClickEditBox(Window *w, Point pt, int wid, int click_count, bool focus_changed);
 
	void HandleEditBox(Window *w, int wid);
 
	HandleEditBoxResult HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, EventState &state);
 
};
src/window.cpp
Show inline comments
 
@@ -463,20 +463,19 @@ static void DispatchLeftClickEvent(Windo
 

	
 
	if ((widget_type & ~WWB_PUSHBUTTON) < WWT_LAST && (widget_type & WWB_PUSHBUTTON)) w->HandleButtonClick(widget_index);
 

	
 
	Point pt = { x, y };
 

	
 
	switch (widget_type) {
 
		case NWID_VSCROLLBAR:
 
		case NWID_HSCROLLBAR:
 
			ScrollbarClickHandler(w, nw, x, y);
 
			break;
 

	
 
		case WWT_EDITBOX:
 
			if (!focused_widget_changed) { // Only open the OSK window if clicking on an already focused edit box
 
				/* Open the OSK window if clicked on an edit box */
 
				if (w->querystrings.Contains(widget_index)) {
 
					ShowOnScreenKeyboard(w, widget_index);
 
		case WWT_EDITBOX: {
 
			QueryString *query = w->GetQueryString(widget_index);
 
			if (query != NULL) query->ClickEditBox(w, pt, widget_index, click_count, focused_widget_changed);
 
			break;
 
				}
 
			}
 
			break;
 

	
 
		case WWT_CLOSEBOX: // 'X'
 
			delete w;
 
@@ -520,7 +519,6 @@ static void DispatchLeftClickEvent(Windo
 
		Game::NewEvent(new ScriptEventWindowWidgetClick((ScriptWindow::WindowClass)w->window_class, w->window_number, widget_index));
 
	}
 

	
 
	Point pt = { x, y };
 
	w->OnClick(pt, widget_index, click_count);
 
}
 

	
0 comments (0 inline, 0 general)