| 1 |
#include "wxgui_defs.h" |
| 2 |
#include "wxc_widget.h" |
| 3 |
#include "wxgui_helpers.h" |
| 4 |
|
| 5 |
void WxStyleInfo::UpdateStyleString(wxString& styleAsString) const |
| 6 |
{ |
| 7 |
if(style_group.IsEmpty()) return; |
| 8 |
|
| 9 |
bool allGroupExists = true; |
| 10 |
wxString newStyle; |
| 11 |
wxArrayString arr = wxCrafter::Split(styleAsString, ","); |
| 12 |
for(size_t i = 0; i < style_group.GetCount(); ++i) { |
| 13 |
if(arr.Index(style_group.Item(i)) == wxNOT_FOUND) { |
| 14 |
allGroupExists = false; |
| 15 |
break; |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
if(allGroupExists && arr.Index(style_name) == wxNOT_FOUND) { |
| 20 |
// add the style |
| 21 |
arr.Add(style_name); |
| 22 |
|
| 23 |
} else if(!allGroupExists && arr.Index(style_name) != wxNOT_FOUND) { |
| 24 |
// not all the group exists and the style exists |
| 25 |
// remove it |
| 26 |
arr.Remove(style_name); |
| 27 |
} |
| 28 |
|
| 29 |
styleAsString = wxCrafter::Join(arr, ","); |
| 30 |
} |
| 31 |
|
| 32 |
bool WxStyleInfo::IsGroupConditionMet(wxcWidget* widget) const |
| 33 |
{ |
| 34 |
if(style_group.IsEmpty()) return true; |
| 35 |
|
| 36 |
for(size_t i = 0; i < style_group.GetCount(); ++i) { |
| 37 |
if(!widget->IsSizerFlagChecked(style_group.Item(i))) return false; |
| 38 |
} |
| 39 |
return true; |
| 40 |
} |