3 #include "filedialog.h"
5 #include "configuration.h"
16 class testaxeconf: public configuration
20 popup_menu *edit_menu;
28 class aboutbox : public managed_window
35 aboutbox() : managed_window("About AXE")
38 logo = new icon(*this, 10, 40, "andromeda.xpm");
39 ok = new command_button(*this, 300, 50, "OK", 0);
41 SelectInput(ExposureMask, 1);
44 virtual int EV_Expose(XExposeEvent ev)
46 DrawString(white_gc, 100, 30, "Andromeda X Windows Encapsulation");
47 DrawString(white_gc, 120, 90, "Version 0.2 - July 25, 2002");
51 int DoCommand(int code)
58 class xapp: public xapplication
60 managed_window *main_frame;
62 file_dialog *FileDialog;
67 virtual void SetupResources(void);
69 virtual int DoCommand(int code);
77 int OnQuit(void) { printf("OnQuit\n"); return 0; }
84 int xapp::OnOpen(void)
86 FileDialog->Realize();
90 int xapp::OnSave(void)
92 FileDialog->Realize();
96 /* The pinguin icon as a static array */
98 #include "pinguin.xpm"
100 void xapp::SetupResources(void)
109 config.read("testaxe");
111 About = new aboutbox;
112 FileDialog = new file_dialog(FILE_OPEN);
114 main_frame = new managed_window;
115 main_frame->Command_WhenClosed(CMD_QUIT);
117 String bgcolor = config.find_parameter("colors", "background");
120 main_frame->Background(color(bgcolor));
123 fr = new button(*main_frame, 20, 30, "Up");
125 fr = new toggle_button(*main_frame, 20, 100, "Down");
127 fr = new frame(*main_frame, 180, 30, "Left");
128 fr->TextAlign(Left, Middle);
130 fr = new frame(*main_frame, 180, 70, "Center");
131 fr->TextAlign(Center, Middle);
134 fr = new frame(*main_frame, 180, 110, "Right");
135 fr->TextAlign(Right, Middle);
137 fr = new frame(*main_frame, 180, 150, "Top");
138 fr->TextAlign(Center, Top);
140 fr = new frame(*main_frame, 180, 190, "Middle");
141 fr->TextAlign(Center, Middle);
144 fr = new frame(*main_frame, 180, 230, "Bottom");
145 fr->TextAlign(Center, Bottom);
146 fr->WindowGravity(SouthEastGravity);
148 scr = new scrollbar(*main_frame, 200, 130, 30);
149 scr->SetSizes(1000, 200);
152 edt = new edit(*main_frame, 20, 140, "This is editable text");
153 edt = new edit(*main_frame, 20, 170, "And another text field");
155 menu = new menu_bar(*main_frame);
157 item = new menu_label(*menu, "Help");
158 popup = new popup_menu;
160 item = new menu_label(*popup, "About...", CMD_ABOUT);
163 item = new menu_label(*menu, "View");
165 popup = new popup_menu;
168 item = new menu_label(*popup, "Status");
171 item = new menu_label(*popup, "Tools");
174 item = new menu_label(*menu, "Edit");
176 popup = new popup_menu;
180 item = new menu_label(*popup, "Paste");
183 item = new menu_label(*popup, "Copy");
186 item = new menu_label(*popup, "Cut");
189 item = new menu_label(*menu, "File");
191 popup = new popup_menu;
194 item = new menu_label(*popup, "Quit", CMD_QUIT);
197 item = new menu_separator(*popup);
200 save_item = new menu_label(*popup, "Save", CMD_SAVE);
202 save_item->Enable(0);
204 item = new menu_label(*popup, "Open...", CMD_OPEN);
207 item = new menu_label(*popup, "New ->");
210 popup = new popup_menu;
213 item = new menu_label(*popup, "Type B");
216 item = new menu_label(*popup, "Type A");
220 logo = new icon(*main_frame, 10, 200, pinguin_xpm);
221 main_frame->Realize();
224 pixmap pinguin(pinguin_xpm);
226 main_frame->DrawPixmap(text_normal_gc, 270, 100, pinguin);
229 int xapp::DoCommand(int code)
231 printf("Command : %d\n", code);
243 cout << "Opening " << FileDialog->PathName() << "\n";
244 save_item->Enable(1);
249 save_item->Enable(0);