From 61f7316d562f4c02c9e3d1bb30c3ba3963ded4a8 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 5 Dec 2014 10:27:45 -0500 Subject: Moved the rewrite of the new Windows Table to its /own/ folder. --- wintable/NEWcoord.h | 31 ----------------------------- wintable/NEWevents.h | 54 --------------------------------------------------- wintable/NEWutil.h | 14 ------------- wintable/new/coord.h | 31 +++++++++++++++++++++++++++++ wintable/new/events.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ wintable/new/util.h | 14 +++++++++++++ 6 files changed, 99 insertions(+), 99 deletions(-) delete mode 100644 wintable/NEWcoord.h delete mode 100644 wintable/NEWevents.h delete mode 100644 wintable/NEWutil.h create mode 100644 wintable/new/coord.h create mode 100644 wintable/new/events.h create mode 100644 wintable/new/util.h diff --git a/wintable/NEWcoord.h b/wintable/NEWcoord.h deleted file mode 100644 index 1814e87..0000000 --- a/wintable/NEWcoord.h +++ /dev/null @@ -1,31 +0,0 @@ -// 4 december 2014 - -typedef struct rowcol rowcol; - -struct rowcol { - intptr_t row; - intptr_t column; -}; - -static rowcol clientCoordToRowColumn(struct table *t, POINT pt) -{ - // TODO -} - -// same as client coordinates, but stored in a lParam (like the various mouse messages provide) -static rowcol lParamToRowColumn(struct table *t, LPARAM lParam) -{ - POINT pt; - - pt.x = GET_X_LPARAM(lParam); - pt.y = GET_Y_LPARAM(lParam); - return clientCoordToRowColumn(t, pt); -} - -// returns TRUE if the row is visible and thus has client coordinates; FALSE otherwise -static BOOL rowColumnToClientCoord(struct table *t, rowcol rc, struct POINT *pt) -{ - // TODO -} - -// TODO idealCoordToRowColumn/rowColumnToIdealCoord? diff --git a/wintable/NEWevents.h b/wintable/NEWevents.h deleted file mode 100644 index cef722a..0000000 --- a/wintable/NEWevents.h +++ /dev/null @@ -1,54 +0,0 @@ -// 5 december 2014 - -static handlerfunc keyDownHandlers[] = { - NULL, -}; - -static handlerfunc keyUpHandlers[] = { - NULL, -}; - -static handlerfunc charHandlers[] = { - NULL, -}; - -static handlerfunc mouseMoveHandlers[] = { - NULL, -}; - -static handlerfunc mouseLeaveHandlers[] = { - NULL, -}; - -static handlerfunc lbuttonDownHandlers[] = { - NULL, -}; - -static handlerufnc lbuttonUpHandlers[] = { - NULL, -}; - -static handlerfunc mouseWheelHandlers[] = { - NULL, -}; - -// TODO WM_MOUSEHOVER, other mouse buttons - -HANDLER(events) -{ - switch (uMsg) { -#define eventHandler(msg, array) \ - case msg: \ - return runHandlers(array, t, uMsg, wParam, lParam, lResult); - eventHandler(WM_KEYDOWN, keyDownHandlers) - eventHandler(WM_KEYUP, keyUpHandlers) - eventHandler(WM_CHAR, charHandlers) - eventHandler(WM_MOUSEMOVE, mouseMoveHandlers) - eventHandler(WM_MOUSELEAVE, mouseLeaveHandlers) - eventHandler(WM_LBUTTONDOWN, lbuttonDownHandlers) - eventHandler(WM_LBUTTONUP, lbuttonUpHandlers) - eventHandler(WM_MOUSEWHEEL, mouseWheelHandlers) -#undef eventHandler - } - return FALSE; -} diff --git a/wintable/NEWutil.h b/wintable/NEWutil.h deleted file mode 100644 index c6cbfb3..0000000 --- a/wintable/NEWutil.h +++ /dev/null @@ -1,14 +0,0 @@ -// 4 december 2014 - -typedef BOOL (*handlerfunc)(struct table *, UINT, WPARAM, LPARAM, LRESULT *); -#define HANDLER(name) static BOOL name(struct table *t, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult) - -static BOOL runHandlers(handlerfunc *list, struct table *t, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult) -{ - handlerfunc *p; - - for (p = list; *p != NULL; p++) - if ((*(*p))(t, uMsg, wParam, lParam, lResult)) - return TRUE; - return FALSE; -} diff --git a/wintable/new/coord.h b/wintable/new/coord.h new file mode 100644 index 0000000..1814e87 --- /dev/null +++ b/wintable/new/coord.h @@ -0,0 +1,31 @@ +// 4 december 2014 + +typedef struct rowcol rowcol; + +struct rowcol { + intptr_t row; + intptr_t column; +}; + +static rowcol clientCoordToRowColumn(struct table *t, POINT pt) +{ + // TODO +} + +// same as client coordinates, but stored in a lParam (like the various mouse messages provide) +static rowcol lParamToRowColumn(struct table *t, LPARAM lParam) +{ + POINT pt; + + pt.x = GET_X_LPARAM(lParam); + pt.y = GET_Y_LPARAM(lParam); + return clientCoordToRowColumn(t, pt); +} + +// returns TRUE if the row is visible and thus has client coordinates; FALSE otherwise +static BOOL rowColumnToClientCoord(struct table *t, rowcol rc, struct POINT *pt) +{ + // TODO +} + +// TODO idealCoordToRowColumn/rowColumnToIdealCoord? diff --git a/wintable/new/events.h b/wintable/new/events.h new file mode 100644 index 0000000..cef722a --- /dev/null +++ b/wintable/new/events.h @@ -0,0 +1,54 @@ +// 5 december 2014 + +static handlerfunc keyDownHandlers[] = { + NULL, +}; + +static handlerfunc keyUpHandlers[] = { + NULL, +}; + +static handlerfunc charHandlers[] = { + NULL, +}; + +static handlerfunc mouseMoveHandlers[] = { + NULL, +}; + +static handlerfunc mouseLeaveHandlers[] = { + NULL, +}; + +static handlerfunc lbuttonDownHandlers[] = { + NULL, +}; + +static handlerufnc lbuttonUpHandlers[] = { + NULL, +}; + +static handlerfunc mouseWheelHandlers[] = { + NULL, +}; + +// TODO WM_MOUSEHOVER, other mouse buttons + +HANDLER(events) +{ + switch (uMsg) { +#define eventHandler(msg, array) \ + case msg: \ + return runHandlers(array, t, uMsg, wParam, lParam, lResult); + eventHandler(WM_KEYDOWN, keyDownHandlers) + eventHandler(WM_KEYUP, keyUpHandlers) + eventHandler(WM_CHAR, charHandlers) + eventHandler(WM_MOUSEMOVE, mouseMoveHandlers) + eventHandler(WM_MOUSELEAVE, mouseLeaveHandlers) + eventHandler(WM_LBUTTONDOWN, lbuttonDownHandlers) + eventHandler(WM_LBUTTONUP, lbuttonUpHandlers) + eventHandler(WM_MOUSEWHEEL, mouseWheelHandlers) +#undef eventHandler + } + return FALSE; +} diff --git a/wintable/new/util.h b/wintable/new/util.h new file mode 100644 index 0000000..c6cbfb3 --- /dev/null +++ b/wintable/new/util.h @@ -0,0 +1,14 @@ +// 4 december 2014 + +typedef BOOL (*handlerfunc)(struct table *, UINT, WPARAM, LPARAM, LRESULT *); +#define HANDLER(name) static BOOL name(struct table *t, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult) + +static BOOL runHandlers(handlerfunc *list, struct table *t, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult) +{ + handlerfunc *p; + + for (p = list; *p != NULL; p++) + if ((*(*p))(t, uMsg, wParam, lParam, lResult)) + return TRUE; + return FALSE; +} -- cgit v1.2.3