Beispiel #1
0
// `Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

    // Create the main application window
    MyFrame *frame = new MyFrame(wxT("Dial-up wxWidgets demo"),
                                 wxPoint(50, 50), wxSize(450, 340));

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

    // Init dial up manager
    m_dial = wxDialUpManager::Create();

    if ( !m_dial->IsOk() )
    {
        wxLogError(wxT("The sample can't run on this system."));

#if wxUSE_LOG
        wxLog::GetActiveTarget()->Flush();
#endif // wxUSE_LOG

        // do it here, OnExit() won't be called
        delete m_dial;

        return false;
    }

#if wxUSE_STATUSBAR
    frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? wxT("LAN") : wxT("No LAN"), 2);
#endif // wxUSE_STATUSBAR

    return true;
}
Beispiel #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;
}
Beispiel #3
0
int cb_MyFrame_InitStatusbar( void* window, void* WXUNUSED(param) )
{
    MyFrame *frame = (MyFrame*) window;
    frame->SetStatusText( wxT("Hello from MyFrame"), 0 );
    return 0;
}