169 /* pass information by simulating a button press on parent window */ |
171 /* pass information by simulating a button press on parent window */ |
170 if (this->ok_btn != 0) { |
172 if (this->ok_btn != 0) { |
171 this->parent->OnClick(pt, this->ok_btn); |
173 this->parent->OnClick(pt, this->ok_btn); |
172 } |
174 } |
173 } |
175 } |
174 delete this; |
176 delete_this = true; |
175 break; |
177 break; |
176 |
178 |
177 case OSK_WIDGET_CANCEL: |
179 case OSK_WIDGET_CANCEL: |
178 if (this->cancel_btn != 0) { // pass a cancel event to the parent window |
180 if (this->cancel_btn != 0) { // pass a cancel event to the parent window |
179 this->parent->OnClick(pt, this->cancel_btn); |
181 this->parent->OnClick(pt, this->cancel_btn); |
180 /* Window gets deleted when the parent window removes itself. */ |
182 /* Window gets deleted when the parent window removes itself. */ |
181 } else { // or reset to original string |
183 } else { // or reset to original string |
182 strcpy(qs->text.buf, this->orig_str_buf); |
184 strcpy(qs->text.buf, this->orig_str_buf); |
183 UpdateTextBufferSize(&qs->text); |
185 UpdateTextBufferSize(&qs->text); |
184 MoveTextBufferPos(&qs->text, WKC_END); |
186 MoveTextBufferPos(&qs->text, WKC_END); |
185 delete this; |
187 delete_this = true; |
186 } |
188 } |
187 break; |
189 break; |
188 } |
190 } |
189 /* make sure that the parent window's textbox also gets updated */ |
191 /* make sure that the parent window's textbox also gets updated */ |
190 if (this->parent != NULL) this->parent->InvalidateWidget(this->text_btn); |
192 if (this->parent != NULL) this->parent->InvalidateWidget(this->text_btn); |
|
193 if (delete_this) delete this; |
191 } |
194 } |
192 |
195 |
193 virtual void OnMouseLoop() |
196 virtual void OnMouseLoop() |
194 { |
197 { |
195 this->qs->HandleEditBox(this, OSK_WIDGET_TEXT); |
198 this->qs->HandleEditBox(this, OSK_WIDGET_TEXT); |