G:/ScriptBasic/source/variations/wx/wxmain.cpp

Go to the documentation of this file.
00001 
00002 // Name:        minimal.cpp
00003 // Purpose:     Minimal wxWindows sample
00004 // Author:      Julian Smart
00005 // Modified by:
00006 // Created:     04/01/98
00007 // RCS-ID:      $Id: wxmain.cpp,v 1.2 2002/04/21 18:19:45 verhas Exp $
00008 // Copyright:   (c) Julian Smart
00009 // Licence:     wxWindows licence
00011 
00012 // ============================================================================
00013 // declarations
00014 // ============================================================================
00015 
00016 // ----------------------------------------------------------------------------
00017 // headers
00018 // ----------------------------------------------------------------------------
00019 
00020 // For compilers that support precompilation, includes "wx/wx.h".
00021 #include "wx/wxprec.h"
00022 
00023 #ifdef __BORLANDC__
00024     #pragma hdrstop
00025 #endif
00026 
00027 // for all others, include the necessary headers (this file is usually all you
00028 // need because it includes almost all "standard" wxWindows headers)
00029 #ifndef WX_PRECOMP
00030     #include "wx/wx.h"
00031 #endif
00032 
00033 // ----------------------------------------------------------------------------
00034 // resources
00035 // ----------------------------------------------------------------------------
00036 
00037 // the application icon (under Windows and OS/2 it is in resources)
00038 #if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__)
00039     #include "mondrian.xpm"
00040 #endif
00041 
00042 // ----------------------------------------------------------------------------
00043 // private classes
00044 // ----------------------------------------------------------------------------
00045 
00046 // Define a new application type, each program should derive a class from wxApp
00047 class SBApp : public wxApp
00048 {
00049 public:
00050     // override base class virtuals
00051     // ----------------------------
00052 
00053     // this one is called on application startup and is a good place for the app
00054     // initialization (doing it here and not in the ctor allows to have an error
00055     // return: if OnInit() returns false, the application terminates)
00056     virtual bool OnInit();
00057 };
00058 
00059 // Create a new application object: this macro will allow wxWindows to create
00060 // the application object during program execution (it's better than using a
00061 // static object for many reasons) and also declares the accessor function
00062 // wxGetApp() which will return the reference of the right type (i.e. SBApp and
00063 // not wxApp)
00064 IMPLEMENT_APP(SBApp)
00065 
00066 // ============================================================================
00067 // implementation
00068 // ============================================================================
00069 
00070 // ----------------------------------------------------------------------------
00071 // the application class
00072 // ----------------------------------------------------------------------------
00073 #if 0 && _WIN32
00074 char *_pgmptr;
00075 #include <ctype.h>
00076 
00077 unsigned short *_pctype = _ctype+1;     /* pointer to table for char's      */
00078 unsigned short *_pwctype = _ctype+1;    /* pointer to table for wchar_t's   */
00079 
00080 unsigned short _ctype[257] = {
00081         0,                      /* -1 EOF   */
00082         _CONTROL,               /* 00 (NUL) */
00083         _CONTROL,               /* 01 (SOH) */
00084         _CONTROL,               /* 02 (STX) */
00085         _CONTROL,               /* 03 (ETX) */
00086         _CONTROL,               /* 04 (EOT) */
00087         _CONTROL,               /* 05 (ENQ) */
00088         _CONTROL,               /* 06 (ACK) */
00089         _CONTROL,               /* 07 (BEL) */
00090         _CONTROL,               /* 08 (BS)  */
00091         _SPACE+_CONTROL,        /* 09 (HT)  */
00092         _SPACE+_CONTROL,        /* 0A (LF)  */
00093         _SPACE+_CONTROL,        /* 0B (VT)  */
00094         _SPACE+_CONTROL,        /* 0C (FF)  */
00095         _SPACE+_CONTROL,        /* 0D (CR)  */
00096         _CONTROL,               /* 0E (SI)  */
00097         _CONTROL,               /* 0F (SO)  */
00098         _CONTROL,               /* 10 (DLE) */
00099         _CONTROL,               /* 11 (DC1) */
00100         _CONTROL,               /* 12 (DC2) */
00101         _CONTROL,               /* 13 (DC3) */
00102         _CONTROL,               /* 14 (DC4) */
00103         _CONTROL,               /* 15 (NAK) */
00104         _CONTROL,               /* 16 (SYN) */
00105         _CONTROL,               /* 17 (ETB) */
00106         _CONTROL,               /* 18 (CAN) */
00107         _CONTROL,               /* 19 (EM)  */
00108         _CONTROL,               /* 1A (SUB) */
00109         _CONTROL,               /* 1B (ESC) */
00110         _CONTROL,               /* 1C (FS)  */
00111         _CONTROL,               /* 1D (GS)  */
00112         _CONTROL,               /* 1E (RS)  */
00113         _CONTROL,               /* 1F (US)  */
00114         _SPACE+_BLANK,          /* 20 SPACE */
00115         _PUNCT,                 /* 21 !     */
00116         _PUNCT,                 /* 22 "     */
00117         _PUNCT,                 /* 23 #     */
00118         _PUNCT,                 /* 24 $     */
00119         _PUNCT,                 /* 25 %     */
00120         _PUNCT,                 /* 26 &     */
00121         _PUNCT,                 /* 27 '     */
00122         _PUNCT,                 /* 28 (     */
00123         _PUNCT,                 /* 29 )     */
00124         _PUNCT,                 /* 2A *     */
00125         _PUNCT,                 /* 2B +     */
00126         _PUNCT,                 /* 2C ,     */
00127         _PUNCT,                 /* 2D -     */
00128         _PUNCT,                 /* 2E .     */
00129         _PUNCT,                 /* 2F /     */
00130         _DIGIT+_HEX,            /* 30 0     */
00131         _DIGIT+_HEX,            /* 31 1     */
00132         _DIGIT+_HEX,            /* 32 2     */
00133         _DIGIT+_HEX,            /* 33 3     */
00134         _DIGIT+_HEX,            /* 34 4     */
00135         _DIGIT+_HEX,            /* 35 5     */
00136         _DIGIT+_HEX,            /* 36 6     */
00137         _DIGIT+_HEX,            /* 37 7     */
00138         _DIGIT+_HEX,            /* 38 8     */
00139         _DIGIT+_HEX,            /* 39 9     */
00140         _PUNCT,                 /* 3A :     */
00141         _PUNCT,                 /* 3B ;     */
00142         _PUNCT,                 /* 3C <     */
00143         _PUNCT,                 /* 3D =     */
00144         _PUNCT,                 /* 3E >     */
00145         _PUNCT,                 /* 3F ?     */
00146         _PUNCT,                 /* 40 @     */
00147         _UPPER+_HEX,            /* 41 A     */
00148         _UPPER+_HEX,            /* 42 B     */
00149         _UPPER+_HEX,            /* 43 C     */
00150         _UPPER+_HEX,            /* 44 D     */
00151         _UPPER+_HEX,            /* 45 E     */
00152         _UPPER+_HEX,            /* 46 F     */
00153         _UPPER,                 /* 47 G     */
00154         _UPPER,                 /* 48 H     */
00155         _UPPER,                 /* 49 I     */
00156         _UPPER,                 /* 4A J     */
00157         _UPPER,                 /* 4B K     */
00158         _UPPER,                 /* 4C L     */
00159         _UPPER,                 /* 4D M     */
00160         _UPPER,                 /* 4E N     */
00161         _UPPER,                 /* 4F O     */
00162         _UPPER,                 /* 50 P     */
00163         _UPPER,                 /* 51 Q     */
00164         _UPPER,                 /* 52 R     */
00165         _UPPER,                 /* 53 S     */
00166         _UPPER,                 /* 54 T     */
00167         _UPPER,                 /* 55 U     */
00168         _UPPER,                 /* 56 V     */
00169         _UPPER,                 /* 57 W     */
00170         _UPPER,                 /* 58 X     */
00171         _UPPER,                 /* 59 Y     */
00172         _UPPER,                 /* 5A Z     */
00173         _PUNCT,                 /* 5B [     */
00174         _PUNCT,                 /* 5C \     */
00175         _PUNCT,                 /* 5D ]     */
00176         _PUNCT,                 /* 5E ^     */
00177         _PUNCT,                 /* 5F _     */
00178         _PUNCT,                 /* 60 `     */
00179         _LOWER+_HEX,            /* 61 a     */
00180         _LOWER+_HEX,            /* 62 b     */
00181         _LOWER+_HEX,            /* 63 c     */
00182         _LOWER+_HEX,            /* 64 d     */
00183         _LOWER+_HEX,            /* 65 e     */
00184         _LOWER+_HEX,            /* 66 f     */
00185         _LOWER,                 /* 67 g     */
00186         _LOWER,                 /* 68 h     */
00187         _LOWER,                 /* 69 i     */
00188         _LOWER,                 /* 6A j     */
00189         _LOWER,                 /* 6B k     */
00190         _LOWER,                 /* 6C l     */
00191         _LOWER,                 /* 6D m     */
00192         _LOWER,                 /* 6E n     */
00193         _LOWER,                 /* 6F o     */
00194         _LOWER,                 /* 70 p     */
00195         _LOWER,                 /* 71 q     */
00196         _LOWER,                 /* 72 r     */
00197         _LOWER,                 /* 73 s     */
00198         _LOWER,                 /* 74 t     */
00199         _LOWER,                 /* 75 u     */
00200         _LOWER,                 /* 76 v     */
00201         _LOWER,                 /* 77 w     */
00202         _LOWER,                 /* 78 x     */
00203         _LOWER,                 /* 79 y     */
00204         _LOWER,                 /* 7A z     */
00205         _PUNCT,                 /* 7B {     */
00206         _PUNCT,                 /* 7C |     */
00207         _PUNCT,                 /* 7D }     */
00208         _PUNCT,                 /* 7E ~     */
00209         _CONTROL,               /* 7F (DEL) */
00210         /* and the rest are 0... */
00211 };
00212 int __mb_cur_max=MB_CUR_MAX;
00213 char **_environ;
00214 #endif
00215 
00216 extern "C" void * C_wxWindow(void *pParent, int id, int posx, int posy, int sizex, int sizey, long style, char *pszName){
00217   return new wxWindow((wxWindow *)pParent, id, wxPoint(posx,posy),wxSize(sizex,sizey),style,_T(pszName));
00218   }
00219 
00220 extern "C" void * C_wxFrame(void *pParent, int id, char *pszTitle, int posx, int posy, int sizex, int sizey, long style, char *pszName){
00221   wxButton      *button     = (wxButton*) NULL;
00222   wxFrame *main_frame = new wxFrame((wxWindow *)pParent, id, _T(pszTitle),wxPoint(posx,posy),wxSize(sizex,sizey),style,_T(pszName));
00223 
00224   main_frame->CreateToolBar(wxNO_BORDER|wxTB_VERTICAL, 500);
00225   button = new wxButton( main_frame, -1, "Press to reparent!" );
00226 
00227   wxTheApp->SetTopWindow(main_frame);
00228   main_frame->Show(1);
00229   main_frame->Raise();
00230   return main_frame;
00231   }
00232 
00233 
00234 extern "C" void mainwx(int,char **);
00235 // 'Main program' equivalent: the program execution "starts" here
00236 bool SBApp::OnInit()
00237 {
00238 #ifdef _WIN32
00239   _pgmptr = this->argv[0];
00240   _environ = NULL;
00241 #endif
00242   mainwx(this->argc,this->argv);
00243   return 1;
00244 }

Generated on Sun Mar 12 23:56:32 2006 for ScriptBasic by  doxygen 1.4.6-NO