| 105 | } |
| 106 | |
| 107 | void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override |
| 108 | { |
| 109 | /* clicked a letter */ |
| 110 | if (widget >= WID_OSK_LETTERS) { |
| 111 | char32_t c = _keyboard[this->shift][widget - WID_OSK_LETTERS]; |
| 112 | |
| 113 | if (!IsValidChar(c, this->qs->text.afilter)) return; |
| 114 | |
| 115 | if (this->qs->text.InsertChar(c)) this->OnEditboxChanged(WID_OSK_TEXT); |
| 116 | |
| 117 | if (HasBit(_keystate, KEYS_SHIFT)) { |
| 118 | ToggleBit(_keystate, KEYS_SHIFT); |
| 119 | this->UpdateOskState(); |
| 120 | this->SetDirty(); |
| 121 | } |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | switch (widget) { |
| 126 | case WID_OSK_BACKSPACE: |
| 127 | if (this->qs->text.DeleteChar(WKC_BACKSPACE)) this->OnEditboxChanged(WID_OSK_TEXT); |
| 128 | break; |
| 129 | |
| 130 | case WID_OSK_SPECIAL: |
| 131 | /* |
| 132 | * Anything device specific can go here. |
| 133 | * The button itself is hidden by default, and when you need it you |
| 134 | * can not hide it in the create event. |
| 135 | */ |
| 136 | break; |
| 137 | |
| 138 | case WID_OSK_CAPS: |
| 139 | ToggleBit(_keystate, KEYS_CAPS); |
| 140 | this->UpdateOskState(); |
| 141 | this->SetDirty(); |
| 142 | break; |
| 143 | |
| 144 | case WID_OSK_SHIFT: |
| 145 | ToggleBit(_keystate, KEYS_SHIFT); |
| 146 | this->UpdateOskState(); |
| 147 | this->SetDirty(); |
| 148 | break; |
| 149 | |
| 150 | case WID_OSK_SPACE: |
| 151 | if (this->qs->text.InsertChar(' ')) this->OnEditboxChanged(WID_OSK_TEXT); |
| 152 | break; |
| 153 | |
| 154 | case WID_OSK_LEFT: |
| 155 | if (this->qs->text.MovePos(WKC_LEFT)) this->InvalidateData(); |
| 156 | break; |
| 157 | |
| 158 | case WID_OSK_RIGHT: |
| 159 | if (this->qs->text.MovePos(WKC_RIGHT)) this->InvalidateData(); |
| 160 | break; |
| 161 | |
| 162 | case WID_OSK_OK: |
| 163 | if (!this->qs->orig.has_value() || this->qs->text.GetText() != this->qs->orig) { |
| 164 | /* pass information by simulating a button press on parent window */ |
nothing calls this directly
no test coverage detected