X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03f68f123bc79f23ff77821cfe80bfa76b0e68c4..afc48cd0d89304435b18a2fb610a66e3ff278666:/utils/dialoged/src/reswrite.cpp?ds=sidebyside diff --git a/utils/dialoged/src/reswrite.cpp b/utils/dialoged/src/reswrite.cpp index 695bf6081d..9cdde107dc 100644 --- a/utils/dialoged/src/reswrite.cpp +++ b/utils/dialoged/src/reswrite.cpp @@ -29,13 +29,18 @@ #include #include +#if wxUSE_IOSTREAMH #if defined(__WXMSW__) && !defined(__GNUWIN32__) #include +#include #else #include -#endif - #include +#endif +#else +#include +#include +#endif #include "wx/scrolbar.h" #include "wx/string.h" @@ -43,27 +48,27 @@ #include "reseditr.h" char *SafeString(char *s); -char *SafeWord(char *s); +char *SafeWord(const wxString& s); // Save an association between the child resource and the panel item, to allow // us not to require unique window names. -wxControl *wxResourceTableWithSaving::CreateItem(wxPanel *panel, wxItemResource *childResource) +wxControl *wxResourceTableWithSaving::CreateItem(wxPanel *panel, const wxItemResource *childResource, const wxItemResource* parentResource) { - wxControl *item = wxResourceTable::CreateItem(panel, childResource); + wxControl *item = wxResourceTable::CreateItem(panel, childResource, parentResource); if (item) wxResourceManager::GetCurrentResourceManager()->GetResourceAssociations().Put((long)childResource, item); return item; } -void wxResourceTableWithSaving::OutputFont(ostream& stream, wxFont *font) +void wxResourceTableWithSaving::OutputFont(ostream& stream, const wxFont& font) { - stream << "[" << font->GetPointSize() << ", '"; - stream << font->GetFamilyString() << "', '"; - stream << font->GetStyleString() << "', '"; - stream << font->GetWeightString() << "', "; - stream << (int)font->GetUnderlined(); - if (font->GetFaceName() != "") - stream << ", '" << font->GetFaceName() << "'"; + stream << "[" << font.GetPointSize() << ", '"; + stream << font.GetFamilyString() << "', '"; + stream << font.GetStyleString() << "', '"; + stream << font.GetWeightString() << "', "; + stream << (int)font.GetUnderlined(); + if (font.GetFaceName() != "") + stream << ", '" << font.GetFaceName() << "'"; stream << "]"; } @@ -79,21 +84,21 @@ bool wxResourceTableWithSaving::Save(const wxString& filename) BeginFind(); wxNode *node = NULL; - while (node = Next()) + while ((node = Next())) { wxItemResource *item = (wxItemResource *)node->Data(); wxString resType(item->GetType()); if (resType == "wxDialogBox" || resType == "wxDialog" || resType == "wxPanel" || resType == "wxBitmap") { - if (!SaveResource(stream, item)) + if (!SaveResource(stream, item, (wxItemResource*) NULL)) return FALSE; } } return TRUE; } -bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *item) +bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource* item, wxItemResource* parentItem) { char styleBuf[400]; wxString itemType(item->GetType()); @@ -108,52 +113,40 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it else { stream << "static char *" << item->GetName() << " = \"panel(name = '" << item->GetName() << "',\\\n"; - GeneratePanelStyleString(item->GetStyle(), styleBuf); + GenerateDialogStyleString(item->GetStyle(), styleBuf); } + stream << " style = '" << styleBuf << "',\\\n"; stream << " title = '" << item->GetTitle() << "',\\\n"; + stream << " id = " << item->GetId() << ",\\\n"; stream << " x = " << item->GetX() << ", y = " << item->GetY(); stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight(); -// stream << " modal = " << item->GetValue1(); - + if (1) // item->GetStyle() & wxNO_3D) { - if (item->GetBackgroundColour()) + if (item->GetBackgroundColour().Ok()) { char buf[7]; - wxDecToHex(item->GetBackgroundColour()->Red(), buf); - wxDecToHex(item->GetBackgroundColour()->Green(), buf+2); - wxDecToHex(item->GetBackgroundColour()->Blue(), buf+4); + wxDecToHex(item->GetBackgroundColour().Red(), buf); + wxDecToHex(item->GetBackgroundColour().Green(), buf+2); + wxDecToHex(item->GetBackgroundColour().Blue(), buf+4); buf[6] = 0; stream << ",\\\n " << "background_colour = '" << buf << "'"; } -#if 0 - if (item->GetLabelColour()) - { - char buf[7]; - wxDecToHex(item->GetLabelColour()->Red(), buf); - wxDecToHex(item->GetLabelColour()->Green(), buf+2); - wxDecToHex(item->GetLabelColour()->Blue(), buf+4); - buf[6] = 0; - - stream << ",\\\n " << "label_colour = '" << buf << "'"; - } - if (item->GetButtonColour()) - { - char buf[7]; - wxDecToHex(item->GetButtonColour()->Red(), buf); - wxDecToHex(item->GetButtonColour()->Green(), buf+2); - wxDecToHex(item->GetButtonColour()->Blue(), buf+4); - buf[6] = 0; + } - stream << ",\\\n " << "button_colour = '" << buf << "'"; - } -#endif + int dialogUnits = 0; + int useDefaults = 0; + if ((item->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) + dialogUnits = 1; + if ((item->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) + useDefaults = 1; - } + stream << ",\\\n " << "use_dialog_units = " << dialogUnits; + stream << ",\\\n " << "use_system_defaults = " << useDefaults; - if (item->GetFont() && item->GetFont()->Ok()) + if (item->GetFont().Ok()) { stream << ",\\\n font = "; OutputFont(stream, item->GetFont()); @@ -170,7 +163,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it stream << " control = ["; - SaveResource(stream, child); + SaveResource(stream, child, item); stream << "]"; @@ -182,13 +175,13 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } else if (itemType == "wxButton" || itemType == "wxBitmapButton") { - GenerateButtonStyleString(item->GetStyle(), styleBuf); - stream << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); if (item->GetValue4()) stream << ", '" << item->GetValue4() << "'"; - if (item->GetFont()) + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); @@ -196,13 +189,13 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } else if (itemType == "wxStaticText" || itemType == "wxStaticBitmap") { - GenerateMessageStyleString(item->GetStyle(), styleBuf); - stream << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); if (item->GetValue4()) stream << ", '" << item->GetValue4() << "'"; - if (item->GetFont()) + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); @@ -210,12 +203,12 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } else if (itemType == "wxCheckBox") { - GenerateCheckBoxStyleString(item->GetStyle(), styleBuf); - stream << "wxCheckBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxCheckBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); stream << ", " << item->GetValue1(); - if (item->GetFont()) + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); @@ -223,12 +216,12 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } else if (itemType == "wxRadioButton") { - GenerateRadioButtonStyleString(item->GetStyle(), styleBuf); - stream << "wxRadioButton, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxRadioButton, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); stream << ", " << item->GetValue1(); - if (item->GetFont()) + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); @@ -236,11 +229,11 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } else if (itemType == "wxStaticBox") { - GenerateGroupBoxStyleString(item->GetStyle(), styleBuf); - stream << "wxGroupBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), 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()) + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); @@ -248,13 +241,13 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } else if (itemType == "wxText" || itemType == "wxMultiText" || itemType == "wxTextCtrl") { - GenerateTextStyleString(item->GetStyle(), styleBuf); - stream << "wxTextCtrl, "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxTextCtrl, "; stream << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); stream << ", " << SafeWord(item->GetValue4()); - if (item->GetFont()) + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); @@ -262,12 +255,12 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } else if (itemType == "wxGauge") { - GenerateGaugeStyleString(item->GetStyle(), styleBuf); - stream << "wxGauge, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxGauge, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); stream << ", " << item->GetValue1() << ", " << item->GetValue2(); - if (item->GetFont()) + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); @@ -275,12 +268,12 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } else if (itemType == "wxSlider") { - GenerateSliderStyleString(item->GetStyle(), styleBuf); - stream << "wxSlider, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxSlider, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3(); - if (item->GetFont()) + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); @@ -288,8 +281,8 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } else if (itemType == "wxScrollBar") { - GenerateScrollBarStyleString(item->GetStyle(), styleBuf); - stream << "wxScrollBar, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxScrollBar, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3() << ", "; @@ -297,17 +290,17 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } else if (itemType == "wxListBox") { - GenerateListBoxStyleString(item->GetStyle(), styleBuf); - stream << "wxListBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxListBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); // Default list of values stream << ", ["; - if (item->GetStringValues()) + if (item->GetStringValues().Number() > 0) { - wxNode *node = item->GetStringValues()->First(); + wxNode *node = item->GetStringValues().First(); while (node) { char *s = (char *)node->Data(); @@ -317,7 +310,9 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it node = node->Next(); } } - stream << "], "; + stream << "]"; +/* Styles are now in the window style, not in a separate arg + stream << ", "; switch (item->GetValue1()) { case wxLB_MULTIPLE: @@ -337,25 +332,31 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it break; } } - if (item->GetFont()) + */ + + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); } } - else if (itemType == "wxChoice") + else if (itemType == "wxChoice" || itemType == "wxComboBox") { - GenerateChoiceStyleString(item->GetStyle(), styleBuf); - stream << "wxChoice, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + + stream << item->GetId() << ", " << itemType << ", " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); + if (itemType == "wxComboBox") + stream << ", " << SafeWord(item->GetValue4()); + // Default list of values stream << ", ["; - if (item->GetStringValues()) + if (item->GetStringValues().Number() > 0) { - wxNode *node = item->GetStringValues()->First(); + wxNode *node = item->GetStringValues().First(); while (node) { char *s = (char *)node->Data(); @@ -366,7 +367,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } } stream << "]"; - if (item->GetFont()) + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); @@ -375,17 +376,17 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it else if (itemType == "wxRadioBox") { // Must write out the orientation and number of rows/cols!! - GenerateRadioBoxStyleString(item->GetStyle(), styleBuf); - stream << "wxRadioBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + GenerateControlStyleString(itemType, item->GetStyle(), styleBuf); + stream << item->GetId() << ", " << "wxRadioBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; stream << item->GetWidth() << ", " << item->GetHeight(); // Default list of values stream << ", ["; - if (item->GetStringValues()) + if (item->GetStringValues().Number() > 0) { - wxNode *node = item->GetStringValues()->First(); + wxNode *node = item->GetStringValues().First(); while (node) { char *s = (char *)node->Data(); @@ -396,7 +397,7 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } } stream << "], " << item->GetValue1(); - if (item->GetFont()) + if (item->GetFont().Ok()) { stream << ",\\\n "; OutputFont(stream, item->GetFont()); @@ -528,34 +529,22 @@ bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *it } stream << ").\";\n\n"; } + else + { + wxString str("Unimplemented resource type: "); + str += itemType; + wxMessageBox(str); + } return TRUE; } -void wxResourceTableWithSaving::GenerateWindowStyleString(long windowStyle, char *buf) -{ - GenerateStyle(buf, windowStyle, wxNO_3D, "wxNO_3D"); - GenerateStyle(buf, windowStyle, wxVSCROLL, "wxVSCROLL"); - GenerateStyle(buf, windowStyle, wxHSCROLL, "wxHSCROLL"); - GenerateStyle(buf, windowStyle, wxBORDER, "wxBORDER"); -} - void wxResourceTableWithSaving::GenerateDialogStyleString(long windowStyle, char *buf) { buf[0] = 0; - GenerateWindowStyleString(windowStyle, buf); + m_styleTable.GenerateStyleStrings("wxWindow", windowStyle, buf); + m_styleTable.GenerateStyleStrings("wxPanel", windowStyle, buf); + m_styleTable.GenerateStyleStrings("wxDialog", windowStyle, buf); -/* - GenerateStyle(buf, windowStyle, wxRETAINED, "wxRETAINED"); -*/ - if (!GenerateStyle(buf, windowStyle, wxDEFAULT_DIALOG_STYLE, "wxDEFAULT_DIALOG_STYLE")) - { - GenerateStyle(buf, windowStyle, wxCAPTION, "wxCAPTION"); - GenerateStyle(buf, windowStyle, wxTHICK_FRAME, "wxTHICK_FRAME"); - GenerateStyle(buf, windowStyle, wxRESIZE_BORDER, "wxRESIZE_BORDER"); - GenerateStyle(buf, windowStyle, wxSYSTEM_MENU, "wxSYSTEM_MENU"); - GenerateStyle(buf, windowStyle, wxMINIMIZE_BOX, "wxMINIMIZE_BOX"); - GenerateStyle(buf, windowStyle, wxMAXIMIZE_BOX, "wxMAXIMIZE_BOX"); - } if (strlen(buf) == 0) strcat(buf, "0"); } @@ -563,162 +552,29 @@ void wxResourceTableWithSaving::GenerateDialogStyleString(long windowStyle, char void wxResourceTableWithSaving::GeneratePanelStyleString(long windowStyle, char *buf) { buf[0] = 0; - GenerateWindowStyleString(windowStyle, buf); - -/* - GenerateStyle(buf, windowStyle, wxRETAINED, "wxRETAINED"); -*/ - if (strlen(buf) == 0) - strcat(buf, "0"); -} - - -void wxResourceTableWithSaving::GenerateItemStyleString(long windowStyle, char *buf) -{ - GenerateWindowStyleString(windowStyle, buf); - - GenerateStyle(buf, windowStyle, wxHORIZONTAL, "wxHORIZONTAL"); - GenerateStyle(buf, windowStyle, wxVERTICAL, "wxVERTICAL"); -} - -void wxResourceTableWithSaving::GenerateRadioBoxStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - - if (strlen(buf) == 0) - strcat(buf, "0"); -} - -void wxResourceTableWithSaving::GenerateMessageStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - - if (strlen(buf) == 0) - strcat(buf, "0"); -} - -void wxResourceTableWithSaving::GenerateTextStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - - GenerateStyle(buf, windowStyle, wxTE_PROCESS_ENTER, "wxTE_PROCESS_ENTER"); - GenerateStyle(buf, windowStyle, wxTE_READONLY, "wxTE_READONLY"); - GenerateStyle(buf, windowStyle, wxTE_PASSWORD, "wxTE_PASSWORD"); - GenerateStyle(buf, windowStyle, wxTE_MULTILINE, "wxTE_MULTILINE"); - - if (strlen(buf) == 0) - strcat(buf, "0"); -} - -void wxResourceTableWithSaving::GenerateButtonStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - - if (strlen(buf) == 0) - strcat(buf, "0"); -} - -void wxResourceTableWithSaving::GenerateCheckBoxStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - - if (strlen(buf) == 0) - strcat(buf, "0"); -} - -void wxResourceTableWithSaving::GenerateRadioButtonStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - - if (strlen(buf) == 0) - strcat(buf, "0"); -} - -void wxResourceTableWithSaving::GenerateListBoxStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - - GenerateStyle(buf, windowStyle, wxLB_ALWAYS_SB, "wxLB_ALWAYS_SB"); - GenerateStyle(buf, windowStyle, wxLB_SORT, "wxLB_SORT"); -// GenerateStyle(buf, windowStyle, wxLB_SINGLE, "wxLB_SINGLE"); // Done already - GenerateStyle(buf, windowStyle, wxLB_MULTIPLE, "wxLB_MULTIPLE"); - GenerateStyle(buf, windowStyle, wxLB_EXTENDED, "wxLB_EXTENDED"); - - if (strlen(buf) == 0) - strcat(buf, "0"); -} - -void wxResourceTableWithSaving::GenerateSliderStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - - if (strlen(buf) == 0) - strcat(buf, "0"); -} + m_styleTable.GenerateStyleStrings("wxWindow", windowStyle, buf); + m_styleTable.GenerateStyleStrings("wxPanel", windowStyle, buf); -void wxResourceTableWithSaving::GenerateGroupBoxStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - if (strlen(buf) == 0) strcat(buf, "0"); } -void wxResourceTableWithSaving::GenerateGaugeStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - - GenerateStyle(buf, windowStyle, wxGA_PROGRESSBAR, "wxGA_PROGRESSBAR"); - - if (strlen(buf) == 0) - strcat(buf, "0"); -} -void wxResourceTableWithSaving::GenerateChoiceStyleString(long windowStyle, char *buf) +void wxResourceTableWithSaving::GenerateControlStyleString(const wxString& windowClass, long windowStyle, char *buf) { buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - - if (strlen(buf) == 0) - strcat(buf, "0"); -} + m_styleTable.GenerateStyleStrings("wxWindow", windowStyle, buf); + m_styleTable.GenerateStyleStrings("wxControl", windowStyle, buf); + m_styleTable.GenerateStyleStrings(windowClass, windowStyle, buf); -void wxResourceTableWithSaving::GenerateScrollBarStyleString(long windowStyle, char *buf) -{ - buf[0] = 0; - GenerateItemStyleString(windowStyle, buf); - if (strlen(buf) == 0) strcat(buf, "0"); } -bool wxResourceTableWithSaving::GenerateStyle(char *buf, long windowStyle, long flag, char *strStyle) -{ - if ((windowStyle & flag) == flag) - { - if (strlen(buf) > 0) - strcat(buf, " | "); - strcat(buf, strStyle); - return TRUE; - } - else - return FALSE; -} - // Returns quoted string or "NULL" -char *SafeString(char *s) +char *SafeString(const wxString& s) { - if (!s) + if (s == "") return "NULL"; else { @@ -730,14 +586,14 @@ char *SafeString(char *s) } // Returns quoted string or '' -char *SafeWord(char *s) +char *SafeWord(const wxString& s) { - if (!s) + if (s == "") return "''"; else { strcpy(wxBuffer, "'"); - strcat(wxBuffer, s); + strcat(wxBuffer, (const char*) s); strcat(wxBuffer, "'"); return wxBuffer; }