Tools/NetTest - Add TCP retransmit test
[tpg/acess2.git] / Usermode / Applications / gui_ate_src / main.c
1 /*
2  * Acess Text Editor (ATE)
3  * - By John Hodge (thePowersGang)
4  *
5  * main.c
6  * - Core
7  */
8 #include <axwin3/axwin.h>
9 #include <axwin3/widget.h>
10 #include <axwin3/menu.h>
11 #include <axwin3/richtext.h>
12 #include <stdio.h>
13 #include "include/common.h"
14 #include "strings.h"
15
16 // === PROTOTYPES ===
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);
20
21 // === GLOBALS ===
22 tHWND   gMainWindow;
23 tAxWin3_Widget  *gMainWindow_Root;
24 tHWND   gMainWindow_MenuBar;
25 tAxWin3_Widget  *gMainWindow_Toolbar;
26 tHWND   gMainWindow_TextArea;
27
28 // === CODE ===
29 int main(int argc, char *argv[])
30 {
31         AxWin3_Connect(NULL);
32         
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);
37
38         //gMainWindow_MenuBar = AxWin3_Menu_Create(gMainWindow);
39         //AxWin3_Widget_AddWidget_SubWindow(gMainWindow_Root, gMainWindow_MenuBar);
40         // TODO: Populate menu  
41
42         // Create toolbar
43         gMainWindow_Toolbar = AxWin3_Widget_AddWidget(gMainWindow_Root,
44                 ELETYPE_TOOLBAR, ELEFLAG_NOSTRETCH, "Toolbar");
45         Toolbar_Init(gMainWindow_Toolbar);
46
47         // TODO: Tab control?   
48
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);
58
59         // <testing>
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");
63         // </testing>
64
65         AxWin3_Widget_AddWidget_SubWindow(gMainWindow_Root, gMainWindow_TextArea, 0, "TextArea");
66         AxWin3_ShowWindow(gMainWindow_TextArea, 1);
67         // TODO: Status Bar?
68
69         AxWin3_MoveWindow(gMainWindow, 50, 50);
70         AxWin3_ShowWindow(gMainWindow, 1);
71         AxWin3_FocusWindow(gMainWindow);
72         AxWin3_FocusWindow(gMainWindow_TextArea);
73         
74         // Main loop
75         AxWin3_MainLoop();
76
77         AxWin3_DestroyWindow(gMainWindow);
78
79         return 0;
80 }
81
82 int TextArea_KeyHandler(tHWND Window, int bPress, uint32_t KeySym, uint32_t Translated)
83 {
84         return 0;
85 }
86
87 int TextArea_MouseHandler(tHWND Window, int bPress, int Button, int Row, int Col)
88 {
89         return 0;
90 }
91

UCC git Repository :: git.ucc.asn.au