]> git.saurik.com Git - wxWidgets.git/commitdiff
Various Dialog Editor-related mods; Dlg Ed. getting usable now under MSW.
authorJulian Smart <julian@anthemion.co.uk>
Mon, 10 Aug 1998 13:48:12 +0000 (13:48 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Mon, 10 Aug 1998 13:48:12 +0000 (13:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

18 files changed:
docs/msw/todo.txt
include/wx/defs.h
include/wx/msw/radiobox.h
src/common/resource.cpp
src/msw/bmpbuttn.cpp
src/msw/choice.cpp
src/msw/control.cpp
src/msw/gauge95.cpp
src/msw/gaugemsw.cpp
src/msw/slider95.cpp
src/msw/statbmp.cpp
src/msw/statbox.cpp
utils/dialoged/src/dlghndlr.cpp
utils/dialoged/src/reseditr.cpp
utils/dialoged/src/reswrite.cpp
utils/dialoged/src/winprop.cpp
utils/dialoged/src/winprop.h
utils/dialoged/src/winstyle.cpp

index 7172ee5960de424f07b231e3652fcb1fa6778378..326531ddc856156782848b499fa59ba730c4b576 100644 (file)
@@ -86,6 +86,9 @@ Add a wxTabCtrl sample.
 Improve printing. More API functions for printer DCs (to get
 printer characteristics) and more reliable printing framework.
 
 Improve printing. More API functions for printer DCs (to get
 printer characteristics) and more reliable printing framework.
 
+Add GetIcon, GetBitmap to wxImageList. Perhaps store bitmaps
+in image list so we can get them later.
+
 LOW PRIORITY
 ------------
 
 LOW PRIORITY
 ------------
 
index 019b901851c6d3d042aca5504d13fb2ab17b372c..f5bfc86b809389ba516d2a098b6f682042565c9f 100644 (file)
@@ -395,21 +395,14 @@ typedef void (*wxFunction) (wxObject&, wxEvent&);
  * Styles for wxListBox
  */
 
  * Styles for wxListBox
  */
 
-// In wxListBox style flag
-#define wxSB_MASK           0x0008
-#define wxNEEDED_SB         0x0000
-#define wxALWAYS_SB         0x0008
-
-// New naming convention
-#define wxLB_NEEDED_SB      wxNEEDED_SB
-#define wxLB_ALWAYS_SB      wxALWAYS_SB
 #define wxLB_SORT           0x0010
 #define wxLB_SORT           0x0010
-// These duplicate the styles in the Multiple argument
-#define wxLB_SINGLE         0x0000
+#define wxLB_SINGLE         0x0020
 #define wxLB_MULTIPLE       0x0040
 #define wxLB_EXTENDED       0x0080
 // wxLB_OWNERDRAW is Windows-only
 #define wxLB_OWNERDRAW      0x0100
 #define wxLB_MULTIPLE       0x0040
 #define wxLB_EXTENDED       0x0080
 // wxLB_OWNERDRAW is Windows-only
 #define wxLB_OWNERDRAW      0x0100
+#define wxLB_NEEDED_SB      0x0200
+#define wxLB_ALWAYS_SB      0x0400
 #define wxLB_HSCROLL        wxHSCROLL
 
 /*
 #define wxLB_HSCROLL        wxHSCROLL
 
 /*
@@ -422,10 +415,6 @@ typedef void (*wxFunction) (wxObject&, wxEvent&);
 #define wxTE_READONLY       0x0010
 #define wxTE_MULTILINE      0x0020
 
 #define wxTE_READONLY       0x0010
 #define wxTE_MULTILINE      0x0020
 
-// TODO For backward compatibility, need wxOLD_READONLY
-#define wxREADONLY          wxTE_READONLY
-#define wxEDITABLE          0
-
 // MSW-only
 #define wxTE_RICHTEXT       0x0020
 
 // MSW-only
 #define wxTE_RICHTEXT       0x0020
 
@@ -433,9 +422,9 @@ typedef void (*wxFunction) (wxObject&, wxEvent&);
  * wxComboBox style flags
  */
 #define wxCB_SIMPLE         0x0004
  * wxComboBox style flags
  */
 #define wxCB_SIMPLE         0x0004
-#define wxCB_DROPDOWN       0x0000
 #define wxCB_SORT           0x0008
 #define wxCB_SORT           0x0008
-#define wxCB_READONLY       wxREADONLY
+#define wxCB_READONLY       0x0010
+#define wxCB_DROPDOWN       0x0020
 
 /*
  * wxRadioBox/wxRadioButton style flags
 
 /*
  * wxRadioBox/wxRadioButton style flags
index e0dde6b58b0ddbbadcf32367966987c178aedcb5..ba988b1022563703d8233da086116fa354e5356d 100644 (file)
@@ -121,6 +121,8 @@ public:
   inline WXHWND *GetRadioButtons(void) const { return m_radioButtons; }
   bool ContainsHWND(WXHWND hWnd) const ;
 
   inline WXHWND *GetRadioButtons(void) const { return m_radioButtons; }
   bool ContainsHWND(WXHWND hWnd) const ;
 
+  long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+
 protected:
   WXHWND *          m_radioButtons;
   int               m_majorDim ;
 protected:
   WXHWND *          m_radioButtons;
   int               m_majorDim ;
index 8f1a4481845fe70bf3ffd9fe2b98f1ea4f2e5389..ab9cceda58f7cdf25545440b44a57c6a87afb110 100644 (file)
@@ -1790,8 +1790,6 @@ static wxResourceBitListStruct wxResourceBitListTable[] =
   { "wxLB_SINGLE", wxLB_SINGLE },
   { "wxLB_MULTIPLE", wxLB_MULTIPLE },
   { "wxLB_EXTENDED", wxLB_EXTENDED },
   { "wxLB_SINGLE", wxLB_SINGLE },
   { "wxLB_MULTIPLE", wxLB_MULTIPLE },
   { "wxLB_EXTENDED", wxLB_EXTENDED },
-  { "wxNEEDED_SB", wxNEEDED_SB },
-  { "wxALWAYS_SB", wxALWAYS_SB },
   { "wxLB_NEEDED_SB", wxLB_NEEDED_SB },
   { "wxLB_ALWAYS_SB", wxLB_ALWAYS_SB },
   { "wxLB_SORT", wxLB_SORT },
   { "wxLB_NEEDED_SB", wxLB_NEEDED_SB },
   { "wxLB_ALWAYS_SB", wxLB_ALWAYS_SB },
   { "wxLB_SORT", wxLB_SORT },
@@ -1918,8 +1916,6 @@ static wxResourceBitListStruct wxResourceBitListTable[] =
   { "wxDEFAULT_DIALOG_STYLE", wxDEFAULT_DIALOG_STYLE},
   { "wxBORDER", wxBORDER},
   { "wxRETAINED", wxRETAINED},
   { "wxDEFAULT_DIALOG_STYLE", wxDEFAULT_DIALOG_STYLE},
   { "wxBORDER", wxBORDER},
   { "wxRETAINED", wxRETAINED},
-  { "wxEDITABLE", wxEDITABLE},
-  { "wxREADONLY", wxREADONLY},
   { "wxNATIVE_IMPL", 0},
   { "wxEXTENDED_IMPL", 0},
   { "wxBACKINGSTORE", wxBACKINGSTORE},
   { "wxNATIVE_IMPL", 0},
   { "wxEXTENDED_IMPL", 0},
   { "wxBACKINGSTORE", wxBACKINGSTORE},
index 1c1b95c7c375d82aadf9083d8436e0ed8c9d8168..af8a1e72fee4cc76b4bfd55104ca6b30a7d0ebc3 100644 (file)
@@ -82,9 +82,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
   // Subclass again for purposes of dialog editing mode
   SubclassWin((WXHWND)wx_button);
 
   // Subclass again for purposes of dialog editing mode
   SubclassWin((WXHWND)wx_button);
 
-  // TODO? If in future we have a facility for having a label as well
-  // as a bitmap, set the font.
-//  SetFont(parent->GetFont()) ;
+  SetFont(* parent->GetFont()) ;
 
   SetSize(x, y, width, height);
   ShowWindow(wx_button, SW_SHOW);
 
   SetSize(x, y, width, height);
   ShowWindow(wx_button, SW_SHOW);
index 2945076d06597fdb53d1a98224d17e05632c3c1b..61119e6b67b43a9e8f3388d82ec3045e7418be12 100644 (file)
@@ -245,8 +245,8 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
   }
 
   // If non-default width...
   }
 
   // If non-default width...
-  if (width >= 0)
-    control_width = (float)width;
+  if (w1 >= 0)
+    control_width = (float)w1;
 
   control_height = (float)h1;
 
 
   control_height = (float)h1;
 
index 22090f64c04280d15d1ba3c66b248b5d668eee09..76c80cad360f9ce630fc5ed18e52ce910b2121dc 100644 (file)
@@ -74,9 +74,12 @@ void wxControl::SetLabel(const wxString& label)
 
 wxString wxControl::GetLabel(void) const
 {
 
 wxString wxControl::GetLabel(void) const
 {
-  wxBuffer[0] = 0;
-  if (GetHWND())
-    GetWindowText((HWND)GetHWND(), wxBuffer, 1000);
+    wxBuffer[0] = 0;
+    if (GetHWND())
+    {
+        int len = GetWindowText((HWND)GetHWND(), wxBuffer, 256);
+        wxBuffer[len] = 0;
+    }
 
   return wxString(wxBuffer);
 }
 
   return wxString(wxBuffer);
 }
index 285d0581c113830cb5f8eed6ff3ca6e80a30397b..d0ddf67099cf00ac5072b8c1fd02ab3e37b13475 100644 (file)
@@ -50,6 +50,7 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id,
 
   if (parent) parent->AddChild(this);
   m_rangeMax = range;
 
   if (parent) parent->AddChild(this);
   m_rangeMax = range;
+  m_gaugePos = 0;
 
   SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
   SetForegroundColour(parent->GetDefaultForegroundColour()) ;
 
   SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
   SetForegroundColour(parent->GetDefaultForegroundColour()) ;
index 38f5192969c3573b3501dfff3304239ccda06030..1df35a9e9c19518c359851731c72b683b798ed02 100644 (file)
@@ -85,6 +85,7 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id,
 
   if (parent) parent->AddChild(this);
   m_rangeMax = range;
 
   if (parent) parent->AddChild(this);
   m_rangeMax = range;
+  m_gaugePos = 0;
 
   SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
   SetForegroundColour(parent->GetDefaultForegroundColour()) ;
 
   SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
   SetForegroundColour(parent->GetDefaultForegroundColour()) ;
index 883951314d80c3a7c2f5d7647229a3898fd97a4a..2197868d25ae47a79fe9b02947d1074725bd26a9 100644 (file)
@@ -154,6 +154,10 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
 
   SubclassWin(GetHWND());
 
 
   SubclassWin(GetHWND());
 
+  SetWindowText((HWND) m_hWnd, "");
+
+  SetFont(* parent->GetFont());
+
   if ( m_windowStyle & wxSL_LABELS )
   {
       // Finally, create max value static item
   if ( m_windowStyle & wxSL_LABELS )
   {
       // Finally, create max value static item
@@ -163,7 +167,6 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
                              0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
                              wxGetInstance(), NULL);
 
                              0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
                              wxGetInstance(), NULL);
 
-      SetFont(parent->GetFont());
 
       if (GetFont())
       {
 
       if (GetFont())
       {
@@ -418,6 +421,11 @@ void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags)
        else
        {
                // No labels
        else
        {
                // No labels
+               // If we're prepared to use the existing size, then...
+               if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
+               {
+                       GetSize(&w1, &h1);
+               }
                if ( w1 < 0 )
                        w1 = 200;
                if ( h1 < 0 )
                if ( w1 < 0 )
                        w1 = 200;
                if ( h1 < 0 )
@@ -479,6 +487,11 @@ void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags)
        else
        {
                // No labels
        else
        {
                // No labels
+               // If we're prepared to use the existing size, then...
+               if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
+               {
+                       GetSize(&w1, &h1);
+               }
                if ( w1 < 0 )
                        w1 = 20;
                if ( h1 < 0 )
                if ( w1 < 0 )
                        w1 = 20;
                if ( h1 < 0 )
index 943b95b7f5aad2e16676bd7cfe932b24bb6d6514..5685792efe0a746234293661b7438bf45f8efc13 100644 (file)
@@ -77,6 +77,9 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
 
   // Subclass again for purposes of dialog editing mode
   SubclassWin((WXHWND) static_item);
 
   // Subclass again for purposes of dialog editing mode
   SubclassWin((WXHWND) static_item);
+
+  SetFont(* GetParent()->GetFont());
+
   SetSize(x, y, width, height);
   return TRUE;
 }
   SetSize(x, y, width, height);
   return TRUE;
 }
index b99a5a9bee1d5488df0b2208097d858f2bcdf151..15bbd1c5f787d36a8a180d3c0a1873c0d85420b6 100644 (file)
@@ -213,20 +213,6 @@ void wxStaticBox::OnEraseBackground(wxEraseEvent& event)
 
 long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
 {
 
 long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
 {
-       // TODO: somehow, this has to accept mouse clicks in user interface edit mode,
-       // but not otherwise. Only there is no longer a UI edit mode...
-
-       // It worked before because the message could be processed if not in UI
-       // edit mode. We have to find some way of distinguishing this.
-       // Maybe this class can have an AcceptMouseEvents(bool) function; a sort of
-       // kludge... or, we can search for an active event table entry that will
-       // intercept mouse events, and if one exists (that isn't the default),
-       // skip the code below. Too time consuming though.
-       // Perhaps it's ok to do the default thing *anyway* because the title or edge
-       // of the window may still be active!
-//     if (nMsg == WM_NCHITTEST)
-//            return Default();
-
        if (nMsg == WM_NCHITTEST)
     {
         int xPos = LOWORD(lParam);  // horizontal position of cursor
        if (nMsg == WM_NCHITTEST)
     {
         int xPos = LOWORD(lParam);  // horizontal position of cursor
index da08a1f589d63ba49fbea90f7641f6b0ea21a3f8..ae7e5768386994110c762d688e186e8b57253864 100644 (file)
@@ -169,6 +169,9 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
         case RESED_CHOICE:
           resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y);
           break;
         case RESED_CHOICE:
           resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y);
           break;
+        case RESED_COMBOBOX:
+          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxComboBox", x, y);
+          break;
         case RESED_CHECKBOX:
           resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxCheckBox", x, y);
           break;
         case RESED_CHECKBOX:
           resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxCheckBox", x, y);
           break;
@@ -204,111 +207,6 @@ void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
   }
 }
 
   }
 }
 
-#if 0
-void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys)
-{
-  if (keys & wxKEY_CTRL)
-  {
-    wxResourceManager::GetCurrentResourceManager()->EditWindow(handlerDialog);
-    return;
-  }
-
-  // Deselect all items if click on panel
-  if (resourceManager->GetEditorPalette()->currentlySelected == PALETTE_ARROW)
-  {
-    int needsRefresh = 0;
-    wxNode *node = handlerDialog->GetChildren()->First();
-    while (node)
-    {
-      wxControl *item = (wxControl *)node->Data();
-         wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
-      if (item->IsKindOf(CLASSINFO(wxControl)) && childHandler->IsSelected())
-      {
-        needsRefresh ++;
-        OnItemSelect(item, FALSE);
-        childHandler->SelectItem(FALSE);
-      }
-      node = node->Next();
-    }
-    if (needsRefresh > 0)
-    {
-         wxClientDC dc(handlerDialog);
-      dc.Clear();
-      handlerDialog->Refresh();
-    }
-    return;
-  }
-
-  wxResourceManager* manager = resourceManager;
-
-  switch (resourceManager->GetEditorPalette()->currentlySelected)
-  {
-        case PALETTE_FRAME:
-          break;
-        case PALETTE_DIALOG_BOX:
-          break;
-        case PALETTE_PANEL:
-          break;
-        case PALETTE_CANVAS:
-          break;
-        case PALETTE_TEXT_WINDOW:
-          break;
-        case PALETTE_BUTTON:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y);
-          break;
-        case PALETTE_BITMAP_BUTTON:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y, TRUE);
-          break;
-        case PALETTE_MESSAGE:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticText", x, y);
-          break;
-        case PALETTE_BITMAP_MESSAGE:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBitmap", x, y, TRUE);
-          break;
-        case PALETTE_TEXT:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (single-line)", x, y);
-          break;
-        case PALETTE_MULTITEXT:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxTextCtrl (multi-line)", x, y);
-          break;
-        case PALETTE_CHOICE:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y);
-          break;
-        case PALETTE_CHECKBOX:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxCheckBox", x, y);
-          break;
-        case PALETTE_RADIOBOX:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxRadioBox", x, y);
-          break;
-        case PALETTE_LISTBOX:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxListBox", x, y);
-          break;
-        case PALETTE_SLIDER:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxSlider", x, y);
-          break;
-        case PALETTE_GAUGE:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxGauge", x, y);
-          break;
-        case PALETTE_GROUPBOX:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBox", x, y);
-          break;
-        case PALETTE_SCROLLBAR:
-          resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxScrollBar", x, y);
-          break;
-        default:
-          break;
-  }
-
-  // Now switch pointer on.
-  if (manager->GetEditorPalette()->currentlySelected != PALETTE_ARROW)
-  {
-    manager->GetEditorPalette()->ToggleTool(manager->GetEditorPalette()->currentlySelected, FALSE);
-    manager->GetEditorPalette()->ToggleTool(PALETTE_ARROW, TRUE);
-    manager->GetEditorPalette()->currentlySelected = PALETTE_ARROW;
-  }
-}
-#endif
-
 void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int keys)
 {
   wxMenu *menu = resourceManager->GetPopupMenu();
 void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int keys)
 {
   wxMenu *menu = resourceManager->GetPopupMenu();
index ab4ff916019ad2c6c189207606f0a0e0f2383114..2c28ca05602812a4d5202bb9f9e17094e325cdce 100644 (file)
@@ -993,17 +993,17 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
   else if (itemType == "wxMessage" || itemType == "wxStaticText")
     {
       prefix = "ID_STATIC";
   else if (itemType == "wxMessage" || itemType == "wxStaticText")
     {
       prefix = "ID_STATIC";
-      MakeUniqueName("message", buf);
+      MakeUniqueName("statictext", buf);
       res->SetName(buf);
       if (isBitmap)
         newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(0, 0), 0, buf);
       else
       res->SetName(buf);
       if (isBitmap)
         newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(0, 0), 0, buf);
       else
-        newItem = new wxStaticText(panel, -1, "Message", wxPoint(x, y), wxSize(-1, -1), 0, buf);
+        newItem = new wxStaticText(panel, -1, "Static", wxPoint(x, y), wxSize(-1, -1), 0, buf);
     }
   else if (itemType == "wxStaticBitmap")
     {
       prefix = "ID_STATICBITMAP";
     }
   else if (itemType == "wxStaticBitmap")
     {
       prefix = "ID_STATICBITMAP";
-      MakeUniqueName("message", buf);
+      MakeUniqueName("static", buf);
       res->SetName(buf);
       newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, buf);
     }
       res->SetName(buf);
       newItem = new wxStaticBitmap(panel, -1, m_bitmapImage, wxPoint(x, y), wxSize(-1, -1), 0, buf);
     }
@@ -1047,12 +1047,19 @@ bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *
       res->SetName(buf);
       newItem = new wxChoice(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf);
     }
       res->SetName(buf);
       newItem = new wxChoice(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf);
     }
+  else if (itemType == "wxComboBox")
+    {
+      prefix = "ID_COMBOBOX";
+      MakeUniqueName("combobox", buf);
+      res->SetName(buf);
+      newItem = new wxComboBox(panel, -1, "", wxPoint(x, y), wxSize(-1, -1), 0, NULL, wxCB_DROPDOWN, wxDefaultValidator, buf);
+    }
   else if (itemType == "wxGroupBox" || itemType == "wxStaticBox")
     {
       prefix = "ID_STATICBOX";
   else if (itemType == "wxGroupBox" || itemType == "wxStaticBox")
     {
       prefix = "ID_STATICBOX";
-      MakeUniqueName("group", buf);
+      MakeUniqueName("staticbox", buf);
       res->SetName(buf);
       res->SetName(buf);
-      newItem = new wxStaticBox(panel, -1, "Groupbox", wxPoint(x, y), wxSize(200, 200), 0, buf);
+      newItem = new wxStaticBox(panel, -1, "Static", wxPoint(x, y), wxSize(200, 200), 0, buf);
     }
   else if (itemType == "wxGauge")
     {
     }
   else if (itemType == "wxGauge")
     {
@@ -1702,8 +1709,12 @@ wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowP
   else
   {
     DisassociateResource(resource);
   else
   {
     DisassociateResource(resource);
+    if (win->GetEventHandler() != win)
+        win->PopEventHandler(TRUE);
+
     DeleteWindow(win);
     newWin = m_resourceTable.CreateItem((wxPanel *)parent, resource);
     DeleteWindow(win);
     newWin = m_resourceTable.CreateItem((wxPanel *)parent, resource);
+    newWin->PushEventHandler(new wxResourceEditorControlHandler((wxControl*) newWin, (wxControl*) newWin));
     AssociateResource(resource, newWin);
     UpdateResourceList();
   }
     AssociateResource(resource, newWin);
     UpdateResourceList();
   }
@@ -1860,6 +1871,10 @@ wxWindowPropertyInfo *wxResourceManager::CreatePropertyInfoForWindow(wxWindow *w
         {
           info = new wxChoicePropertyInfo(win);
         }
         {
           info = new wxChoicePropertyInfo(win);
         }
+  else if (win->IsKindOf(CLASSINFO(wxComboBox)))
+        {
+          info = new wxComboBoxPropertyInfo(win);
+        }
   else if (win->IsKindOf(CLASSINFO(wxButton)))
         {
           info = new wxButtonPropertyInfo(win);
   else if (win->IsKindOf(CLASSINFO(wxButton)))
         {
           info = new wxButtonPropertyInfo(win);
index 79084eb22738ac6855867bb19076d3d2978eeaac..dec8278fa800117da6cb4f0fab9b12225eed8177 100644 (file)
@@ -214,7 +214,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
   else if (itemType == "wxStaticBox")
     {
       GenerateControlStyleString(itemType, item->GetStyle(), styleBuf);
   else if (itemType == "wxStaticBox")
     {
       GenerateControlStyleString(itemType, item->GetStyle(), styleBuf);
-      stream << item->GetId() << ", " << "wxGroupBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
+      stream << item->GetId() << ", " << "wxStaticBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', ";
       stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
       stream << item->GetWidth() << ", " << item->GetHeight();
       if (item->GetFont())
       stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", ";
       stream << item->GetWidth() << ", " << item->GetHeight();
       if (item->GetFont())
@@ -329,7 +329,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
       stream << item->GetWidth() << ", " << item->GetHeight();
 
       if (itemType == "wxComboBox")
       stream << item->GetWidth() << ", " << item->GetHeight();
 
       if (itemType == "wxComboBox")
-        stream << SafeWord(item->GetValue4()) << ", ";
+        stream << ", " << SafeWord(item->GetValue4());
 
       // Default list of values
 
 
       // Default list of values
 
@@ -509,6 +509,12 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it
       }
       stream << ").\";\n\n";
     }
       }
       stream << ").\";\n\n";
     }
+    else
+    {
+        wxString str("Unimplemented resource type: ");
+        str += itemType;
+        wxMessageBox(str);
+    }
   return TRUE;
 }
 
   return TRUE;
 }
 
index 12ae6b0df4f3844412819362f9878f0054ba9899..d8b34a18acf5201cf9d9a170c478127addf06ac6 100644 (file)
@@ -516,7 +516,7 @@ void wxWindowPropertyInfo::GetPropertyNames(wxStringList& names)
 // Fill in the wxItemResource members to mirror the current window settings
 bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
 // Fill in the wxItemResource members to mirror the current window settings
 bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource)
 {
-  resource->SetType(propertyWindow->GetClassInfo()->GetClassName());
+//  resource->SetType(propertyWindow->GetClassInfo()->GetClassName());
   
 //  resource->SetStyle(propertyWindow->GetWindowStyleFlag());
   wxString str(propertyWindow->GetName());
   
 //  resource->SetStyle(propertyWindow->GetWindowStyleFlag());
   wxString str(propertyWindow->GetName());
@@ -1085,6 +1085,125 @@ bool wxChoicePropertyInfo::InstantiateResource(wxItemResource *resource)
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
 
   return wxItemPropertyInfo::InstantiateResource(resource);
 }
 
+/*
+ * Choice item
+ */
+
+wxProperty *wxComboBoxPropertyInfo::GetProperty(wxString& name)
+{
+  wxComboBox *choice = (wxComboBox *)propertyWindow;
+  if (name == "values")
+  {
+    wxStringList *stringList = new wxStringList;
+    int i;
+    for (i = 0; i < choice->Number(); i++)
+      stringList->Add(choice->GetString(i));
+
+    return new wxProperty(name, stringList, "stringlist");
+  }
+  else if (name == "sort")
+  {
+    bool sort = ((propertyWindow->GetWindowStyleFlag() & wxCB_SORT) == wxCB_SORT);
+    return new wxProperty(name, sort, "bool");
+  }
+  else if (name == "style")
+  {
+    wxString styleStr("dropdown");
+    if (propertyWindow->GetWindowStyleFlag() & wxCB_SIMPLE)
+      styleStr = "simple";
+    else if (propertyWindow->GetWindowStyleFlag() & wxCB_READONLY)
+      styleStr = "readonly";
+    else
+      styleStr = "dropdown";
+
+    return new wxProperty(name, styleStr, "string",
+       new wxStringListValidator(new wxStringList("simple", "dropdown", "readonly",
+          NULL)));
+  }
+  else
+    return wxItemPropertyInfo::GetProperty(name);
+}
+
+bool wxComboBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
+{
+  wxComboBox *choice = (wxComboBox *)propertyWindow;
+  if (name == "values")
+  {
+    choice->Clear();
+    wxPropertyValue *expr = property->GetValue().GetFirst();
+    while (expr)
+    {
+      char *s = expr->StringValue();
+      if (s)
+        choice->Append(s);
+      expr = expr->GetNext();
+    }
+    if (choice->Number() > 0)
+      choice->SetSelection(0);
+    return TRUE;
+  }
+  else if (name == "sort")
+  {
+    SetWindowStyle(propertyWindow, wxCB_SORT, property->GetValue().BoolValue());
+
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
+    resource->SetStyle(propertyWindow->GetWindowStyleFlag());
+
+    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(propertyWindow, this);
+    return TRUE;
+  }
+  else if (name == "style")
+  {
+    SetWindowStyle(propertyWindow, wxCB_SIMPLE, FALSE);
+    SetWindowStyle(propertyWindow, wxCB_DROPDOWN, FALSE);
+    SetWindowStyle(propertyWindow, wxCB_READONLY, FALSE);
+
+    wxString styleStr(property->GetValue().StringValue());
+    if (styleStr == "simple")
+      SetWindowStyle(propertyWindow, wxCB_SIMPLE, TRUE);
+    else if (styleStr == "dropdown")
+      SetWindowStyle(propertyWindow, wxCB_DROPDOWN, TRUE);
+    else if (styleStr == "readonly")
+      SetWindowStyle(propertyWindow, wxCB_READONLY, TRUE);
+
+      // Necesary?
+    wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
+    resource->SetStyle(propertyWindow->GetWindowStyleFlag());
+
+    wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(propertyWindow, this);
+
+    return TRUE;
+  }
+  else
+    return wxItemPropertyInfo::SetProperty(name, property);
+}
+
+void wxComboBoxPropertyInfo::GetPropertyNames(wxStringList& names)
+{
+  wxItemPropertyInfo::GetPropertyNames(names);
+  names.Add("values");
+  names.Add("style");
+  names.Add("sort");
+}
+
+bool wxComboBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
+{
+  wxComboBox *choice = (wxComboBox *)propertyWindow;
+  int i;
+  if (choice->Number() == 0)
+    resource->SetStringValues(NULL);
+  else
+  {
+    wxStringList *slist = new wxStringList;
+    
+    for (i = 0; i < choice->Number(); i++)
+      slist->Add(choice->GetString(i));
+      
+    resource->SetStringValues(slist);
+  }
+  return wxItemPropertyInfo::InstantiateResource(resource);
+}
+
 /*
  * Radiobox item
  */
 /*
  * Radiobox item
  */
@@ -1338,10 +1457,10 @@ wxProperty *wxSliderPropertyInfo::GetProperty(wxString& name)
        new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL",
           NULL)));
   }
        new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL",
           NULL)));
   }
