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 30, 2001");
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);
116 main_frame->Background(color(config.find_parameter("colors", "background")));
118 fr = new button(*main_frame, 20, 30, "Up");
120 fr = new toggle_button(*main_frame, 20, 100, "Down");
122 fr = new frame(*main_frame, 180, 30, "Left");
123 fr->TextAlign(Left, Middle);
125 fr = new frame(*main_frame, 180, 70, "Center");
126 fr->TextAlign(Center, Middle);
129 fr = new frame(*main_frame, 180, 110, "Right");
130 fr->TextAlign(Right, Middle);
132 fr = new frame(*main_frame, 180, 150, "Top");
133 fr->TextAlign(Center, Top);
135 fr = new frame(*main_frame, 180, 190, "Middle");
136 fr->TextAlign(Center, Middle);
139 fr = new frame(*main_frame, 180, 230, "Bottom");
140 fr->TextAlign(Center, Bottom);
141 fr->WindowGravity(SouthEastGravity);
143 scr = new scrollbar(*main_frame, 200, 130, 30);
144 scr->SetSizes(1000, 200);
147 edt = new edit(*main_frame, 20, 140, "This is editable text");
148 edt = new edit(*main_frame, 20, 170, "And another text field");
150 menu = new menu_bar(*main_frame);
152 item = new menu_label(*menu, "Help");
153 popup = new popup_menu;
155 item = new menu_label(*popup, "About...", CMD_ABOUT);
158 item = new menu_label(*menu, "View");
160 popup = new popup_menu;
163 item = new menu_label(*popup, "Status");
166 item = new menu_label(*popup, "Tools");
169 item = new menu_label(*menu, "Edit");
171 popup = new popup_menu;
175 item = new menu_label(*popup, "Paste");
178 item = new menu_label(*popup, "Copy");
181 item = new menu_label(*popup, "Cut");
184 item = new menu_label(*menu, "File");
186 popup = new popup_menu;
189 item = new menu_label(*popup, "Quit", CMD_QUIT);
192 item = new menu_separator(*popup);
195 save_item = new menu_label(*popup, "Save", CMD_SAVE);
197 save_item->Enable(0);
199 item = new menu_label(*popup, "Open...", CMD_OPEN);
202 item = new menu_label(*popup, "New ->");
205 popup = new popup_menu;
208 item = new menu_label(*popup, "Type B");
211 item = new menu_label(*popup, "Type A");
215 logo = new icon(*main_frame, 10, 200, pinguin_xpm);
216 main_frame->Realize();
219 pixmap pinguin(pinguin_xpm);
221 main_frame->DrawPixmap(text_normal_gc, 270, 100, pinguin);
224 int xapp::DoCommand(int code)
226 printf("Command : %d\n", code);
238 cout << "Opening " << FileDialog->PathName() << "\n";
239 save_item->Enable(1);
244 save_item->Enable(0);