]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/ownerdrw/ownerdrw.cpp
Fix so the value given to wxTextEntryDialog::SetValue will actually be
[wxWidgets.git] / samples / ownerdrw / ownerdrw.cpp
index 2e039f29260bd5f9f0de161044a0cb889f69cc90..4488631127c8328271ca4d61a2a98a520f452bb6 100644 (file)
@@ -175,6 +175,12 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int
   // create the menu
   InitMenu();
 
   // create the menu
   InitMenu();
 
+  // create the status line
+  const int widths[] = { -1, 60 };
+  CreateStatusBar(2);
+  SetStatusWidths(2, widths);
+  SetStatusText("no selection", 0);
+
   // make a panel with some controls
   wxPanel *pPanel = new wxPanel(this, -1, wxPoint(0, 0), 
                                 wxSize(400, 200), wxTAB_TRAVERSAL);
   // make a panel with some controls
   wxPanel *pPanel = new wxPanel(this, -1, wxPoint(0, 0), 
                                 wxSize(400, 200), wxTAB_TRAVERSAL);
@@ -185,7 +191,7 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int
                                       "-------", "owner-drawn", "listbox" };
 
   wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)];
                                       "-------", "owner-drawn", "listbox" };
 
   wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)];
-  uint ui;
+  unsigned int ui;
   for ( ui = 0; ui < WXSIZEOF(aszChoices); ui++ )
     astrChoices[ui] = aszChoices[ui];
 
   for ( ui = 0; ui < WXSIZEOF(aszChoices); ui++ )
     astrChoices[ui] = aszChoices[ui];
 
@@ -211,7 +217,7 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int
   static const char* aszColors[] = { "Red", "Blue", "Pink",
                                      "Green", "Yellow", 
                                      "Black", "Violet"  };
   static const char* aszColors[] = { "Red", "Blue", "Pink",
                                      "Green", "Yellow", 
                                      "Black", "Violet"  };
-  struct { uint r, g, b; } aColors[] = { {255,0,0}, {0,0,255}, {255,128,192},
+  struct { unsigned int r, g, b; } aColors[] = { {255,0,0}, {0,0,255}, {255,128,192},
                                         {0,255,0}, {255,255,128}, 
                                         {0,0,0}, {128,0,255} };
   astrChoices = new wxString[WXSIZEOF(aszColors)];
                                         {0,255,0}, {255,255,128}, 
                                         {0,0,0}, {128,0,255} };
   astrChoices = new wxString[WXSIZEOF(aszColors)];
@@ -241,11 +247,7 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int
     
   }
 
     
   }
 
-  // create the status line
-  const int widths[] = { -1, 60 };
-  CreateStatusBar(2);
-  SetStatusWidths(2, widths);
-  SetStatusText("no selection", 0);
+  delete[] astrChoices;
 
   Show(TRUE);
 }
 
   Show(TRUE);
 }
@@ -261,7 +263,8 @@ void OwnerDrawnFrame::OnQuit(wxCommandEvent& event)
 
 void OwnerDrawnFrame::OnAbout(wxCommandEvent& event)
 {
 
 void OwnerDrawnFrame::OnAbout(wxCommandEvent& event)
 {
-  wxMessageDialog dialog(this, "Demo of owner-drawn controls\n"
+  wxMessageDialog dialog(this,
+                         "Demo of owner-drawn controls\n",
                          "About wxOwnerDrawn", wxYES_NO | wxCANCEL);
   dialog.ShowModal();
 }
                          "About wxOwnerDrawn", wxYES_NO | wxCANCEL);
   dialog.ShowModal();
 }
@@ -269,16 +272,17 @@ void OwnerDrawnFrame::OnAbout(wxCommandEvent& event)
 void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
 {
   wxString strSelection;
 void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
 {
   wxString strSelection;
-  uint nSel = event.GetSelection();
-  strSelection.sprintf("item %d selected (%schecked)", nSel,
-                       m_pListBox->IsChecked(nSel) ? "" : "not ");
+  unsigned int nSel = event.GetSelection();
+  strSelection.sprintf(wxT("item %d selected (%schecked)"), nSel,
+                       m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not "));
   SetStatusText(strSelection);
 }
 
 void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& event)
 {
   wxString strSelection;
   SetStatusText(strSelection);
 }
 
 void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& event)
 {
   wxString strSelection;
-  strSelection.sprintf("item %d double clicked", m_pListBox->GetSelection());
+  strSelection.sprintf(wxT("item %d double clicked"),
+                       m_pListBox->GetSelection());
   wxMessageDialog dialog(this, strSelection);
   dialog.ShowModal();
 }
   wxMessageDialog dialog(this, strSelection);
   dialog.ShowModal();
 }
@@ -286,8 +290,8 @@ void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& event)
 void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event)
 {
   wxString strSelection;
 void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event)
 {
   wxString strSelection;
-  uint nItem = event.GetInt();
-  strSelection.sprintf("item %d was %schecked", nItem,
-                       m_pListBox->IsChecked(nItem) ? "" : "un");
+  unsigned int nItem = event.GetInt();
+  strSelection.sprintf(wxT("item %d was %schecked"), nItem,
+                       m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un"));
   SetStatusText(strSelection);
   SetStatusText(strSelection);
-}
\ No newline at end of file
+}