]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/controls/controls.cpp
Put a backslash before a '_'
[wxWidgets.git] / samples / controls / controls.cpp
index 9a425672bba3ca15f717c3078a8300623a6b9245..066ed1b2ccb8e41ecb58d4c5313fa6168b79d237 100644 (file)
@@ -86,8 +86,10 @@ public:
     void OnListBox( wxCommandEvent &event );
     void OnListBoxDoubleClick( wxCommandEvent &event );
     void OnListBoxButtons( wxCommandEvent &event );
+#if wxUSE_CHOICE
     void OnChoice( wxCommandEvent &event );
     void OnChoiceButtons( wxCommandEvent &event );
+#endif
     void OnCombo( wxCommandEvent &event );
     void OnComboTextChanged( wxCommandEvent &event );
     void OnComboTextEnter( wxCommandEvent &event );
@@ -118,8 +120,10 @@ public:
 
     wxListBox     *m_listbox,
                   *m_listboxSorted;
+#if wxUSE_CHOICE
     wxChoice      *m_choice,
                   *m_choiceSorted;
+#endif
     wxComboBox    *m_combo;
     wxRadioBox    *m_radio;
     wxGauge       *m_gauge,
@@ -284,7 +288,7 @@ private:
 // other
 //----------------------------------------------------------------------
 
-static void SetControlClientData(const char *name,
+static void SetControlClientData(const wxChar *name,
                                  wxControlWithItems *control);
 
 IMPLEMENT_APP(MyApp)
@@ -315,8 +319,8 @@ bool MyApp::OnInit()
         y = 50;
     if ( argc == 3 )
     {
-        wxSscanf(argv[1], "%d", &x);
-        wxSscanf(argv[2], "%d", &y);
+        //wxSscanf(argv[1], "%d", &x);
+        //wxSscanf(argv[2], "%d", &y);
     }
 
     // Create the main frame window
@@ -443,6 +447,7 @@ EVT_BUTTON    (ID_LISTBOX_APPEND,       MyPanel::OnListBoxButtons)
 EVT_BUTTON    (ID_LISTBOX_DELETE,       MyPanel::OnListBoxButtons)
 EVT_BUTTON    (ID_LISTBOX_FONT,         MyPanel::OnListBoxButtons)
 EVT_CHECKBOX  (ID_LISTBOX_ENABLE,       MyPanel::OnListBoxButtons)
+#if wxUSE_CHOICE
 EVT_CHOICE    (ID_CHOICE,               MyPanel::OnChoice)
 EVT_CHOICE    (ID_CHOICE_SORTED,        MyPanel::OnChoice)
 EVT_BUTTON    (ID_CHOICE_SEL_NUM,       MyPanel::OnChoiceButtons)
@@ -452,6 +457,7 @@ EVT_BUTTON    (ID_CHOICE_APPEND,        MyPanel::OnChoiceButtons)
 EVT_BUTTON    (ID_CHOICE_DELETE,        MyPanel::OnChoiceButtons)
 EVT_BUTTON    (ID_CHOICE_FONT,          MyPanel::OnChoiceButtons)
 EVT_CHECKBOX  (ID_CHOICE_ENABLE,        MyPanel::OnChoiceButtons)
+#endif
 EVT_COMBOBOX  (ID_COMBO,                MyPanel::OnCombo)
 EVT_TEXT      (ID_COMBO,                MyPanel::OnComboTextChanged)
 EVT_TEXT_ENTER(ID_COMBO,                MyPanel::OnComboTextEnter)
@@ -569,7 +575,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
         wxBitmap bmp(s_iconNames[n]);
         if ( !bmp.Ok() || (imagelist->Add(bmp) == -1) )
         {
-            wxLogWarning("Couldn't load the image '%s' for the notebook page %d.",
+            wxLogWarning(wxT("Couldn't load the image '%s' for the notebook page %d."),
                     s_iconNames[n], n);
         }
     }
@@ -596,8 +602,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
                                      wxPoint(10,90), wxSize(120,70),
                                      5, choices, wxLB_SORT );
 
-    SetControlClientData("listbox", m_listbox);
-    SetControlClientData("listbox", m_listboxSorted);
+    SetControlClientData(wxT("listbox"), m_listbox);
+    SetControlClientData(wxT("listbox"), m_listboxSorted);
 
     m_listbox->SetCursor(*wxCROSS_CURSOR);
 #if wxUSE_TOOLTIPS
@@ -629,13 +635,14 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     panel->SetCursor(wxCursor(wxCURSOR_HAND));
     m_notebook->AddPage(panel, "wxListBox", TRUE, Image_List);
 
+#if wxUSE_CHOICE
     panel = new wxPanel(m_notebook);
     m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices );
     m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,-1),
                                    5, choices, wxCB_SORT );
 
-    SetControlClientData("choice", m_choice);
-    SetControlClientData("choice", m_choiceSorted);
+    SetControlClientData(wxT("choice"), m_choice);
+    SetControlClientData(wxT("choice"), m_choiceSorted);
 
     m_choice->SetSelection(2);
     m_choice->SetBackgroundColour( "red" );
@@ -648,6 +655,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     (void)new wxCheckBox( panel, ID_CHOICE_ENABLE, "&Disable", wxPoint(20,130), wxSize(140,30) );
 
     m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice);
+#endif // wxUSE_CHOICE
 
     panel = new wxPanel(m_notebook);
     (void)new wxStaticBox( panel, -1, "&Box around combobox",
@@ -787,6 +795,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
                                   bmp1,
                                   wxPoint(30, 70)
                                  );
+
     bmpBtn->SetBitmapSelected(bmp2);
     bmpBtn->SetBitmapFocus(bmp3);
 
@@ -1031,6 +1040,7 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event )
     }
 }
 
+#if wxUSE_CHOICE
 void MyPanel::OnChoice( wxCommandEvent &event )
 {
     wxChoice *choice = event.GetId() == ID_CHOICE ? m_choice
@@ -1114,6 +1124,7 @@ void MyPanel::OnChoiceButtons( wxCommandEvent &event )
             }
     }
 }
+#endif // wxUSE_CHOICE
 
 void MyPanel::OnCombo( wxCommandEvent &event )
 {
@@ -1504,14 +1515,14 @@ void MyComboBox::OnKeyUp(wxKeyEvent& event)
     event.Skip();
 }
 
-static void SetControlClientData(const char *name,
+static void SetControlClientData(const wxChar *name,
                                  wxControlWithItems *control)
 {
     size_t count = control->GetCount();
     for ( size_t n = 0; n < count; n++ )
     {
         wxString s;
-        s.Printf("%s client data for '%s'",
+        s.Printf(wxT("%s client data for '%s'"),
                  name, control->GetString(n).c_str());
 
         control->SetClientObject(n, new wxStringClientData(s));