]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/controls/controls.cpp
missing comma for Motif compilation added
[wxWidgets.git] / samples / controls / controls.cpp
index ae3aa14b97b5f560e961ab4a4b1ddf658de266e7..a119c5975c2872cf3aa05c70433785f5d858e462 100644 (file)
@@ -182,7 +182,7 @@ bool MyApp::OnInit()
     file_menu->Append(MINIMAL_ABOUT, "&About");
     file_menu->Append(MINIMAL_QUIT, "E&xit");
 
-    wxMenuBar *menu_bar = new wxMenuBar;
+    wxMenuBar *menu_bar = new wxMenuBar( wxMB_DOCKABLE );
     menu_bar->Append(file_menu, "&File");
 
 #if wxUSE_TOOLTIPS
@@ -228,7 +228,7 @@ void MyTextCtrl::OnChar(wxKeyEvent& event)
         s_repeatCount = 1;
     }
         
-    wxLogStatus("Key event: %d (x%u), at position %ld",
+    wxLogStatus( _T("Key event: %d (x%u), at position %ld"),
                 s_keycode, s_repeatCount, GetInsertionPoint());
 
     event.Skip();
@@ -244,11 +244,11 @@ void MyTextCtrl::OnKeyDown(wxKeyEvent& event)
                 long line, column, pos = GetInsertionPoint();
                 PositionToXY(pos, &column, &line);
 
-                wxLogMessage("Current position: %ld\n"
+                wxLogMessage( _T("Current position: %ld\n"
                         "Current line, column: (%ld, %ld)\n"
                         "Number of lines: %ld\n"
                         "Current line length: %ld\n"
-                        "Total text length: %ld",
+                        "Total text length: %ld"),
                         pos,
                         line, column,
                         GetNumberOfLines(),
@@ -474,6 +474,7 @@ m_text(NULL), m_notebook(NULL)
 
     panel = new wxPanel(m_notebook);
     m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices );
+    m_choice->SetBackgroundColour( "red" );
     (void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
     (void)new wxButton( panel, ID_CHOICE_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) );
     (void)new wxButton( panel, ID_CHOICE_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
@@ -484,7 +485,7 @@ m_text(NULL), m_notebook(NULL)
     m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice);
 
     panel = new wxPanel(m_notebook);
-    m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 5, choices );
+    m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 5, choices, wxCB_READONLY );
     (void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
     (void)new wxButton( panel, ID_COMBO_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) );
     (void)new wxButton( panel, ID_COMBO_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
@@ -505,7 +506,7 @@ m_text(NULL), m_notebook(NULL)
     (*m_multitext) << " Appended.";
     m_multitext->SetInsertionPoint(0);
     m_multitext->WriteText( "Prepended. " );
-    m_multitext->AppendText( "\nPress function keys to test different wxTextCtrl functions." );
+    m_multitext->AppendText( "\nPress function keys for test different tests." );
 
     (*m_multitext) << "\nDoes it have cross cursor?";
     m_multitext->SetCursor(*wxCROSS_CURSOR);
@@ -548,7 +549,7 @@ m_text(NULL), m_notebook(NULL)
     panel = new wxPanel(m_notebook);
     (void)new wxStaticBox( panel, -1, "wxGauge and wxSlider", wxPoint(10,10), wxSize(180,130) );
     m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155, 30) );
-    m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1) );
+    m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1), wxSL_LABELS );
     (void)new wxStaticBox( panel, -1, "Explanation", wxPoint(200,10), wxSize(290,130) );
 #ifdef __WXMOTIF__
     // No wrapping text in wxStaticText yet :-(
@@ -696,9 +697,12 @@ void MyPanel::OnPageChanged( wxNotebookEvent &event )
 
 void MyPanel::OnListBox( wxCommandEvent &event )
 {
-    m_text->AppendText( "ListBox selection string is: " );
+    m_text->AppendText( "ListBox event selection string is: " );
     m_text->AppendText( event.GetString() );
     m_text->AppendText( "\n" );
+    m_text->AppendText( "ListBox control selection string is: " );
+    m_text->AppendText( m_listbox->GetStringSelection() );
+    m_text->AppendText( "\n" );
 }
 
 void MyPanel::OnListBoxDoubleClick( wxCommandEvent &event )
