added wxXmlResourceHandler::GetDimension for 1D values that may be in dialog units
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8111 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -5,6 +5,6 @@ childtype sizer_item
|
||||
derived from panel_item
|
||||
var rows of integer
|
||||
var cols of integer
|
||||
var vgap of integer
|
||||
var hgap of integer
|
||||
var vgap of dimension
|
||||
var hgap of dimension
|
||||
var minsize of coord
|
||||
|
@@ -2,6 +2,6 @@ node gauge
|
||||
var style of flags wxGA_HORIZONTAL,wxGA_VERTICAL,wxGA_PROGRESSBAR,wxGA_SMOOTH
|
||||
var range of integer
|
||||
var value of integer
|
||||
var shadow of integer
|
||||
var bezel of integer
|
||||
var shadow of dimension
|
||||
var bezel of dimension
|
||||
derived from control
|
||||
|
@@ -5,6 +5,6 @@ childtype sizer_item
|
||||
derived from panel_item
|
||||
var rows of integer
|
||||
var cols of integer
|
||||
var vgap of integer
|
||||
var hgap of integer
|
||||
var vgap of dimension
|
||||
var hgap of dimension
|
||||
var minsize of coord
|
||||
|
@@ -1,6 +1,6 @@
|
||||
node htmlwindow
|
||||
var url of text
|
||||
var htmlcode of text
|
||||
var borders of integer
|
||||
var borders of dimension
|
||||
var style of flags wxHW_SCROLLBAR_NEVER,wxHW_SCROLLBAR_AUTO
|
||||
derived from control
|
||||
|
@@ -6,4 +6,4 @@ var help of text
|
||||
var checkable of bool
|
||||
var checked of bool
|
||||
var enabled of bool
|
||||
derived from menu_item
|
||||
derived from menu_item
|
||||
|
7
contrib/utils/wxrcedit/df/radiobox.df
Normal file
7
contrib/utils/wxrcedit/df/radiobox.df
Normal file
@@ -0,0 +1,7 @@
|
||||
node radiobox
|
||||
var style of flags wxRA_SPECIFY_COLS,wxRA_HORIZONTAL,wxRA_SPECIFY_ROWS,wxRA_VERTICAL
|
||||
var label of text
|
||||
var dimension of integer
|
||||
var selection of integer
|
||||
var content of not_implemented
|
||||
derived from control
|
@@ -5,5 +5,5 @@ node sizeritem
|
||||
type sizeritem
|
||||
var option of integer
|
||||
var flag of flags wxEXPAND,wxALL,wxLEFT,wxRIGHT,wxTOP,wxBOTTOM,wxALIGN_CENTER,wxALIGN_LEFT,wxALIGN_TOP,wxALIGN_RIGHT,wxALIGN_BOTTOM,wxALIGN_CENTER_HORIZONTAL,wxALIGN_CENTER_VERTICAL,wxNORTH,wxSOUTH,wxEAST,wxWEST,wxGROW,wxSHAPED,wxSTRETCH_NOT
|
||||
var border of integer
|
||||
var border of dimension
|
||||
var minsize of coord
|
||||
|
@@ -5,6 +5,6 @@ node spacer
|
||||
type normal
|
||||
var option of integer
|
||||
var flag of flags wxEXPAND,wxALL,wxLEFT,wxRIGHT,wxTOP,wxBOTTOM,wxALIGN_CENTER,wxALIGN_LEFT,wxALIGN_TOP,wxALIGN_RIGHT,wxALIGN_BOTTOM,wxALIGN_CENTER_HORIZONTAL,wxALIGN_CENTER_VERTICAL,wxNORTH,wxSOUTH,wxEAST,wxWEST,wxGROW,wxSHAPED,wxSTRETCH_NOT
|
||||
var border of integer
|
||||
var border of dimension
|
||||
var size of coord
|
||||
derived from sizer_item
|
||||
|
@@ -102,11 +102,14 @@ void NodeInfo::Read(const wxString& filename)
|
||||
tkn.GetNextToken();
|
||||
wxString typ = tkn.GetNextToken();
|
||||
if (tkn.HasMoreTokens()) pi.MoreInfo = tkn.GetNextToken();
|
||||
/* ADD NEW PROPERTY TYPES HERE
|
||||
(search for other occurences of this comment in _all_ files) */
|
||||
if (typ == "color") pi.Type = PROP_COLOR;
|
||||
else if (typ == "flags") pi.Type = PROP_FLAGS;
|
||||
else if (typ == "bool") pi.Type = PROP_BOOL;
|
||||
else if (typ == "integer") pi.Type = PROP_INTEGER;
|
||||
else if (typ == "coord") pi.Type = PROP_COORD;
|
||||
else if (typ == "dimension") pi.Type = PROP_DIMENSION;
|
||||
else if (typ == "not_implemented") pi.Type = PROP_NOT_IMPLEMENTED;
|
||||
else /*if (typ == "text")*/ pi.Type = PROP_TEXT;
|
||||
|
||||
@@ -195,12 +198,15 @@ NodeHandler::NodeHandler(EditorFrame *frame, NodeInfo *ni) :
|
||||
|
||||
void NodeHandler::CreatePropHandlers()
|
||||
{
|
||||
/* ADD NEW PROPERTY TYPES HERE
|
||||
(search for other occurences of this comment in _all_ files) */
|
||||
s_PropHandlers[PROP_TEXT] = new TextPropertyHandler;
|
||||
s_PropHandlers[PROP_FLAGS] = new FlagsPropertyHandler;
|
||||
s_PropHandlers[PROP_COLOR] = new TextPropertyHandler;
|
||||
s_PropHandlers[PROP_BOOL] = new BoolPropertyHandler;
|
||||
s_PropHandlers[PROP_INTEGER] = new TextPropertyHandler;
|
||||
s_PropHandlers[PROP_COORD] = new CoordPropertyHandler;
|
||||
s_PropHandlers[PROP_DIMENSION] = new DimensionPropertyHandler;
|
||||
s_PropHandlers[PROP_NOT_IMPLEMENTED] = new NotImplPropertyHandler;
|
||||
}
|
||||
|
||||
|
@@ -211,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
|
||||
{
|
||||
|
@@ -24,6 +24,8 @@ class WXDLLEXPORT wxWindow;
|
||||
#include "wx/xml/xml.h"
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
/* ADD NEW PROPERTY TYPES HERE
|
||||
(search for other occurences of this comment in _all_ files) */
|
||||
enum PropertyType
|
||||
{
|
||||
PROP_TEXT = 0,
|
||||
@@ -32,9 +34,10 @@ enum PropertyType
|
||||
PROP_BOOL = 3,
|
||||
PROP_INTEGER = 4,
|
||||
PROP_COORD = 5,
|
||||
PROP_NOT_IMPLEMENTED = 6,
|
||||
PROP_DIMENSION = 6,
|
||||
PROP_NOT_IMPLEMENTED = 7,
|
||||
};
|
||||
#define PROP_TYPES_CNT 7
|
||||
#define PROP_TYPES_CNT 8
|
||||
|
||||
class PropertyInfo
|
||||
{
|
||||
@@ -97,6 +100,14 @@ class CoordPropertyHandler : public PropertyHandler
|
||||
};
|
||||
|
||||
|
||||
class DimensionPropertyHandler : public PropertyHandler
|
||||
{
|
||||
public:
|
||||
DimensionPropertyHandler() {}
|
||||
virtual wxPanel *CreateEditPanel(wxWindow *parent, PropsListInfo *pli);
|
||||
};
|
||||
|
||||
|
||||
class BoolPropertyHandler : public PropertyHandler
|
||||
{
|
||||
public:
|
||||
|
Reference in New Issue
Block a user