Пример #1
0
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit(void)
{
    // Create the main frame window
    MyFrame *frame = new MyFrame(NULL, _("wxWidgets 2.0 wxFrameLayout demo"), 50, 50, 650, 540);

    // Give it an icon
#ifdef __WINDOWS__
    frame->SetIcon(wxIcon(wxT("mondrian")));
#endif
#ifdef __X__
    frame->SetIcon(wxIcon(wxT("aiai.xbm")));
#endif

    // Make a menubar
    wxMenu *file_menu = new wxMenu;
    wxMenu *active_menu = new wxMenu;

    file_menu->Append( ID_LOAD,  _("&Load layouts")  );
    file_menu->Append( ID_STORE, _("&Store layouts") );
    file_menu->AppendSeparator();

    file_menu->Append( ID_AUTOSAVE, _("&Auto Save Layouts"), _("save layouts on exit"), wxITEM_CHECK );
    file_menu->AppendSeparator();

    file_menu->Append(MINIMAL_ABOUT, _("A&bout !"));
    file_menu->Append(MINIMAL_QUIT, _("E&xit\tTab"));

    //active_menu->Append( ID_SETTINGS, _("&Settings...\tCtrl") );
    //active_menu->AppendSeparator();

    active_menu->Append( ID_REMOVE,    _("&Remove Active") );
    active_menu->Append( ID_REMOVEALL, _("Remove &All") );
    active_menu->Append( ID_RECREATE,  _("Re&create") );
    active_menu->AppendSeparator();

    active_menu->Append( ID_FIRST,  _("Activate f&irst layout \tF1"), _("activate it"), wxITEM_CHECK );
    active_menu->Append( ID_SECOND, _("Activate &second layout\tF2"), _("activate it"),  wxITEM_CHECK );
    active_menu->Append( ID_THIRD,  _("Activate &third layout\tF3"), _("activate it"),   wxITEM_CHECK );

    wxMenuBar *menu_bar = new wxMenuBar;

    menu_bar->Append(file_menu,   _("&File"));
    menu_bar->Append(active_menu, _("Active &Layout"));

#if wxUSE_STATUSBAR
    frame->CreateStatusBar(3);
#endif // wxUSE_STATUSBAR

    frame->SetMenuBar(menu_bar);

    frame->SyncMenuBarItems();

    // Show the frame
    frame->Show(true);

    SetTopWindow(frame);

    return true;
}
Пример #2
0
// The `main program' equivalent, creating the windows and returning the
// main frame
bool MyApp::OnInit()
{
  // Create the main frame window
  MyFrame* frame = new MyFrame(NULL, _T("Tree Test"), wxDefaultPosition, wxSize(400, 550));

#if wxUSE_STATUSBAR
  // Give it a status line
  frame->CreateStatusBar(2);
#endif // wxUSE_STATUSBAR

  // Give it an icon
#ifdef __WINDOWS__
  wxIcon icon(_T("tree_icn"));
  frame->SetIcon(icon);
#endif

  // Make a menubar
  wxMenu *file_menu = new wxMenu;
  file_menu->Append(TEST_LEFT_RIGHT, _T("&Left to right"),                _T("Redraw left to right"));
  file_menu->Append(TEST_TOP_BOTTOM, _T("&Top to bottom"),                _T("Redraw top to bottom"));
  file_menu->AppendSeparator();
  file_menu->Append(TEST_QUIT, _T("E&xit"),                _T("Quit program"));

  wxMenu *help_menu = new wxMenu;
  help_menu->Append(TEST_ABOUT, _T("&About"),              _T("About Tree Test"));

  wxMenuBar* menu_bar = new wxMenuBar;

  menu_bar->Append(file_menu, _T("&File"));
  menu_bar->Append(help_menu, _T("&Help"));

  // Associate the menu bar with the frame
  frame->SetMenuBar(menu_bar);

  MyCanvas *canvas = new MyCanvas(frame);

  // Give it scrollbars: the virtual canvas is 20 * 50 = 1000 pixels in each direction
  canvas->SetScrollbars(20, 20, 50, 50);
  frame->canvas = canvas;

  myTree = new wxTreeLayoutStored();

  wxClientDC dc(canvas);
  wxFont font(10, wxROMAN, wxNORMAL, wxBOLD);
  dc.SetFont(font);
  TreeTest(*myTree, dc);

  frame->Show(true);

#if wxUSE_STATUSBAR
  frame->SetStatusText(_T("Hello, tree!"));
#endif // wxUSE_STATUSBAR

  // Return the main frame window
  return true;
}
Пример #3
0
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

    // Create the main frame window
    MyFrame *frame = new MyFrame((wxFrame *) NULL, _T("wxWidgets Types Demo"),
                                 wxPoint(50, 50), wxSize(450, 340));

    // Give it an icon
    frame->SetIcon(wxICON(mondrian));

    // Make a menubar
    wxMenu *file_menu = new wxMenu;

    file_menu->Append(TYPES_ABOUT, _T("&About"));
    file_menu->AppendSeparator();
    file_menu->Append(TYPES_QUIT, _T("E&xit\tAlt-X"));

    wxMenu *test_menu = new wxMenu;
    test_menu->Append(TYPES_VARIANT, _T("&Variant test"));
    test_menu->Append(TYPES_BYTEORDER, _T("&Byteorder test"));