@@ -762,9 +766,12 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event )
 
 void MyPanel::OnChoice( wxCommandEvent &event )
 {
-    m_text->AppendText( "Choice selection string is: " );
+    m_text->AppendText( "Choice event selection string is: " );
     m_text->AppendText( event.GetString() );
     m_text->AppendText( "\n" );
+    m_text->AppendText( "Choice control selection string is: " );
+    m_text->AppendText( m_choice->GetStringSelection() );
+    m_text->AppendText( "\n" );
 }
 
 void MyPanel::OnChoiceButtons( wxCommandEvent &event )
@@ -812,9 +819,12 @@ void MyPanel::OnChoiceButtons( wxCommandEvent &event )
 
 void MyPanel::OnCombo( wxCommandEvent &event )
 {
-    m_text->AppendText( "ComboBox selection string is: " );
+    m_text->AppendText( "ComboBox event selection string is: " );
     m_text->AppendText( event.GetString() );
     m_text->AppendText( "\n" );
+    m_text->AppendText( "ComboBox control selection string is: " );
+    m_text->AppendText( m_combo->GetStringSelection() );
+    m_text->AppendText( "\n" );
 }
 
 void MyPanel::OnComboButtons( wxCommandEvent &event )
@@ -909,10 +919,10 @@ void MyPanel::OnSliderUpdate( wxCommandEvent &WXUNUSED(event) )
 void MyPanel::OnSpinUpdate( wxSpinEvent &event )
 {
     wxString value;
-    value.Printf( "%d", event.GetPosition() );
+    value.Printf( _T("%d"), event.GetPosition() );
     m_spintext->SetValue( value );
 
-    value.Printf("Spin control range: (%d, %d), current = %d\n",
+    value.Printf( _T("Spin control range: (%d, %d), current = %d\n"),
                  m_spinbutton->GetMin(), m_spinbutton->GetMax(),
                  m_spinbutton->GetValue());
 
@@ -969,7 +979,7 @@ void MyFrame::OnSetTooltipDelay(wxCommandEvent& event)
     static long s_delay = 5000;
 
     wxString delay;
-    delay.Printf("%ld", s_delay);
+    delay.Printf( _T("%ld"), s_delay);
 
     delay = wxGetTextFromUser("Enter delay (in milliseconds)",
             "Set tooltip delay",
@@ -978,11 +988,11 @@ void MyFrame::OnSetTooltipDelay(wxCommandEvent& event)
     if ( !delay )
         return; // cancelled
 
-    sscanf(delay, "%ld", &s_delay);
+    wxSscanf(delay, _T("%ld"), &s_delay);
 
     wxToolTip::SetDelay(s_delay);
 
-    wxLogStatus(this, "Tooltip delay set to %ld milliseconds", s_delay);
+    wxLogStatus(this, _T("Tooltip delay set to %ld milliseconds"), s_delay);
 }
 
 void MyFrame::OnToggleTooltips(wxCommandEvent& event)
@@ -993,14 +1003,14 @@ void MyFrame::OnToggleTooltips(wxCommandEvent& event)
 
     wxToolTip::Enable(s_enabled);
 
-    wxLogStatus(this, "Tooltips %sabled", s_enabled ? "en" : "dis");
+    wxLogStatus(this, _T("Tooltips %sabled"), s_enabled ? _T("en") : _T("dis") );
 }
 #endif // tooltips
 
 void MyFrame::OnSize( wxSizeEvent& event )
 {
     wxString msg;
-    msg.Printf("%dx%d", event.GetSize().x, event.GetSize().y);
+    msg.Printf( _("%dx%d"), event.GetSize().x, event.GetSize().y);
     SetStatusText(msg, 1);
 
     event.Skip();
@@ -1016,14 +1026,16 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
         s_windowFocus = focus;
 
         wxString msg;
-        msg.Printf("Focus: wxWindow = %p"
+        msg.Printf(
 #ifdef __WXMSW__
-                ", HWND = %08x"
-#endif // wxMSW
-                , s_windowFocus
+                _T("Focus: wxWindow = %p, HWND = %08x"),
+#else
+                _T("Focus: wxWindow = %p"),
+#endif
+                s_windowFocus
 #ifdef __WXMSW__
                 , s_windowFocus->GetHWND()
-#endif // wxMSW
+#endif
                   );
 
         SetStatusText(msg);