Example #1
0
bool MyApp::OnInit()
{
	MyFrame *frame = new MyFrame(L"发票凑整", wxPoint(-1, -1), wxSize(-1, -1));
	frame->SetMinSize(wxSize(640, 480));
	frame->Show(true);
	return true;
}
Example #2
0
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

#if wxUSE_LIBPNG
    wxImage::AddHandler(new wxPNGHandler);
#endif
#if wxUSE_LIBJPEG
    wxImage::AddHandler(new wxJPEGHandler);
#endif
#if wxUSE_GIF
    wxImage::AddHandler(new wxGIFHandler);
#endif

    MyFrame *frame = new MyFrame(_("Printing test"),
        wxDefaultPosition, wxSize(640, 480));

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

    // success: wxApp::OnRun() will be called which will enter the main message
    // loop and the application will run. If we returned false here, the
    // application would exit immediately.
    return true;
}
Example #3
0
bool MyApp::OnInit()
{
	if ( !wxApp::OnInit() ) return false;
	MyFrame *frame = new MyFrame(_T("coLinux Console"));
	frame->Show(true);
	return true;
}
Example #4
0
bool MyApp::OnInit()
{
#if wxUSE_LIBPNG
    wxImage::AddHandler( new wxPNGHandler );
#endif

    wxImage image;
    if (image.LoadFile(_T("backgrnd.png"), wxBITMAP_TYPE_PNG))
    {
        m_background = wxBitmap(image);
    }

    MyFrame *frame = new MyFrame();

    wxString rootName(_T("shape0"));

    int i;
    for (i = 1; i < 4; i++)
    {
        wxString filename;
        filename.Printf(wxT("%s%d.png"), (const wxChar*)rootName, i);
    /* For some reason under wxX11, the 2nd LoadFile in this loop fails, with
       a BadMatch inside CreateFromImage (inside ConvertToBitmap). This happens even if you copy
       the first file over the second file. */
        if (image.LoadFile(filename, wxBITMAP_TYPE_PNG))
        {
            DragShape* newShape = new DragShape(wxBitmap(image));
            newShape->SetPosition(wxPoint(i*50, i*50));

            if (i == 2)
                newShape->SetDragMethod(SHAPE_DRAG_TEXT);
            else if (i == 3)
                newShape->SetDragMethod(SHAPE_DRAG_ICON);
            else
                newShape->SetDragMethod(SHAPE_DRAG_BITMAP);
            frame->GetCanvas()->GetDisplayList().Append(newShape);
        }
    }

#if 0
    // Under Motif or GTK, this demonstrates that
    // wxScreenDC only gets the root window content.
    // We need to be able to copy the overall content
    // for full-screen dragging to work.
    int w, h;
    wxDisplaySize(& w, & h);
    wxBitmap bitmap(w, h);

    wxScreenDC dc;
    wxMemoryDC memDC;
    memDC.SelectObject(bitmap);
    memDC.Blit(0, 0, w, h, & dc, 0, 0);
    memDC.SelectObject(wxNullBitmap);
    m_background = bitmap;
#endif

    frame->Show( true );

    return true;
}
Example #5
0
bool BasicApplication::OnInit(){
	wxInitAllImageHandlers();
	MyFrame *frame = new MyFrame(_T("Basic Frame"), 50, 50, 1024, 768);
	frame->Show(TRUE);
	SetTopWindow(frame);
	return TRUE;
}
bool MyApp::OnInit()
{
    MyFrame *frame = new MyFrame( NULL, -1, wxT("Minimal"), wxPoint(20,20), wxSize(500,340) );
    frame->Show( TRUE );
    
    return TRUE;
}
Example #7
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;
}
Example #8
0
bool MyApp::OnInit()
{
    char path1[100];
    char path2[100];

    // path to data
    sprintf_s(path1, 100, ".");
    if (argc > 1) {
        wxString s(argv[1]);
        strncpy_s( path1, 100, (const char*)s.mb_str(wxConvUTF8), 100 );
        std::cout << "OnInit: data path is " << path1 << std::endl;
    }

    // Specifying a file to load at the command line is optional
    // and is otherwise done through File->Load in the UI
    sprintf_s(path2, 100, "NO FILE");
    if (argc > 2) {
        wxString s(argv[2]);
        strncpy_s( path2, 100, (const char*)s.mb_str(wxConvUTF8), 100 );
        std::cout << "OnInit: default path is " << path2 << std::endl;
    }

    MyFrame *frame = new MyFrame( _T("Stick'em Up"), wxPoint(50,50), wxSize(640,480),
                                  std::string(path1), std::string(path2) );
    frame->Show(TRUE);
    SetTopWindow(frame);

    return TRUE;
} 
Example #9
0
 virtual bool OnInit(){
 	g_logger.config.stream_type = 3;
 	g_logger.reset();
     MyFrame *frame = new MyFrame(wxT("ZKS Sudoku Beta"), wxDefaultPosition, wxDefaultSize);
     frame->Show(true);
     return true;
 }
