From ff9409b1737627857eb47f64f536a3f66b6a09a4 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 11 Apr 2016 13:01:07 +0200 Subject: Imported Upstream version 2.0.0 --- Panel.h | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'Panel.h') diff --git a/Panel.h b/Panel.h index 91c0a40..6789770 100644 --- a/Panel.h +++ b/Panel.h @@ -13,16 +13,24 @@ in the source distribution for its full text. #include "Object.h" #include "Vector.h" +#include "FunctionBar.h" typedef struct Panel_ Panel; typedef enum HandlerResult_ { - HANDLED, - IGNORED, - BREAK_LOOP + HANDLED = 0x01, + IGNORED = 0x02, + BREAK_LOOP = 0x04, + REDRAW = 0x08, + RESCAN = 0x10, + SYNTH_KEY = 0x20, } HandlerResult; -#define EVENT_SETSELECTED -1 +#define EVENT_SET_SELECTED -1 + +#define EVENT_HEADER_CLICK(x_) (-10000 + x_) +#define EVENT_IS_HEADER_CLICK(ev_) (ev_ >= -10000 && ev_ <= -9000) +#define EVENT_HEADER_CLICK_GET_X(ev_) (ev_ + 10000) typedef HandlerResult(*Panel_EventHandler)(Panel*, int); @@ -37,19 +45,23 @@ typedef struct PanelClass_ { struct Panel_ { Object super; - PanelClass* class; int x, y, w, h; WINDOW* window; Vector* items; int selected; int oldSelected; - char* eventHandlerBuffer; + void* eventHandlerState; int scrollV; short scrollH; bool needsRedraw; + FunctionBar* currentBar; + FunctionBar* defaultBar; RichString header; + int selectionColor; }; +#define Panel_setDefaultBar(this_) do{ (this_)->currentBar = (this_)->defaultBar; }while(0) + #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) @@ -65,14 +77,16 @@ struct Panel_ { extern PanelClass Panel_class; -Panel* Panel_new(int x, int y, int w, int h, bool owner, ObjectClass* type); +Panel* Panel_new(int x, int y, int w, int h, bool owner, ObjectClass* type, FunctionBar* fuBar); void Panel_delete(Object* cast); -void Panel_init(Panel* this, int x, int y, int w, int h, ObjectClass* type, bool owner); +void Panel_init(Panel* this, int x, int y, int w, int h, ObjectClass* type, bool owner, FunctionBar* fuBar); void Panel_done(Panel* this); +void Panel_setSelectionColor(Panel* this, int color); + RichString* Panel_getHeader(Panel* this); extern void Panel_setHeader(Panel* this, const char* header); -- cgit v1.2.3