2 * Acess Text Editor (ATE)
3 * - By John Hodge (thePowersGang)
8 #include <axwin3/axwin.h>
9 #include <axwin3/widget.h>
10 #include <axwin3/menu.h>
11 #include <axwin3/richtext.h>
13 #include "include/common.h"
17 int main(int argc, char *argv[]);
18 int TextArea_KeyHandler(tHWND Window, int bPress, uint32_t KeySym, uint32_t Translated);
19 int TextArea_MouseHandler(tHWND Window, int bPress, int Button, int Row, int Col);
23 tAxWin3_Widget *gMainWindow_Root;
24 tHWND gMainWindow_MenuBar;
25 tAxWin3_Widget *gMainWindow_Toolbar;
26 tHWND gMainWindow_TextArea;
29 int main(int argc, char *argv[])
33 // --- Build up window
34 gMainWindow = AxWin3_Widget_CreateWindow(NULL, 500, 400, ELEFLAG_VERTICAL);
35 AxWin3_SetWindowTitle(gMainWindow, "Acess Text Editor"); // TODO: Update title with other info
36 gMainWindow_Root = AxWin3_Widget_GetRoot(gMainWindow);
38 //gMainWindow_MenuBar = AxWin3_Menu_Create(gMainWindow);
39 //AxWin3_Widget_AddWidget_SubWindow(gMainWindow_Root, gMainWindow_MenuBar);
40 // TODO: Populate menu
43 gMainWindow_Toolbar = AxWin3_Widget_AddWidget(gMainWindow_Root,
44 ELETYPE_TOOLBAR, ELEFLAG_NOSTRETCH, "Toolbar");
45 Toolbar_Init(gMainWindow_Toolbar);
49 gMainWindow_TextArea = AxWin3_RichText_CreateWindow(gMainWindow, 0);
50 AxWin3_RichText_SetKeyHandler (gMainWindow_TextArea, TextArea_KeyHandler);
51 AxWin3_RichText_SetMouseHandler (gMainWindow_TextArea, TextArea_MouseHandler);
52 AxWin3_RichText_SetBackground (gMainWindow_TextArea, 0xFFFFFF);
53 AxWin3_RichText_SetDefaultColour(gMainWindow_TextArea, 0x000000);
54 AxWin3_RichText_SetFont (gMainWindow_TextArea, "#monospace", 10);
55 AxWin3_RichText_SetCursorPos (gMainWindow_TextArea, 0, 0);
56 AxWin3_RichText_SetCursorType (gMainWindow_TextArea, AXWIN3_RICHTEXT_CURSOR_VLINE);
57 AxWin3_RichText_SetCursorBlink (gMainWindow_TextArea, 1);
60 AxWin3_RichText_SetLineCount(gMainWindow_TextArea, 3);
61 AxWin3_RichText_SendLine(gMainWindow_TextArea, 0, "First line!");
62 AxWin3_RichText_SendLine(gMainWindow_TextArea, 2, "Third line! \001ff0000red\00100ff00green");
65 AxWin3_Widget_AddWidget_SubWindow(gMainWindow_Root, gMainWindow_TextArea, 0, "TextArea");
66 AxWin3_ShowWindow(gMainWindow_TextArea, 1);
69 AxWin3_MoveWindow(gMainWindow, 50, 50);
70 AxWin3_ShowWindow(gMainWindow, 1);
71 AxWin3_FocusWindow(gMainWindow);
72 AxWin3_FocusWindow(gMainWindow_TextArea);
77 AxWin3_DestroyWindow(gMainWindow);
82 int TextArea_KeyHandler(tHWND Window, int bPress, uint32_t KeySym, uint32_t Translated)
87 int TextArea_MouseHandler(tHWND Window, int bPress, int Button, int Row, int Col)