-  else if (name == "min_value")
-    return new wxProperty("min_value", (long)slider->GetMin(), "integer");
-  else if (name == "max_value")
-    return new wxProperty("max_value", (long)slider->GetMax(), "integer");
+  else if (name == "minValue")
+    return new wxProperty("minValue", (long)slider->GetMin(), "integer");
+  else if (name == "maxValue")
+    return new wxProperty("maxValue", (long)slider->GetMax(), "integer");
   else
     return wxItemPropertyInfo::GetProperty(name);
 }
   else
     return wxItemPropertyInfo::GetProperty(name);
 }
@@ -1386,12 +1505,12 @@ bool wxSliderPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     
     return TRUE;
   }
     
     return TRUE;
   }
-  else if (name == "min_value")
+  else if (name == "minValue")
   {
     slider->SetRange((int)property->GetValue().IntegerValue(), slider->GetMax());
     return TRUE;
   }
   {
     slider->SetRange((int)property->GetValue().IntegerValue(), slider->GetMax());
     return TRUE;
   }
-  else if (name == "max_value")
+  else if (name == "maxValue")
   {
     slider->SetRange(slider->GetMin(), (int)property->GetValue().IntegerValue());
     return TRUE;
   {
     slider->SetRange(slider->GetMin(), (int)property->GetValue().IntegerValue());
     return TRUE;
@@ -1405,8 +1524,8 @@ void wxSliderPropertyInfo::GetPropertyNames(wxStringList& names)
   wxItemPropertyInfo::GetPropertyNames(names);
   names.Add("value");
   names.Add("orientation");
   wxItemPropertyInfo::GetPropertyNames(names);
   names.Add("value");
   names.Add("orientation");
-  names.Add("min_value");
-  names.Add("max_value");
+  names.Add("minValue");
+  names.Add("maxValue");
 }
 
 bool wxSliderPropertyInfo::InstantiateResource(wxItemResource *resource)
 }
 
 bool wxSliderPropertyInfo::InstantiateResource(wxItemResource *resource)
