From 65357c8c46154de4e4eca14075bfe5523bb5fc14 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 7 Dec 2020 10:26:01 +0100 Subject: New upstream version 3.0.3 --- Panel.h | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'Panel.h') diff --git a/Panel.h b/Panel.h index 480e2c0..86c134e 100644 --- a/Panel.h +++ b/Panel.h @@ -3,14 +3,19 @@ /* htop - Panel.h (C) 2004-2011 Hisham H. Muhammad -Released under the GNU GPL, see the COPYING file +Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include + +#include "FunctionBar.h" #include "Object.h" +#include "RichString.h" #include "Vector.h" -#include "FunctionBar.h" + +struct Panel_; typedef struct Panel_ Panel; typedef enum HandlerResult_ { @@ -22,11 +27,11 @@ typedef enum HandlerResult_ { SYNTH_KEY = 0x20, } HandlerResult; -#define EVENT_SET_SELECTED -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) +#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); @@ -35,14 +40,13 @@ typedef struct PanelClass_ { const Panel_EventHandler eventHandler; } PanelClass; -#define As_Panel(this_) ((PanelClass*)((this_)->super.klass)) +#define As_Panel(this_) ((const PanelClass*)((this_)->super.klass)) #define Panel_eventHandlerFn(this_) As_Panel(this_)->eventHandler #define Panel_eventHandler(this_, ev_) As_Panel(this_)->eventHandler((Panel*)(this_), ev_) struct Panel_ { Object super; int x, y, w, h; - WINDOW* window; Vector* items; int selected; int oldSelected; @@ -57,17 +61,17 @@ struct Panel_ { int selectionColor; }; -#define Panel_setDefaultBar(this_) do{ (this_)->currentBar = (this_)->defaultBar; }while(0) +#define Panel_setDefaultBar(this_) do { (this_)->currentBar = (this_)->defaultBar; } while (0) #define KEY_CTRL(l) ((l)-'A'+1) -extern PanelClass Panel_class; +extern const PanelClass Panel_class; -Panel* Panel_new(int x, int y, int w, int h, bool owner, ObjectClass* type, FunctionBar* fuBar); +Panel* Panel_new(int x, int y, int w, int h, bool owner, const 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, FunctionBar* fuBar); +void Panel_init(Panel* this, int x, int y, int w, int h, const ObjectClass* type, bool owner, FunctionBar* fuBar); void Panel_done(Panel* this); @@ -105,9 +109,9 @@ int Panel_size(Panel* this); void Panel_setSelected(Panel* this, int selected); -void Panel_draw(Panel* this, bool focus); +void Panel_draw(Panel* this, bool focus, bool highlightSelected); -void Panel_splice(Panel *this, Vector* from); +void Panel_splice(Panel* this, Vector* from); bool Panel_onKey(Panel* this, int key); -- cgit v1.2.3