equal
deleted
inserted
replaced
40 KEYS_CAPS |
40 KEYS_CAPS |
41 }; |
41 }; |
42 static byte _keystate = KEYS_NONE; |
42 static byte _keystate = KEYS_NONE; |
43 |
43 |
44 struct OskWindow : public Window { |
44 struct OskWindow : public Window { |
|
45 StringID caption; ///< the caption for this window. |
45 QueryString *qs; ///< text-input |
46 QueryString *qs; ///< text-input |
46 int text_btn; ///< widget number of parent's text field |
47 int text_btn; ///< widget number of parent's text field |
47 int ok_btn; ///< widget number of parent's ok button (=0 when ok shouldn't be passed on) |
48 int ok_btn; ///< widget number of parent's ok button (=0 when ok shouldn't be passed on) |
48 int cancel_btn; ///< widget number of parent's cancel button (=0 when cancel shouldn't be passed on; text will be reverted to original) |
49 int cancel_btn; ///< widget number of parent's cancel button (=0 when cancel shouldn't be passed on; text will be reverted to original) |
49 Textbuf *text; ///< pointer to parent's textbuffer (to update caret position) |
50 Textbuf *text; ///< pointer to parent's textbuffer (to update caret position) |
52 OskWindow(const WindowDesc *desc, QueryStringBaseWindow *parent, int button, int cancel, int ok) : Window(desc) |
53 OskWindow(const WindowDesc *desc, QueryStringBaseWindow *parent, int button, int cancel, int ok) : Window(desc) |
53 { |
54 { |
54 this->parent = parent; |
55 this->parent = parent; |
55 assert(parent != NULL); |
56 assert(parent != NULL); |
56 |
57 |
57 if (parent->widget[button].data != 0) parent->caption = parent->widget[button].data; |
58 this->caption = (parent->widget[button].data != STR_NULL) ? parent->widget[button].data : parent->caption; |
58 |
59 |
59 this->qs = parent; |
60 this->qs = parent; |
60 this->text_btn = button; |
61 this->text_btn = button; |
61 this->cancel_btn = cancel; |
62 this->cancel_btn = cancel; |
62 this->ok_btn = ok; |
63 this->ok_btn = ok; |
94 this->SetWidgetLoweredState(OSK_WIDGET_SHIFT, HasBit(_keystate, KEYS_SHIFT)); |
95 this->SetWidgetLoweredState(OSK_WIDGET_SHIFT, HasBit(_keystate, KEYS_SHIFT)); |
95 this->SetWidgetLoweredState(OSK_WIDGET_CAPS, HasBit(_keystate, KEYS_CAPS)); |
96 this->SetWidgetLoweredState(OSK_WIDGET_CAPS, HasBit(_keystate, KEYS_CAPS)); |
96 |
97 |
97 this->ChangeOskDiabledState(shift); |
98 this->ChangeOskDiabledState(shift); |
98 |
99 |
99 SetDParam(0, this->qs->caption); |
100 SetDParam(0, this->caption); |
100 DrawWindowWidgets(this); |
101 DrawWindowWidgets(this); |
101 |
102 |
102 for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { |
103 for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { |
103 DrawCharCentered(_keyboard[shift][i], |
104 DrawCharCentered(_keyboard[shift][i], |
104 this->widget[OSK_WIDGET_LETTERS + i].left + 8, |
105 this->widget[OSK_WIDGET_LETTERS + i].left + 8, |