@@ -1427,8 +1546,8 @@ wxProperty *wxGaugePropertyInfo::GetProperty(wxString& name)
   wxGauge *gauge = (wxGauge *)propertyWindow;
   if (name == "value")
     return new wxProperty("value", (long)gauge->GetValue(), "integer");
   wxGauge *gauge = (wxGauge *)propertyWindow;
   if (name == "value")
     return new wxProperty("value", (long)gauge->GetValue(), "integer");
-  else if (name == "max_value")
-    return new wxProperty("max_value", (long)gauge->GetRange(), "integer");
+  else if (name == "maxValue")
+    return new wxProperty("maxValue", (long)gauge->GetRange(), "integer");
   else
     return wxItemPropertyInfo::GetProperty(name);
 }
   else
     return wxItemPropertyInfo::GetProperty(name);
 }
@@ -1441,7 +1560,7 @@ bool wxGaugePropertyInfo::SetProperty(wxString& name, wxProperty *property)
     gauge->SetValue((int)property->GetValue().IntegerValue());
     return TRUE;
   }
     gauge->SetValue((int)property->GetValue().IntegerValue());
     return TRUE;
   }
-  else if (name == "max_value")
+  else if (name == "maxValue")
   {
     gauge->SetRange((int)property->GetValue().IntegerValue());
     return TRUE;
   {
     gauge->SetRange((int)property->GetValue().IntegerValue());
     return TRUE;
@@ -1454,7 +1573,7 @@ void wxGaugePropertyInfo::GetPropertyNames(wxStringList& names)
 {
   wxItemPropertyInfo::GetPropertyNames(names);
   names.Add("value");
 {
   wxItemPropertyInfo::GetPropertyNames(names);
   names.Add("value");
-  names.Add("max_value");
+  names.Add("maxValue");
 }
 
 bool wxGaugePropertyInfo::InstantiateResource(wxItemResource *resource)
 }
 
 bool wxGaugePropertyInfo::InstantiateResource(wxItemResource *resource)
index 1cca46cf7b053c529dfca85c8d38300d117ef622..8b4032a8a08215c7dfcdb2f91c2585e7d48292f3 100644 (file)
@@ -214,6 +214,20 @@ class wxChoicePropertyInfo: public wxItemPropertyInfo
   bool InstantiateResource(wxItemResource *resource);
 };
 
   bool InstantiateResource(wxItemResource *resource);
 };
 
