--- /dev/null
+/*
+ * Acess2 Window Manager v3 (axwin3)
+ * - By John Hodge (thePowersGang)
+ *
+ * include/renderer_classful.h
+ * - Classful renderer messages
+ */
+#ifndef _RENDERER_CLASSFUL_H_
+#define _RENDERER_CLASSFUL_H_
+
+#include "wm_messages.h"
+
+enum eWM_Classful_Messages
+{
+ MSG_CLASSFUL_SETBGCOLOUR = WNDMSG_CLASS_MIN,
+ MSG_CLASSFUL_SETTEXT
+};
+
+#endif
+
--- /dev/null
+/*
+ * Acess2 Window Manager v3 (axwin3)
+ * - By John Hodge (thePowersGang)
+ *
+ * include/wm_internals.h
+ * - Window management internal definitions
+ */
+#ifndef _WM_INTERNALS_H_
+#define _WM_INTERNALS_H_
+
+#include <wm.h>
+
+struct sWindow
+{
+ uint32_t ID;
+ tWMRenderer *Renderer;
+
+ int X;
+ int Y;
+ int W;
+ int H;
+
+ void *RendererInfo;
+
+};
+
+#endif
+
--- /dev/null
+/*
+ * Acess2 Window Manager v3 (axwin3)
+ * - By John Hodge (thePowersGang)
+ *
+ * include/wm_messages.h
+ * - Core window messages
+ */
+#ifndef _WM_MESSAGES_H_
+#define _WM_MESSAGES_H_
+
+enum eWM_WindowMessages
+{
+ WNDMSG_NULL,
+
+ WNDMSG_CREATE,
+ WNDMSG_DESTROY,
+ WNDMSG_FOCUS, // Called on change
+ WNDMSG_SHOW, // Called on change
+
+ WNDMSG_MOUSEMOVE,
+ WNDMSG_MOUSEBTN,
+ WNDMSG_KEYDOWN,
+ WNDMSG_KEYFIRE,
+ WNDMSG_KEYUP,
+
+ WNDMSG_CLASS_MIN = 0x1000,
+ WNDMSG_CLASS_MAX = 0x2000,
+};
+
+#endif
/*
-* Acess2 Window Manager v3 (axwin3)
-* - By John Hodge (thePowersGang)
-*
-* include/wm_renderer.h
-* - Window renderer API
-*/
+ * Acess2 Window Manager v3 (axwin3)
+ * - By John Hodge (thePowersGang)
+ *
+ * include/wm_renderer.h
+ * - Window renderer API
+ */
#ifndef _WM_RENDERER_H_
#define _WM_RENDERER_H_
#include <wm.h>
+#include <wm_internals.h>
struct sWMRenderer
{
* \param MessageID Implementation defined message ID (usually the command)
* \param Length Length of the buffer \a Data
* \param Data Implementation defined data buffer
+ * \return Boolean failure (0: Handled, 1: Unhandled)
*/
int (*HandleMessage)(tWindow *Window, int MessageID, int Length, void *Data);
};
*/
#include <common.h>
#include <wm_renderer.h>
+#include <renderer_classful.h>
+
+// === TYPES ===
+typedef struct sClassfulInfo
+{
+ tColour BGColour;
+} tClassfulInfo;
// === PROTOTYPES ===
tWindow *Renderer_Class_Create(int Width, int Height, int Flags);
tWindow *Renderer_Class_Create(int Width, int Height, int Flags)
{
- // TODO: Add info
- return WM_CreateWindowStruct(0);
+ return WM_CreateWindowStruct(sizeof(tClassfulInfo));
}
void Renderer_Class_Redraw(tWindow *Window)
{
+ tClassfulInfo *info = Window->RendererInfo;
Render_DrawFilledRect(Window, info->BGColour, 0, 0, Window->W, Window->H);
}
case MSG_CLASSFUL_SETBGCOLOUR:
if( Len != sizeof(uint32_t) ) return -1;
info->BGColour = *(uint32_t*)Data;
- break;
+ return 0;
case MSG_CLASSFUL_SETTEXT:
- break;
+ return -1;
+
+ // Anything else is unhandled
+ default:
+ return 1;
}
}
#include <common.h>
#include <wm_renderer.h>
+// === PROTOTYPES ===
+tWindow *Renderer_Passthru_Create(int Width, int Height, int Flags);
+void Renderer_Passthru_Redraw(tWindow *Window);
+ int Renderer_Passthru_HandleMessage(tWindow *Target, int Msg, int Len, void *Data);
+
// === GLOBALS ===
tWMRenderer gRenderer_Passthru = {
.Name = "Passthru",
.CreateWindow = Renderer_Passthru_Create,
.Redraw = Renderer_Passthru_Redraw,
- .SendMessage = Renderer_Passthru_SendMessage
+ .HandleMessage = Renderer_Passthru_HandleMessage
};
// === CODE ===
return 0;
}
+tWindow *Renderer_Passthru_Create(int Width, int Height, int Flags)
+{
+ return NULL;
+}
+
+void Renderer_Passthru_Redraw(tWindow *Window)
+{
+
+}
+
+int Renderer_Passthru_HandleMessage(tWindow *Target, int Msg, int Len, void *Data)
+{
+ return 1;
+}
+
tWindow *Renderer_Widget_Create(int Width, int Height, int Flags)
{
// TODO: Add info
- return WM_CreateWindowStruct(tWidgetWin_Info);
+ return WM_CreateWindowStruct( sizeof(tWidgetWin) );
}
void Renderer_Widget_Redraw(tWindow *Window)
int Renderer_Widget_HandleMessage(tWindow *Target, int Msg, int Len, void *Data)
{
- tClassfulInfo *info = Target->RendererInfo;
+ tWidgetWin *info = Target->RendererInfo;
switch(Msg)
{
-
+ default:
+ return 1; // Unhandled
}
}