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 NDKDialogBox 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 NDKDlgEdit *pEdit; 00064 NDKDlgSelectionBox *pSel; 00065 NDKDlgChoiceBox *pChoice; 00066 NDKDlgCheckListBox *pCheckList; 00067 NDKDlgCheckListBox *pCheckList2; 00068 00069 DECLARE_BINDINGS(); 00070 00071 /** 00072 Called whenever the pChoice listbox 00073 selection changes. 00074 It is binded to the LI_SEL_CHANGE event 00075 via the BINDING... macros 00076 */ 00077 void on_sel_change(int id); 00078 00079 /** 00080 If we remove something we must update 00081 the items pointed to by the pChoice items 00082 */ 00083 void refresh_choices(); 00084 }; 00085 00086 00087 /************************************************************************ 00088 * clase ShowTestDialogCmd * 00089 * When pushed it shows the TestDlg window. * 00090 ************************************************************************/ 00091 class ShowTestDialogCmd : public NDKMenuItem 00092 { 00093 public: 00094 ShowTestDialogCmd() : NDKMenuItem("Test Dialog") { } 00095 ~ShowTestDialogCmd(){} 00096 bool action() { 00097 TestBox test("Title",18,55,4,5); 00098 test.do_modal(); 00099 return FALSE; 00100 } 00101 }; 00102 00103 00104 /************************************************************************ 00105 * clase APopUpCmd * 00106 ************************************************************************/ 00107 class APopUpCmd : public NDKPopUpMenu 00108 { 00109 public: 00110 APopUpCmd (); 00111 ~APopUpCmd(){} 00112 }; 00113 00114 00115 /************************************************************************ 00116 * clase AnotherPopUpCmd * 00117 ************************************************************************/ 00118 class AnotherPopUpCmd : public NDKPopUpMenu 00119 { 00120 public: 00121 AnotherPopUpCmd(); 00122 ~AnotherPopUpCmd(){} 00123 }; 00124 00125 00126 /************************************************************************ 00127 * class TestApplication * 00128 ************************************************************************/ 00129 class TestApplication : public NDKApplication { 00130 protected: 00131 int titlesize() const { return 1; } 00132 void title(); 00133 void activateMenuBar(ListOfItems &items); 00134 public: 00135 TestApplication() : NDKApplication(TRUE) { } 00136 int run(); 00137 }; 00138