* \brief Axis Definition in file data\r
*\r
* Describes the current state of an axis on the joystick.\r
- * \a MinValue and \a MaxValue describe the valid range for \a CurValue\r
- * While \a CurState is between zero and the current limit set by the\r
- * JOY_IOCTL_GETSETAXISLIMIT IOCtl.\r
+ * \a CursorPos is between zero and the current limit set by the\r
+ * JOY_IOCTL_GETSETAXISLIMIT IOCtl, while \a CurValue indicates the\r
+ * current position of the joystick axis. This is defined to be between\r
+ * \a MinValue and \a MaxValue.\r
*/\r
struct sJoystick_Axis\r
{\r
Sint16 MinValue; //!< Minumum value for \a CurValue\r
Sint16 MaxValue; //!< Maximum value for \a CurValue\r
Sint16 CurValue; //!< Current value (joystick position)\r
- Uint16 CurState; //!< Current state (cursor position)\r
+ Uint16 CursorPos; //!< Current state (cursor position)\r
};\r
\r
+#define JOY_INFOSTRUCT(_naxies, _nbuttons) struct { \\r
+ Uint16 NAxies, NButtons;\\r
+ tJoystick_Axis Axies[_naxies];\\r
+ Uint16 Buttons[_nbuttons];\\r
+ }\r
+\r
#endif\r
*/
#include <axwin2/axwin.h>
+// === CONSTANTS ===
+enum eTerminal_Events
+{
+ EVENT_NULL,
+ EVENT_NEW_TAB,
+ EVENT_CLOSE_TAB,
+ EVENT_EXIT
+};
+
// === PROTOTYPES ===
int main(int argc, char *argv[]);
- int Menubar_HandleMessage(tAxWin_Message *Message);
+ int Global_HandleMessage(tAxWin_Message *Message);
+ int Shell_HandleMessage(tAxWin_Message *Message);
// === GLOBALS ===
-tAxWin_Element geConsole;
+tAxWin_Element *geConsole;
// === CODE ===
int main(int argc, char *argv[])
{
- AxWin_Register("Terminal");
-
+ tAxWin_Element *menu, *tab;
+ AxWin_Register("Terminal", Global_HandleMessage);
+
+ menu = AxWin_AddMenuItem(NULL, "File", 0);
+ AxWin_AddMenuItem(menu, "&New Tab\tCtrl-Shift-N", EVENT_NEW_TAB);
+ AxWin_AddMenuItem(menu, NULL, 0);
+ AxWin_AddMenuItem(menu, "&Close Tab\tCtrl-Shift-W", EVENT_CLOSE_TAB);
+ AxWin_AddMenuItem(menu, "E&xit\tAlt-F4", EVENT_EXIT);
+
+ tab = AxWin_CreateTab("root@acess: ~");
//geConsole = AxWin_CreateElement();
AxWin_MessageLoop();
/**
*/
-int Menubar_HandleMessage(tAxWin_Message *Message)
+int Global_HandleMessage(tAxWin_Message *Message)
+{
+ return 0;
+}
+
+int Shell_HandleMessage(tAxWin_Message *Message)
{
return 0;
}
* By John Hodge (thePowersGang)
*/
#include "common.h"
+#include <acess/sys.h>
// === CODE ===
void Input_FillSelect(int *nfds, fd_set *set)
{
if(FD_ISSET(giTerminalFD, set))
{
+ // TODO:
+ }
+
+ if(FD_ISSET(giMouseFD, set))
+ {
+ struct sMouseInfo {
+ uint16_t NAxies, NButtons;
+ struct sMouseAxis {
+ int16_t MinValue, MaxValue;
+ int16_t CurValue;
+ uint16_t CursorPos;
+ } Axies[2];
+ uint8_t Buttons[3];
+ } mouseinfo;
+
+ if( read(giMouseFD, sizeof(mouseinfo), &mouseinfo) != sizeof(mouseinfo) )
+ {
+ // Not a 3 button mouse, oops
+ return ;
+ }
+ // Handle movement
+// Video_SetCursorPos( mouseinfo.Axies[0], mouseinfo.Axies[1] );
}
}
// === Includes ===
#include <acess/sys.h>
-#include <axwin/axwin.h>
+#include <axwin2/axwin.h>
#include <stdlib.h>
// === Constants ===
// === GLOBALS ===
int giAxWin_Mode = 0;
int giAxWin_PID = 0;
+tAxWin_MessageCallback *gAxWin_DefaultCallback;
// === CODE ===
int SoMain()
return 0;
}
-int AxWin_Register(const char *Name)
+tAxWin_Message *AxWin_int_SendAndWait(int RetID, tAxWin_Message *Message)
{
- tAxWin_Message req;
tAxWin_Message *msg;
- tAxWin_RetMsg *ret;
- int len = strlen(Name);
-
- req.ID = MSG_SREQ_REGISTER;
- req.Size = 1 + (len+1)/4;
- strcpy(req.Data, Name);
-
- AxWin_SendMessage(&req);
+ tAxWin_RetMsg *rmsg;
+
+ AxWin_SendMessage(Message);
for(;;)
{
msg = AxWin_WaitForMessage();
- if(msg->ID == MSG_SREQ_ADDTAB)
- {
- ret = (void*) &msg->Data[0];
- if( ret->ReqID == MSG_SREQ_REGISTER )
- break;
- }
+ rmsg = (void*)msg->Data;
+ if(msg->ID == MSG_SRSP_RETURN && rmsg->ReqID == Message->ID )
+ break;
AxWin_HandleMessage(msg);
free(msg);
}
- return !!ret->Bool;
+ return msg;
+}
+
+int AxWin_Register(const char *Name, tAxWin_MessageCallback *DefaultCallback)
+{
+ tAxWin_Message req;
+ tAxWin_Message *msg;
+ int ret;
+ int len = strlen(Name);
+
+ req.ID = MSG_SREQ_REGISTER;
+ req.Size = 1 + (len+1)/4;
+ strcpy(req.Data, Name);
+
+ msg = AxWin_int_SendAndWait(MSG_SREQ_ADDTAB, &req);
+ ret = ((tAxWin_RetMsg*)msg->Data)->Bool;
+ free(msg);
+
+ gAxWin_DefaultCallback = DefaultCallback;
+
+ return !!ret;
}
-tAxWin_Handle AxWin_AddTab(const char *Title)
+tAxWin_Element *AxWin_CreateTab(const char *Title)
{
tAxWin_Message req;
tAxWin_Message *msg;
- tAxWin_RetMsg *ret;
+ tAxWin_Element *ret;
int len = strlen(Title);
req.ID = MSG_SREQ_ADDTAB;
req.Size = 1 + (len+1)/4;
strcpy(req.Data, Title);
- for(;;)
- {
- msg = AxWin_WaitForMessage();
-
- if(msg->ID == MSG_SRSP_RETURN)
- {
- ret = (void*) &msg->Data[0];
- if( ret->ReqID == MSG_SREQ_ADDTAB )
- break;
- }
-
- AxWin_HandleMessage(msg);
- free(msg);
- }
+ msg = AxWin_int_SendAndWait(MSG_SRSP_RETURN, &req);
+ ret = (tAxWin_Element*) ((tAxWin_RetMsg*)msg->Data)->Handle;
+ free(msg);
- return (tAxWin_Handle) ret->Handle;
+ return ret;
+}
+
+tAxWin_Element *AxWin_AddMenuItem(tAxWin_Element *Parent, const char *Label, int Message)
+{
+ return NULL;
}