]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/popup/popup.cpp
search for X11 headers in paths under /usr/local before those under /usr (#9477)
[wxWidgets.git] / samples / popup / popup.cpp
index 0306e91ccf2748c3c72aaf561a0e5cdece5092f3..47b94bb0e037d7eb255565db4244fac9280e4601 100644 (file)
@@ -124,8 +124,8 @@ SimpleTransientPopup::SimpleTransientPopup( wxWindow *parent )
                      NULL, this);
 
     wxStaticText *text = new wxStaticText( m_panel, wxID_ANY,
                      NULL, this);
 
     wxStaticText *text = new wxStaticText( m_panel, wxID_ANY,
-                          wxT("wx.PopupTransientWindow is a\n")
-                          wxT("wx.PopupWindow which disappears\n")
+                          wxT("wxPopupTransientWindow is a\n")
+                          wxT("wxPopupWindow which disappears\n")
                           wxT("automatically when the user\n")
                           wxT("clicks the mouse outside it or if it\n")
                           wxT("(or its first child) loses focus in \n")
                           wxT("automatically when the user\n")
                           wxT("clicks the mouse outside it or if it\n")
                           wxT("(or its first child) loses focus in \n")
@@ -142,7 +142,6 @@ SimpleTransientPopup::SimpleTransientPopup( wxWindow *parent )
     topSizer->Add( m_spinCtrl, 0, wxALL, 5 );
     topSizer->Add( m_mouseText, 0, wxCENTRE|wxALL, 5 );
 
     topSizer->Add( m_spinCtrl, 0, wxALL, 5 );
     topSizer->Add( m_mouseText, 0, wxCENTRE|wxALL, 5 );
 
-    m_panel->SetAutoLayout( true );
     m_panel->SetSizer( topSizer );
     topSizer->Fit(m_panel);
     topSizer->Fit(this);
     m_panel->SetSizer( topSizer );
     topSizer->Fit(m_panel);
     topSizer->Fit(this);
@@ -200,7 +199,7 @@ void SimpleTransientPopup::OnMouse(wxMouseEvent &event)
     rect.SetWidth(1000000);
     wxColour colour(*wxLIGHT_GREY);
 
     rect.SetWidth(1000000);
     wxColour colour(*wxLIGHT_GREY);
 
-    if (rect.Inside(event.GetPosition()))
+    if (rect.Contains(event.GetPosition()))
     {       
         colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
     wxLogMessage( wxT("0x%lx SimpleTransientPopup::OnMouse pos(%d, %d)"), long(event.GetEventObject()), event.GetX(), event.GetY());
     {       
         colour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
     wxLogMessage( wxT("0x%lx SimpleTransientPopup::OnMouse pos(%d, %d)"), long(event.GetEventObject()), event.GetX(), event.GetY());
@@ -229,7 +228,7 @@ void SimpleTransientPopup::OnButton(wxCommandEvent& event)
 
 void SimpleTransientPopup::OnSpinCtrl(wxSpinEvent& event)
 {
 
 void SimpleTransientPopup::OnSpinCtrl(wxSpinEvent& event)
 {
-    wxLogMessage( wxT("0x%lx SimpleTransientPopup::OnSpinCtrl ID %d Value %ld"), long(this), event.GetId(), event.GetInt());
+    wxLogMessage( wxT("0x%lx SimpleTransientPopup::OnSpinCtrl ID %d Value %d"), long(this), event.GetId(), event.GetInt());
     event.Skip();
 }
 
     event.Skip();
 }
 
@@ -289,6 +288,9 @@ IMPLEMENT_APP(MyApp)
 // 'Main program' equivalent: the program execution "starts" here
 bool MyApp::OnInit()
 {
 // 'Main program' equivalent: the program execution "starts" here
 bool MyApp::OnInit()
 {
+    if ( !wxApp::OnInit() )
+        return false;
+
     // create the main application window
     m_frame = new MyFrame(_T("Popup wxWidgets App"));
 
     // create the main application window
     m_frame = new MyFrame(_T("Popup wxWidgets App"));
 
@@ -315,7 +317,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 END_EVENT_TABLE()
 
 MyFrame::MyFrame(const wxString& title)
 END_EVENT_TABLE()
 
 MyFrame::MyFrame(const wxString& title)
-       : wxFrame(NULL, wxID_ANY, title)
+: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(500,300))
 {
     m_simplePopup = m_scrolledPopup = NULL;
 
 {
     m_simplePopup = m_scrolledPopup = NULL;
 
@@ -355,14 +357,13 @@ MyFrame::MyFrame(const wxString& title)
     m_logWin->SetEditable(false);
     wxLogTextCtrl* logger = new wxLogTextCtrl( m_logWin );
     m_logOld = logger->SetActiveTarget( logger );
     m_logWin->SetEditable(false);
     wxLogTextCtrl* logger = new wxLogTextCtrl( m_logWin );
     m_logOld = logger->SetActiveTarget( logger );
-    logger->SetTimestamp( NULL );
+    logger->DisableTimestamp();
 
     wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
     topSizer->Add( button1, 0, wxALL, 5 );
     topSizer->Add( button2, 0, wxALL, 5 );
     topSizer->Add( m_logWin, 1, wxEXPAND|wxALL, 5 );
 
 
     wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
     topSizer->Add( button1, 0, wxALL, 5 );
     topSizer->Add( button2, 0, wxALL, 5 );
     topSizer->Add( m_logWin, 1, wxEXPAND|wxALL, 5 );
 
-    panel->SetAutoLayout( true );
     panel->SetSizer( topSizer );
 
 }
     panel->SetSizer( topSizer );
 
 }
@@ -449,9 +450,7 @@ MyDialog::MyDialog(const wxString& title)
     topSizer->AddSpacer(40);
     topSizer->Add( okButton, 0, wxALL, 5 );
 
     topSizer->AddSpacer(40);
     topSizer->Add( okButton, 0, wxALL, 5 );
 
-    panel->SetAutoLayout( true );
-    panel->SetSizer( topSizer );
-    topSizer->Fit(this);
+    panel->SetSizerAndFit( topSizer );
 }
 
 void MyDialog::OnStartSimplePopup(wxCommandEvent& event)
 }
 
 void MyDialog::OnStartSimplePopup(wxCommandEvent& event)