Example #10
0
bool MyApp::OnInit()
{
	MyFrame *frame = new MyFrame("Hello World", wxPoint(50, 50), wxSize(450, 340));
	frame->Show(true);

	return true;
}
Example #11
0
// 'Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

#if wxUSE_ACCESSIBILITY
    // Note: JAWS for Windows will only speak the context-sensitive
    // help if you use this help provider:
    // wxHelpProvider::Set(new wxHelpControllerHelpProvider(m_helpController)).
    // JAWS does not seem to be getting the help text from
    // the wxAccessible object.
    wxHelpProvider::Set(new wxSimpleHelpProvider());

    // create the main application window
    MyFrame *frame = new MyFrame(wxT("AccessTest wxWidgets App"),
                                 wxPoint(50, 50), wxSize(450, 340));

    // and show it (the frames, unlike simple controls, are not shown when
    // created initially)
    frame->Show(true);

    // success: wxApp::OnRun() will be called which will enter the main message
    // loop and the application will run. If we returned false here, the
    // application would exit immediately.
    return true;
#else
    wxMessageBox( wxT("This sample has to be compiled with wxUSE_ACCESSIBILITY"), wxT("Building error"), wxOK);
    return false;
#endif // wxUSE_ACCESSIBILITY
}
Example #12
0
bool MyApp::OnInit()
{
    MyFrame * frame = new MyFrame(wxT("APPLICATION"));
    frame->Show();

    return true;;
}
bool MyApp::OnInit()
{
    MyFrame *frame = new MyFrame( _("Hello World"), wxPoint(50, 50),  wxSize(500, 500) );
    frame->Show(true);
    SetTopWindow(frame);
    return true;
}
Example #14
0
File: wxtest.cpp Project: ifwe/wxpy
bool MyApp::OnInit()
{
    wxString title;
    int size = 0;

    wxStockGDI& s = wxStockGDI::instance();
    const wxFont* f1 = s.GetFont(wxStockGDI::FONT_NORMAL);

    const wxFont* f2 = wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL);
    const wxFont* f3 = wxNORMAL_FONT;

    printf("%p %p %p\n", f1, f2, f3);

    size = wxNORMAL_FONT->GetPointSize();
    title.Printf(_T("Hello, World! %d"), size);

    MyFrame *frame = new MyFrame(title, wxPoint(50,50), wxSize(450,340) );
    frame->Show(TRUE);
    SetTopWindow(frame);

    FILE* fp = fopen("c:\\output.txt", "w");
    wxLog::SetActiveTarget(new wxLogStderr(fp));
    wxLogMessage(wxT("test log message"));
    wxLogError(wxT("this is an error"));

    return TRUE;
}
Example #15
0
// 'Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

#ifdef __WXMSW__
    if ( argc == 2 && !wxStricmp(argv[1],  wxT("/dx")) )
    {
        wxSystemOptions::SetOption(wxT("msw.display.directdraw"), 1);
    }
