00001 // * This makes emacs happy -*-Mode: C++;-*- 00002 /**************************************************************************** 00003 * Copyright (c) 2002 Fabrica de Software XXI SRL - info@lafabrica.com.ar * 00004 * Copyright (c) 2002 RaqLink SA - info@raqlink.com * 00005 * * 00006 * Permission is hereby granted, free of charge, to any person obtaining a * 00007 * copy of this software and associated documentation files (the * 00008 * "Software"), to deal in the Software without restriction, including * 00009 * without limitation the rights to use, copy, modify, merge, publish, * 00010 * distribute, distribute with modifications, sublicense, and/or sell * 00011 * copies of the Software, and to permit persons to whom the Software is * 00012 * furnished to do so, subject to the following conditions: * 00013 * * 00014 * The above copyright notice and this permission notice shall be included * 00015 * in all copies or substantial portions of the Software. * 00016 * * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 00018 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 00020 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 00021 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 00022 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 00023 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 00024 * * 00025 * Except as contained in this notice, the name(s) of the above copyright * 00026 * holders shall not be used in advertising or otherwise to promote the * 00027 * sale, use or other dealings in this Software without prior written * 00028 * authorization. * 00029 ****************************************************************************/ 00030 00031 /**************************************************************************** 00032 * Author Miguel Pinkas <miguel@lafabrica.com.ar> * 00033 ****************************************************************************/ 00034 00035 #include <ndk++.h> 00036 00037 using namespace NDK_XX; 00038 00039 /************************************************************************ 00040 * \class TestBox * 00041 * Developer's aid... ;-) * 00042 ************************************************************************/ 00043 class TestBox: public DialogBox 00044 { 00045 public: 00046 TestBox(const string &title,int lines, int cols,int y, int x); 00047 protected: 00048 ///we override this to add 00049 ///adornments to the window 00050 void on_dlg_init(); 00051 00052 /// Called when the "Clear" button is pushed 00053 void on_clear_list(); 00054 00055 /** 00056 Called when the "Remove" button is pushed. 00057 we will remove the item pointed out by the 00058 second list box, the one with First, 00059 Last and Middle radio buttons 00060 */ 00061 void on_remove(); 00062 00063 void on_arrow(); 00064 00065 void on_select(); 00066 00067 Edit *pEdit; 00068 EditDate *pEditDate; 00069 EditDouble *pEditNum; 00070 SelectionBox *pSel; 00071 ChoiceBox *pChoice; 00072 CheckListBox *pCheckList; 00073 CheckListBox *pCheckList2; 00074 00075 DECLARE_BINDINGS(); 00076 00077 /** 00078 Called whenever the pChoice listbox 00079 selection changes. 00080 It is binded to the LI_SEL_CHANGE event 00081 via the BINDING... macros 00082 */ 00083 void on_sel_change(int id); 00084 00085 /** 00086 If we remove something we must update 00087 the items pointed to by the pChoice items 00088 */ 00089 void refresh_choices(); 00090 }; 00091 00092 00093 /************************************************************************ 00094 * \class TabbedDlgBox * 00095 * Developer's aid... ;-) * 00096 ************************************************************************/ 00097 class TabbedDlgBox: public PropertyDialog 00098 { 00099 public: 00100 TabbedDlgBox(int id,int lines, int cols,int y, int x); 00101 protected: 00102 ///we override this to add 00103 ///adornments to the window 00104 void on_dlg_init(); 00105 }; 00106 00107 00108 /************************************************************************ 00109 * \class PropertyPage1 * 00110 * Developer's aid... ;-) * 00111 ************************************************************************/ 00112 class TabbedDlgPage1: public PropertyPage 00113 { 00114 public: 00115 TabbedDlgPage1(PropertyDialog *parent,int id, const string &title 00116 ,int lines, int cols,int y=0, int x=0); 00117 protected: 00118 ///we override this to add 00119 ///adornments to the window 00120 void on_dlg_init(); 00121 }; 00122 00123 00124 /************************************************************************ 00125 * \class PropertyPage2 * 00126 * Developer's aid... ;-) * 00127 ************************************************************************/ 00128 class TabbedDlgPage2: public PropertyPage 00129 { 00130 public: 00131 TabbedDlgPage2(PropertyDialog *parent,int id, const string &title 00132 ,int lines, int cols,int y=0, int x=0); 00133 protected: 00134 ///we override this to add 00135 ///adornments to the window 00136 void on_dlg_init(); 00137 00138 /// Called when the "Clear" button is pushed 00139 void on_clear_list(); 00140 00141 /** 00142 Called when the "Remove" button is pushed. 00143 we will remove the item pointed out by the 00144 second list box, the one with First, 00145 Last and Middle radio buttons 00146 */ 00147 void on_remove(); 00148 00149 Edit *pEdit; 00150 SelectionBox *pSel; 00151 ChoiceBox *pChoice; 00152 CheckListBox *pCheckList; 00153 CheckListBox *pCheckList2; 00154 00155 DECLARE_BINDINGS(); 00156 00157 /** 00158 Called whenever the pChoice listbox 00159 selection changes. 00160 It is binded to the LI_SEL_CHANGE event 00161 via the BINDING... macros 00162 */ 00163 void on_sel_change(int id); 00164 00165 /** 00166 If we remove something we must update 00167 the items pointed to by the pChoice items 00168 */ 00169 void refresh_choices(); 00170 }; 00171 00172 00173 /************************************************************************ 00174 * \clase ShowTestDialogCmd * 00175 * When pushed it shows the TestDlg window. * 00176 ************************************************************************/ 00177 class ShowTestDialogCmd : public MenuItemData 00178 { 00179 public: 00180 ShowTestDialogCmd() : MenuItemData("Test Dialog") { } 00181 ~ShowTestDialogCmd(){} 00182 int action() { 00183 TestBox test("Title",18,65,4,5); 00184 test.do_modal(); 00185 return FALSE; 00186 } 00187 }; 00188 00189 00190 /************************************************************************ 00191 * \class ShowTestDialogCmd * 00192 * When pushed it shows the TestDlg window. * 00193 ************************************************************************/ 00194 class ShowTabbedDialogCmd : public MenuItemData 00195 { 00196 public: 00197 ShowTabbedDialogCmd() : MenuItemData("Tabbed Dialog") { } 00198 ~ShowTabbedDialogCmd(){} 00199 int action() { 00200 TabbedDlgBox test(3000,23,55,0,5); 00201 test.do_modal(); 00202 return FALSE; 00203 } 00204 }; 00205 00206 00207 /************************************************************************ 00208 * \class APopUpCmd * 00209 ************************************************************************/ 00210 class APopUpCmd : public PopUpMenu 00211 { 00212 public: 00213 APopUpCmd (); 00214 ~APopUpCmd(){} 00215 }; 00216 00217 00218 /************************************************************************ 00219 * \class AnotherPopUpCmd * 00220 ************************************************************************/ 00221 class AnotherPopUpCmd : public PopUpMenu 00222 { 00223 public: 00224 AnotherPopUpCmd(); 00225 ~AnotherPopUpCmd(){} 00226 }; 00227 00228 00229 /************************************************************************ 00230 * \class TestApplication * 00231 ************************************************************************/ 00232 class TestApplication : public Application { 00233 protected: 00234 int titlesize() const { return 1; } 00235 void title(); 00236 void activateMenuBar(); 00237 public: 00238 TestApplication() : Application(TRUE) {app_title = "NDK++ Demo Application";}; 00239 int run(); 00240 }; 00241