]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/utils/wxrcedit/prophnd.cpp
added AddWindowStyles
[wxWidgets.git] / contrib / utils / wxrcedit / prophnd.cpp
index 24e8bb51894c342d68d9a752b5d926bd039a632d..e20288614a1de16fb33d17254ac9bdb548d065cf 100644 (file)
@@ -24,6 +24,7 @@
 #include "wx/valtext.h"
 #include "wx/tokenzr.h"
 #include "wx/checklst.h"
+#include "wx/listctrl.h"
 #include "xmlhelpr.h"
 #include "editor.h"
 
@@ -210,6 +211,66 @@ wxPanel *CoordPropertyHandler::CreateEditPanel(wxWindow *parent, PropsListInfo *
 
 
 
+class DimensionPropPanel : public PropertyPanel
+{
+    public:
+        DimensionPropPanel(wxWindow *parent, PropertyHandler *hnd, PropsListInfo *pli) : PropertyPanel(parent, hnd, pli)
+        {    
+            wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+            m_ed1 = NULL; m_chb = NULL;
+    
+            sizer->Add(new wxStaticText(this, -1, _("Value:")), 0, wxLEFT, 5);
+            sizer->Add(m_ed1 = new wxTextCtrl(this, ID_XEDIT, "",
+                                 wxDefaultPosition, wxDefaultSize, 0,
+                                 wxTextValidator(wxFILTER_NUMERIC)),
+                    0, wxEXPAND, 5);
+            m_ed1->SetFocus();
+    
+            sizer->Add(m_chb = new wxCheckBox(this, ID_USEDLG, _("Use dialog units")), 0, wxLEFT|wxTOP, 5);
+    
+            SetAutoLayout(TRUE);
+            SetSizer(sizer);
+            Layout();
+            
+            wxString val = XmlReadValue(pli->m_Node, pli->m_PropInfo->Name);
+            m_chb->SetValue(val.Len()>0 && val[val.Len()-1] == 'd');
+            m_ed1->SetValue(val.BeforeFirst('d'));
+        }
+        
+        void OnEdit(wxCommandEvent &event)
+        {
+            wxString val;
+            
+            if (m_ed1 == NULL || m_chb == NULL) return;
+            
+            val = m_ed1->GetValue();
+            if (val.IsEmpty()) return;
+            if (m_chb->GetValue()) val << 'd';
+            Update(val);
+        }
+        
+        wxTextCtrl *m_ed1;
+        wxCheckBox *m_chb;
+        
+        DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE(DimensionPropPanel, PropertyPanel)
+    EVT_TEXT(ID_XEDIT, DimensionPropPanel::OnEdit)
+    EVT_TEXT(ID_YEDIT, DimensionPropPanel::OnEdit)
+    EVT_CHECKBOX(ID_USEDLG, DimensionPropPanel::OnEdit)
+END_EVENT_TABLE()
+
+wxPanel *DimensionPropertyHandler::CreateEditPanel(wxWindow *parent, PropsListInfo *pli)
+{
+    return new DimensionPropPanel(parent, this, pli);
+}
+
+
+
+
+
+
 
 class BoolPropPanel : public PropertyPanel
 {
@@ -330,3 +391,17 @@ wxPanel *FlagsPropertyHandler::CreateEditPanel(wxWindow *parent, PropsListInfo *
 {
     return new FlagsPropPanel(parent, this, pli);
 }
+
+
+
+
+wxPanel *NotImplPropertyHandler::CreateEditPanel(wxWindow *parent, PropsListInfo *pli)
+{
+    wxPanel *p = new wxPanel(parent);
+    wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+    sizer->Add(new wxStaticText(p, -1, _("Sorry, this is not supported.\nYou have to edit XML code directly.")), 1, wxEXPAND|wxALL, 5);
+    p->SetAutoLayout(TRUE);
+    p->SetSizer(sizer);
+    p->Layout();
+    return p;
+}