| 1 |
#include "splitter_window_page.h" |
| 2 |
#include "allocator_mgr.h" |
| 3 |
#include "splitter_window_wrapper.h" |
| 4 |
|
| 5 |
SplitterWindowPage::SplitterWindowPage() |
| 6 |
{ |
| 7 |
SetType(ID_WXSPLITTERWINDOW_PAGE); |
| 8 |
m_namePattern = wxT("m_splitterPage"); |
| 9 |
SetName(GenerateName()); |
| 10 |
} |
| 11 |
|
| 12 |
SplitterWindowPage::~SplitterWindowPage() {} |
| 13 |
|
| 14 |
wxcWidget* SplitterWindowPage::Clone() const { return new SplitterWindowPage(); } |
| 15 |
|
| 16 |
wxString SplitterWindowPage::CppCtorCode() const |
| 17 |
{ |
| 18 |
wxString code = PanelWrapper::CppCtorCode(); |
| 19 |
SplitterWindowWrapper* sp = dynamic_cast<SplitterWindowWrapper*>(GetParent()); |
| 20 |
if(!sp) { return code; } |
| 21 |
|
| 22 |
// Add the splitter specific code here |
| 23 |
const wxcWidget::List_t& siblings = sp->GetChildren(); |
| 24 |
if(IsLastChild()) { |
| 25 |
// We are the last child, create the code that calls the 'split' method |
| 26 |
wxString first, second; |
| 27 |
wxcWidget::List_t::const_iterator iter = siblings.begin(); |
| 28 |
for(; iter != siblings.end(); iter++) { |
| 29 |
if(first.IsEmpty()) { |
| 30 |
first = (*iter)->GetName(); |
| 31 |
|
| 32 |
} else { |
| 33 |
second = (*iter)->GetName(); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
bool splitVert = sp->IsSplitVertically(); |
| 38 |
if(first.IsEmpty() == false && second.IsEmpty() == false) { |
| 39 |
code << sp->GetName(); |
| 40 |
|
| 41 |
if(splitVert) { |
| 42 |
code << wxT("->SplitVertically("); |
| 43 |
} else { |
| 44 |
code << wxT("->SplitHorizontally("); |
| 45 |
} |
| 46 |
|
| 47 |
code << first << wxT(", ") << second << wxT(", ") << sp->GetSashPos() << wxT(");\n"); |
| 48 |
} |
| 49 |
} |
| 50 |
return code; |
| 51 |
} |