+// For choice items
+class wxComboBoxPropertyInfo: public wxChoicePropertyInfo
+{
+ protected:
+ public:
+  wxComboBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
+    wxChoicePropertyInfo(win, res) {}
+  ~wxComboBoxPropertyInfo(void) {}
+  wxProperty *GetProperty(wxString& name);
+  bool SetProperty(wxString& name, wxProperty *property);
+  void GetPropertyNames(wxStringList& names);
+  bool InstantiateResource(wxItemResource *resource);
+};
+
 // For radiobox items
 class wxRadioBoxPropertyInfo: public wxItemPropertyInfo
 {
 // For radiobox items
 class wxRadioBoxPropertyInfo: public wxItemPropertyInfo
 {
index de568dd4d1494640bce57f6fec119d464daf76a8..efc4fad4a1befd33a4c2765dd62da237ec61c9a7 100644 (file)
@@ -248,10 +248,12 @@ static wxWindowStylePair g_WindowStylesWindow[] = {
   { "wxSTATIC_BORDER", wxSTATIC_BORDER},
   { "wxTRANSPARENT_WINDOW", wxTRANSPARENT_WINDOW},
   { "wxNO_BORDER", wxNO_BORDER},
   { "wxSTATIC_BORDER", wxSTATIC_BORDER},
   { "wxTRANSPARENT_WINDOW", wxTRANSPARENT_WINDOW},
   { "wxNO_BORDER", wxNO_BORDER},
-  { "wxCLIP_CHILDREN", wxCLIP_CHILDREN},
-  { "wxRETAINED", wxRETAINED},
+  { "wxCLIP_CHILDREN", wxCLIP_CHILDREN}
+
+/* Would be duplicated with e.g. wxLB_HSCROLL
   { "wxVSCROLL", wxVSCROLL },
   { "wxHSCROLL", wxHSCROLL }
   { "wxVSCROLL", wxVSCROLL },
   { "wxHSCROLL", wxHSCROLL }
+*/
 };
 
 int g_WindowStylesWindowCount = sizeof(g_WindowStylesWindow)/sizeof(wxWindowStylePair) ;
 };
 
 int g_WindowStylesWindowCount = sizeof(g_WindowStylesWindow)/sizeof(wxWindowStylePair) ;