Set up a new infrastruture which allows both scrolling and non-scrolling areas AND mouse entered/exited events.

This commit is contained in:
Pietro Gagliardi 2015-12-17 13:50:07 -05:00
parent 4e256dfc95
commit 12a94404aa
1 changed files with 9 additions and 5 deletions

14
ui.h
View File

@ -279,26 +279,30 @@ typedef struct uiDrawContext uiDrawContext;
struct uiAreaHandler {
void (*Draw)(uiAreaHandler *, uiArea *, uiAreaDrawParams *);
uintmax_t (*HScrollMax)(uiAreaHandler *, uiArea *);
uintmax_t (*VScrollMax)(uiAreaHandler *, uiArea *);
// TODO document that resizes cause a full redraw
// TODO document that resizes cause a full redraw for non-scrolling areas; implementation-defined for scrolling areas
// TODO if the scrollbars disappear the histogram example won't recognize points in the correct spot until the area is resized
// TODO mouse leave event?
void (*MouseEvent)(uiAreaHandler *, uiArea *, uiAreaMouseEvent *);
// TODO document that on first show if the mouse is already in the uiArea then one gets sent with left=0
// TODO what about when the area is hidden and then shown again?
void (*MouseCrossed)(uiAreaHandler *, int left);
void (*DragBroken)(uiAreaHandler *, uiArea *);
int (*KeyEvent)(uiAreaHandler *, uiArea *, uiAreaKeyEvent *);
};
_UI_EXTERN uintmax_t uiMenuItemType(void);
#define uiArea(this) ((uiArea *) uiIsA((this), uiAreaType(), 1))
_UI_EXTERN void uiAreaUpdateScroll(uiArea *a);
// TODO give a better name
_UI_EXTERN void uiAreaSetSize(uiArea *a, intmax_t width, intmax_t height);
// TODO uiAreaQueueRedraw()
_UI_EXTERN void uiAreaQueueRedrawAll(uiArea *a);
_UI_EXTERN uiArea *uiNewArea(uiAreaHandler *ah);
_UI_EXTERN uiArea *uiNewScrollingArea(uiAreaHandler *ah, intmax_t width, intmax_t height);
struct uiAreaDrawParams {
uiDrawContext *Context;
// TODO document that this is only defined for nonscrolling areas
// TODO rename to AreaWidth/Height?
double ClientWidth;
double ClientHeight;