#if wxUSE_UNICODE
    test_menu->Append(TYPES_UNICODE, _T("&Unicode test"));
#endif // wxUSE_UNICODE
    test_menu->Append(TYPES_STREAM, _T("&Stream test"));
    test_menu->Append(TYPES_STREAM2, _T("&Stream seek test"));
    test_menu->Append(TYPES_STREAM3, _T("&Stream error test"));
    test_menu->Append(TYPES_STREAM4, _T("&Stream buffer test"));
    test_menu->Append(TYPES_STREAM5, _T("&Stream peek test"));
    test_menu->Append(TYPES_STREAM6, _T("&Stream ungetch test"));
    test_menu->Append(TYPES_STREAM7, _T("&Stream ungetch test for a buffered stream"));
    test_menu->AppendSeparator();
    test_menu->Append(TYPES_MIME, _T("&MIME database test"));

    wxMenuBar *menu_bar = new wxMenuBar;
    menu_bar->Append(file_menu, _T("&File"));
    menu_bar->Append(test_menu, _T("&Tests"));
    frame->SetMenuBar(menu_bar);

    m_textCtrl = new wxTextCtrl(frame, wxID_ANY, wxEmptyString,
        wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);

    // Show the frame
    frame->Show(true);

    SetTopWindow(frame);

    return true;
}
Пример #4
0
// `Main program' equivalent, creating windows and returning main app frame
wxFrame *MyApp::OnInit(void)
{
  // Create the main frame window
  MyFrame *frame = new MyFrame(NULL, "Minimal wxWindows App", 50, 50, 400, 300);

  // Give it an icon
#ifdef wx_msw
  frame->SetIcon(new wxIcon("mondrian"));
#endif
#ifdef wx_x
  frame->SetIcon(new wxIcon("aiai.xbm"));
#endif

  // Make a menubar
  wxMenu *file_menu = new wxMenu;

  file_menu->Append(MINIMAL_QUIT, "E&xit");
  wxMenuBar *menu_bar = new wxMenuBar;
  menu_bar->Append(file_menu, "File");
  frame->SetMenuBar(menu_bar);

  // Make a panel with a message
  wxCanvas *pcanvas = new MyCanvas(frame);

  // Show the frame
  frame->Show(TRUE);

  xEnd.SetValue(100.0);
  yEnd.SetValue(100.0);

  solver
    .AddStay(xStart)
    .AddStay(yStart)
    .AddStay(xEnd)
    .AddStay(yEnd);

  solver
    .AddConstraint(ClLinearEquation(xEnd,xStart+200.0))
    .AddConstraint(ClLinearEquation(yEnd,xStart*2.0))
    .AddConstraint(ClEditConstraint(xStart))
    .AddConstraint(ClEditConstraint(yStart));

  // Return the main frame window
  return frame;
}
Пример #5
0
bool MyApp::OnInit(void)
{
    MyFrame *frame = new MyFrame(NULL);
    
    frame->SetBackgroundColour( wxColour(192,192,192) );
    
    wxMenu *file_menu = new wxMenu;
    
    file_menu->Append( NEW_TEST_LOAD, _("&Load layouts")  );
    file_menu->Append( NEW_TEST_SAVE, _("&Store layouts") );
    file_menu->Append( NEW_TEST_EXIT, _("E&xit") );
    
    wxMenuBar *menu_bar = new wxMenuBar;
    
    menu_bar->Append(file_menu,   _("&File"));
    
    frame->SetMenuBar(menu_bar);
    
#if wxUSE_STATUSBAR
    frame->CreateStatusBar(3);
#endif // wxUSE_STATUSBAR
    
    frame->Show(true);
    
    frame->mpClientWnd->Refresh();
    
    SetTopWindow(frame);
    
    
    wxMessageBox(_("Hello, this demo has a bunch of yet-not-fixed-bugs and missing functionality\n\
The ONLY purpose is to demonstrate self-layouting toolbars,\nflat-bitmapped-buttons and 2-new FL-plugins \
(cbRowDragPlugin & cbBarHintsPlugin)\n\n\
BTW, disabled images and label-text are rendered at run-time") );
    
    return true;
}
Пример #6
0
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit(void)
{
  if ( !wxApp::OnInit() )
      return false;

  // Create the main frame window
  MyFrame *frame = new MyFrame((wxFrame *) NULL);

  // Give it an icon
  frame->SetIcon(wxICON(sample));

  // Make a menubar
  wxMenu *file_menu = new wxMenu;

  file_menu->Append(wxID_EXIT, wxT("E&xit"));
  wxMenuBar *menu_bar = new wxMenuBar;
  menu_bar->Append(file_menu, wxT("File"));
  frame->SetMenuBar(menu_bar);

  // Make a panel with a message
  wxPanel *panel = new wxPanel(frame);

  (void)new wxStaticText(panel, wxID_ANY, wxT("Hello, this is a minimal debugging wxWidgets program!"), wxPoint(10, 10));

  // Show the frame
  frame->Show(true);

#if wxUSE_MEMORY_TRACING
  wxDebugContext::SetCheckpoint();
#endif

  // object allocation
  wxBrush* brush = new wxBrush(*wxRED_BRUSH);
  wxBitmap* bitmap = new wxBitmap(100, 100);

  // non-object allocation
  char *ordinaryNonObject = new char[1000];

  wxString *thing = new wxString;

#if wxUSE_DATETIME
  wxDateTime* date = new wxDateTime;
#endif // wxUSE_DATETIME

  const char *data = (const char*) thing ;

#if wxUSE_MEMORY_TRACING
  // On MSW, Dump() crashes if using wxLogGui,
  // so use wxLogStderr instead.
  wxLog* oldLog = wxLog::SetActiveTarget(new wxLogStderr);

  wxDebugContext::PrintClasses();
  wxDebugContext::Dump();
  wxDebugContext::PrintStatistics();

  // Set back to wxLogGui
  delete wxLog::SetActiveTarget(oldLog);
#endif

  // Don't delete these objects, to force wxApp to flag a memory leak.
//  delete thing;
//  delete date;
//  delete[] ordinaryNonObject;

  return true;
}
Пример #7
0
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit()
{
#if wxUSE_IMAGE
    wxInitAllImageHandlers();
#endif

    m_canvasTextColour = wxColour(_T("BLACK"));
    m_canvasFont = *wxNORMAL_FONT;

    // Create the main frame window
    MyFrame *frame = new MyFrame((wxFrame *) NULL, _T("wxWidgets dialogs example"));

    // Make a menubar
    wxMenu *file_menu = new wxMenu;

    file_menu->Append(DIALOGS_MESSAGE_BOX, _T("&Message box\tCtrl-M"));


#if wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG

    wxMenu *choices_menu = new wxMenu;

#if wxUSE_COLOURDLG
    choices_menu->Append(DIALOGS_CHOOSE_COLOUR, _T("&Choose colour"));
#endif // wxUSE_COLOURDLG

#if wxUSE_FONTDLG
    choices_menu->Append(DIALOGS_CHOOSE_FONT, _T("Choose &font"));
#endif // wxUSE_FONTDLG

#if wxUSE_CHOICEDLG
    choices_menu->Append(DIALOGS_SINGLE_CHOICE,  _T("&Single choice\tCtrl-C"));
    choices_menu->Append(DIALOGS_MULTI_CHOICE,  _T("M&ultiple choice\tCtrl-U"));
#endif // wxUSE_CHOICEDLG

#if USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
    choices_menu->AppendSeparator();
#endif // USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC

#if USE_COLOURDLG_GENERIC
    choices_menu->Append(DIALOGS_CHOOSE_COLOUR_GENERIC, _T("&Choose colour (generic)"));
#endif // USE_COLOURDLG_GENERIC

#if USE_FONTDLG_GENERIC
    choices_menu->Append(DIALOGS_CHOOSE_FONT_GENERIC, _T("Choose &font (generic)"));
#endif // USE_FONTDLG_GENERIC

    file_menu->Append(wxID_ANY,_T("&Choices and selectors"),choices_menu);
#endif // wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG


#if wxUSE_TEXTDLG || wxUSE_NUMBERDLG

    wxMenu *entry_menu = new wxMenu;

#if wxUSE_TEXTDLG
    entry_menu->Append(DIALOGS_TEXT_ENTRY,  _T("Text &entry\tCtrl-E"));
    entry_menu->Append(DIALOGS_PASSWORD_ENTRY,  _T("&Password entry\tCtrl-P"));
#endif // wxUSE_TEXTDLG

#if wxUSE_NUMBERDLG
    entry_menu->Append(DIALOGS_NUM_ENTRY, _T("&Numeric entry\tCtrl-N"));
#endif // wxUSE_NUMBERDLG

    file_menu->Append(wxID_ANY,_T("&Entry dialogs"),entry_menu);

#endif // wxUSE_TEXTDLG || wxUSE_NUMBERDLG


#if wxUSE_FILEDLG

    wxMenu *filedlg_menu = new wxMenu;
    filedlg_menu->Append(DIALOGS_FILE_OPEN,  _T("&Open file\tCtrl-O"));
    filedlg_menu->Append(DIALOGS_FILE_OPEN2,  _T("&Second open file\tCtrl-2"));
    filedlg_menu->Append(DIALOGS_FILES_OPEN,  _T("Open &files\tCtrl-Q"));
    filedlg_menu->Append(DIALOGS_FILE_SAVE,  _T("Sa&ve file\tCtrl-S"));

#if USE_FILEDLG_GENERIC
    filedlg_menu->AppendSeparator();
    filedlg_menu->Append(DIALOGS_FILE_OPEN_GENERIC,  _T("&Open file (generic)"));
    filedlg_menu->Append(DIALOGS_FILES_OPEN_GENERIC,  _T("Open &files (generic)"));
    filedlg_menu->Append(DIALOGS_FILE_SAVE_GENERIC,  _T("Sa&ve file (generic)"));
#endif // USE_FILEDLG_GENERIC

    file_menu->Append(wxID_ANY,_T("&File operations"),filedlg_menu);

#endif // wxUSE_FILEDLG

#if wxUSE_DIRDLG
    wxMenu *dir_menu = new wxMenu;

    dir_menu->Append(DIALOGS_DIR_CHOOSE,  _T("&Choose a directory\tCtrl-D"));
    dir_menu->Append(DIALOGS_DIRNEW_CHOOSE,  _T("Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D"));
    file_menu->Append(wxID_ANY,_T("&Directory operations"),dir_menu);

#if USE_DIRDLG_GENERIC
    dir_menu->AppendSeparator();
    dir_menu->Append(DIALOGS_GENERIC_DIR_CHOOSE,  _T("&Choose a directory (generic)"));
#endif // USE_DIRDLG_GENERIC

#endif // wxUSE_DIRDLG


#if wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG

    wxMenu *info_menu = new wxMenu;

#if wxUSE_STARTUP_TIPS
    info_menu->Append(DIALOGS_TIP,  _T("&Tip of the day\tCtrl-T"));
#endif // wxUSE_STARTUP_TIPS

#if wxUSE_PROGRESSDLG
    info_menu->Append(DIALOGS_PROGRESS, _T("Pro&gress dialog\tCtrl-G"));
#endif // wxUSE_PROGRESSDLG

#if wxUSE_BUSYINFO
    info_menu->Append(DIALOGS_BUSYINFO, _T("&Busy info dialog\tCtrl-B"));
#endif // wxUSE_BUSYINFO

#if wxUSE_LOG_DIALOG
    info_menu->Append(DIALOGS_LOG_DIALOG, _T("&Log dialog\tCtrl-L"));
#endif // wxUSE_LOG_DIALOG

    file_menu->Append(wxID_ANY,_T("&Informative dialogs"),info_menu);

#endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG


#if wxUSE_FINDREPLDLG
    wxMenu *find_menu = new wxMenu;
    find_menu->AppendCheckItem(DIALOGS_FIND, _T("&Find dialog\tCtrl-F"));
    find_menu->AppendCheckItem(DIALOGS_REPLACE, _T("Find and &replace dialog\tShift-Ctrl-F"));
    file_menu->Append(wxID_ANY,_T("&Searching"),find_menu);
#endif // wxUSE_FINDREPLDLG

#if USE_MODAL_PRESENTATION
    wxMenu *modal_menu = new wxMenu;
    modal_menu->Append(DIALOGS_MODAL, _T("Mo&dal dialog\tCtrl-W"));
    modal_menu->AppendCheckItem(DIALOGS_MODELESS, _T("Modeless &dialog\tCtrl-Z"));
    file_menu->Append(wxID_ANY,_T("&Modal/Modeless"),modal_menu);
#endif // USE_MODAL_PRESENTATION

    file_menu->Append(DIALOGS_PROPERTY_SHEET, _T("&Property Sheet Dialog\tCtrl-P"));
    file_menu->Append(DIALOGS_REQUEST, _T("&Request user attention\tCtrl-R"));

    file_menu->AppendSeparator();
    file_menu->Append(wxID_EXIT, _T("E&xit\tAlt-X"));

    wxMenuBar *menu_bar = new wxMenuBar;
    menu_bar->Append(file_menu, _T("&File"));
    frame->SetMenuBar(menu_bar);

    myCanvas = new MyCanvas(frame);
    myCanvas->SetBackgroundColour(*wxWHITE);

    frame->Centre(wxBOTH);

    // Show the frame
    frame->Show(true);

    SetTopWindow(frame);

    return true;
}
Пример #8
-1
bool MyApp::OnInit(void)
{
  // Create the main frame window
  MyFrame   *frame = new MyFrame(NULL, wxID_ANY, _T("wxWidgets Native Dialog Sample"), wxPoint(0, 0), wxSize(300, 250));

#if wxUSE_STATUSBAR
  // Give it a status line
  frame->CreateStatusBar(2);
#endif // wxUSE_STATUSBAR

  // Make a menubar
  wxMenu *file_menu = new wxMenu;

  file_menu->Append(RESOURCE_TEST1, _T("&Dialog box test"),                _T("Test dialog box resource"));
  file_menu->Append(RESOURCE_QUIT, _T("E&xit"),                _T("Quit program"));

  wxMenuBar *menu_bar = new wxMenuBar;

  menu_bar->Append(file_menu, _T("&File"));

  // Associate the menu bar with the frame
  frame->SetMenuBar(menu_bar);

  // Make a panel
  frame->panel = new wxWindow(frame, wxID_ANY, wxPoint(0, 0), wxSize(400, 400), 0, _T("MyMainFrame"));
  frame->Show(true);

  // Return the main frame window
  SetTopWindow(frame);

  return true;
}
Пример #9
-2
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit()
{
    // Create the main frame window
    MyFrame *frame = new MyFrame(NULL, wxT("wxWidgets OpenGL Penguin Sample"),
        wxDefaultPosition, wxDefaultSize);

    /* Make a menubar */
    wxMenu *fileMenu = new wxMenu;

    fileMenu->Append(wxID_EXIT, wxT("E&xit"));
    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append(fileMenu, wxT("&File"));
    frame->SetMenuBar(menuBar);

    frame->SetCanvas( new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition,
        wxSize(200, 200), wxSUNKEN_BORDER) );

    /* Load file wiht mesh data */
    frame->GetCanvas()->LoadLWO( wxT("penguin.lwo") );

    /* Show the frame */
    frame->Show(true);

    return true;
}