#endif // __WXMSW__

    // create the main application window
    MyFrame *frame = new MyFrame(_("Display wxWidgets Sample"),
                                 wxDefaultPosition, wxDefaultSize);

    // and show it (the frames, unlike simple controls, are not shown when
    // created initially)
    frame->Show();

    // success: wxApp::OnRun() will be called which will enter the main message
    // loop and the application will run. If we returned false here, the
    // application would exit immediately.
    return true;
}
Example #16
0
bool MyApp::OnInit()
{
    MyFrame *frame = new MyFrame( _T("Hello World"), wxPoint(50,50), wxSize(450,340) );
    frame->Show(TRUE);
    SetTopWindow(frame);
    return TRUE;
}
Example #17
0
bool MyApp::OnInit() {
	MyFrame* frame = new MyFrame(wxT("Min wxWidgets app"));
	frame->Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyFrame::OnQuit));
	frame->Connect(wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyFrame::OnAbout));
	
	frame->Show(true);
	return true; // event handling loop starts after
}
Example #18
0
bool MiniWxApp::OnInit() {
	wxString title;
	title.Printf(wxT("Onega’s mini wxWidgets application pid:%d "), getpid());
	MyFrame *frame = new MyFrame( title, wxDefaultPosition, wxDefaultSize);
	frame->Show(true);
	SetTopWindow (frame);
	return true;
}
Example #19
0
bool MyApp::OnInit()
{
    auto title = wxString::Format("Hello %s (pid %lu)", wxVERSION_STRING,
                                  wxGetProcessId());
    MyFrame* frame = new MyFrame(title, wxPoint(50, 50), wxSize(450, 340));
    frame->Show(true);
    return true;
}
Example #20
0
File: test.cpp Project: alphavip/Wx
bool MyApp::OnInit()
{
	//MyFrame *frame = new MyFrame("Hello World", wxPoint(50, 50), wxSize(450, 340));
	MyFrame *frame = new MyFrame("Hello World", wxDefaultPosition, wxDefaultSize);
	frame->Show(true);
	SetTopWindow(frame);
	return true;
}
Example #21
0
// 'Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
if ( !wxApp::OnInit() )
return false;
MyFrame *frame = new MyFrame("wxWidgets TCP Server");
frame->Show(true);
return true;
}
Example #22
0
HoeEditor::BaseEditor * Hoe2DEditApp::CreateEditor()
{
    MyFrame* frame = new MyFrame();
    SetTopWindow(frame);
    frame->Show();

    return frame;
}
Example #23
0
bool MyApp::OnInit()
{
    // Create and display the main frame window.
    MyFrame *frame = new MyFrame((wxFrame *) NULL, wxT("Validator Test"),
                                 50, 50, 300, 250);
    frame->Show(true);
    SetTopWindow(frame);
    return true;
}
Example #24
0
bool MyApp::OnInit(void)
{
    if ( !wxApp::OnInit() )
        return false;

    wxInitAllImageHandlers();


    // init global objects
    // -------------------

    g_printData = new wxPrintData;

    // You could set an initial paper size here
#if 0
    g_printData->SetPaperId(wxPAPER_LETTER); // for Americans
    g_printData->SetPaperId(wxPAPER_A4);    // for everyone else
#endif

    g_pageSetupData = new wxPageSetupDialogData;

    // copy over initial paper size from print record
    (*g_pageSetupData) = *g_printData;

    // Set some initial page margins in mm.
    g_pageSetupData->SetMarginTopLeft(wxPoint(15, 15));
    g_pageSetupData->SetMarginBottomRight(wxPoint(15, 15));


    // init local GUI objects
    // ----------------------

#if 0
    wxImage image( wxT("test.jpg") );
    image.SetAlpha();
    int i,j;
    for (i = 0; i < image.GetWidth(); i++)
       for (j = 0; j < image.GetHeight(); j++)
          image.SetAlpha( i, j, 50 );
    m_bitmap = image;
#endif
    m_angle = 30;
    m_testFont.Create(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);


    // Create the main frame window
    // ----------------------------

    MyFrame* frame = new MyFrame((wxFrame *) NULL, wxT("wxWidgets Printing Demo"),
                                 wxPoint(0, 0), wxSize(400, 400));

    frame->Centre(wxBOTH);
    frame->Show();

    return true;
}
Example #25
0
bool MyApp::OnInit()
{
    SetVendorName(_T("Free world"));
    SetAppName(_T("wxEdit"));

    MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("wxEdit"), wxPoint(20,20), wxSize(500,340) );
    frame->Show( true );

    return true;
}
Example #26
0
bool MyApp::OnInit() {
  if(!wxApp::OnInit()) {
    return false;
  } // if

  MyFrame* MainFrame = new MyFrame(wxT("Hello World"), wxPoint(50, 50), wxSize(450,340));
  MainFrame->Show();

  return true;
} // MyApp::OnInit
Example #27
0
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

    MyFrame *frame = new MyFrame;
    frame->Show(true);

    return true;
}
Example #28
0
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

    MyFrame *frame = new MyFrame("wxClipboard sample");
    frame->Show(true);

    return true;
}
Example #29
-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;
}
Example #30
-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;
}