@@ -238,6 +238,7 @@ namespace lsp
238238 // Bind slots
239239 id = sSlots .add (SLOT_CHANGE , slot_on_change, self ());
240240 if (id >= 0 ) id = sSlots .add (SLOT_SUBMIT , slot_on_submit, self ());
241+ if (id >= 0 ) id = sSlots .add (SLOT_CANCEL , slot_on_cancel, self ());
241242
242243 return (id >= 0 ) ? STATUS_OK : -id;
243244 }
@@ -795,41 +796,47 @@ namespace lsp
795796
796797 status_t ListBox::slot_on_scroll_change (Widget *sender, void *ptr, void *data)
797798 {
798- ListBox *_this = widget_ptrcast<ListBox>(ptr);
799- if (_this == NULL )
799+ ListBox * const self = widget_ptrcast<ListBox>(ptr);
800+ if (self == NULL )
800801 return STATUS_OK ;
801802
802- if ((&_this ->sHBar != sender) && (&_this ->sVBar != sender))
803+ if ((&self ->sHBar != sender) && (&self ->sVBar != sender))
803804 return STATUS_OK ;
804805
805- if (&_this ->sHBar == sender)
806- _this ->sHScroll .commit_value (_this ->sHBar .value ()->get ());
807- else if (&_this ->sVBar == sender)
808- _this ->sVScroll .commit_value (_this ->sVBar .value ()->get ());
806+ if (&self ->sHBar == sender)
807+ self ->sHScroll .commit_value (self ->sHBar .value ()->get ());
808+ else if (&self ->sVBar == sender)
809+ self ->sVScroll .commit_value (self ->sVBar .value ()->get ());
809810
810- _this ->realize_children ();
811- _this ->query_draw ();
811+ self ->realize_children ();
812+ self ->query_draw ();
812813
813814 return STATUS_OK ;
814815 }
815816
816817 status_t ListBox::slot_on_scroll_key_event (Widget *sender, void *ptr, void *data)
817818 {
818- ListBox *_this = widget_ptrcast<ListBox>(ptr);
819- const ws::event_t *e = static_cast <ws::event_t *>(data);
820- return (_this != NULL ) ? _this ->handle_event (e) : STATUS_OK ;
819+ ListBox * const self = widget_ptrcast<ListBox>(ptr);
820+ const ws::event_t * const e = static_cast <ws::event_t *>(data);
821+ return (self != NULL ) ? self ->handle_event (e) : STATUS_OK ;
821822 }
822823
823824 status_t ListBox::slot_on_change (Widget *sender, void *ptr, void *data)
824825 {
825- ListBox *_this = widget_ptrcast<ListBox>(ptr);
826- return (_this != NULL ) ? _this ->on_change () : STATUS_BAD_ARGUMENTS ;
826+ ListBox * const self = widget_ptrcast<ListBox>(ptr);
827+ return (self != NULL ) ? self ->on_change () : STATUS_BAD_ARGUMENTS ;
827828 }
828829
829830 status_t ListBox::slot_on_submit (Widget *sender, void *ptr, void *data)
830831 {
831- ListBox *_this = widget_ptrcast<ListBox>(ptr);
832- return (_this != NULL ) ? _this->on_submit () : STATUS_BAD_ARGUMENTS ;
832+ ListBox * const self = widget_ptrcast<ListBox>(ptr);
833+ return (self != NULL ) ? self->on_submit () : STATUS_BAD_ARGUMENTS ;
834+ }
835+
836+ status_t ListBox::slot_on_cancel (Widget *sender, void *ptr, void *data)
837+ {
838+ ListBox * const self = widget_ptrcast<ListBox>(ptr);
839+ return (self != NULL ) ? self->on_cancel () : STATUS_BAD_ARGUMENTS ;
833840 }
834841
835842 void ListBox::on_add_item (void *obj, Property *prop, void *w)
@@ -1190,6 +1197,10 @@ namespace lsp
11901197 sSlots .execute (SLOT_SUBMIT , this , NULL );
11911198 break ;
11921199
1200+ case ws::WSK_ESCAPE :
1201+ sSlots .execute (SLOT_CANCEL , this , NULL );
1202+ break ;
1203+
11931204 default :
11941205 break ;
11951206 }
@@ -1343,5 +1354,10 @@ namespace lsp
13431354 return STATUS_OK ;
13441355 }
13451356
1357+ status_t ListBox::on_cancel ()
1358+ {
1359+ return STATUS_OK ;
1360+ }
1361+
13461362 } /* namespace tk */
13471363} /* namespace lsp */
0 commit comments