diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2012-12-05 15:12:20 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2012-12-05 15:12:20 +0000 |
commit | 00b324bfc162030b575e03795dcfcaac56bd0b4d (patch) | |
tree | fbaada243839b0b67351856e2d02a2e8184bf65f /ColorsPanel.c | |
parent | 2a73405cd060b543d56987650327b18078a137d7 (diff) |
Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers.
Diffstat (limited to 'ColorsPanel.c')
-rw-r--r-- | ColorsPanel.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ColorsPanel.c b/ColorsPanel.c index bf94bf53..4e28d017 100644 --- a/ColorsPanel.c +++ b/ColorsPanel.c @@ -51,7 +51,7 @@ static void ColorsPanel_delete(Object* object) { free(this); } -static HandlerResult ColorsPanel_EventHandler(Panel* super, int ch) { +static HandlerResult ColorsPanel_eventHandler(Panel* super, int ch) { ColorsPanel* this = (ColorsPanel*) super; HandlerResult result = IGNORED; @@ -83,15 +83,21 @@ static HandlerResult ColorsPanel_EventHandler(Panel* super, int ch) { return result; } +PanelClass ColorsPanel_class = { + .super = { + .extends = Class(Panel), + .delete = ColorsPanel_delete + }, + .eventHandler = ColorsPanel_eventHandler +}; + ColorsPanel* ColorsPanel_new(Settings* settings, ScreenManager* scr) { - ColorsPanel* this = (ColorsPanel*) malloc(sizeof(ColorsPanel)); + ColorsPanel* this = AllocThis(ColorsPanel); Panel* super = (Panel*) this; - Panel_init(super, 1, 1, 1, 1, CHECKITEM_CLASS, true); - ((Object*)this)->delete = ColorsPanel_delete; + Panel_init(super, 1, 1, 1, 1, Class(CheckItem), true); this->settings = settings; this->scr = scr; - super->eventHandler = ColorsPanel_EventHandler; Panel_setHeader(super, "Colors"); for (int i = 0; ColorSchemes[i] != NULL; i++) { |