1
/////////////////////////////////////////////////////////////////////////////
2
// Name: src/propgrid/manager.cpp
3
// Purpose: wxPropertyGridManager
4
// Author: Jaakko Salli
7
// RCS-ID: $Id: manager.cpp 71625 2012-06-01 11:01:24Z VZ $
8
// Copyright: (c) Jaakko Salli
9
// Licence: wxWindows licence
10
/////////////////////////////////////////////////////////////////////////////
12
// For compilers that support precompilation, includes "wx/wx.h".
13
#include "wx/wxprec.h"
23
#include "wx/object.h"
25
#include "wx/string.h"
28
#include "wx/window.h"
33
#include "wx/cursor.h"
34
#include "wx/settings.h"
35
#include "wx/textctrl.h"
37
#include "wx/statusbr.h"
41
// This define is necessary to prevent macro clearing
42
#define __wxPG_SOURCE_FILE__
44
#include "wx/propgrid/propgrid.h"
46
#include "wx/propgrid/manager.h"
49
#define wxPG_MAN_ALTERNATE_BASE_ID 11249 // Needed for wxID_ANY madnesss
52
// -----------------------------------------------------------------------
54
// For wxMSW cursor consistency, we must do mouse capturing even
55
// when using custom controls
57
#define BEGIN_MOUSE_CAPTURE \
58
if ( !(m_iFlags & wxPG_FL_MOUSE_CAPTURED) ) \
61
m_iFlags |= wxPG_FL_MOUSE_CAPTURED; \
64
#define END_MOUSE_CAPTURE \
65
if ( m_iFlags & wxPG_FL_MOUSE_CAPTURED ) \
68
m_iFlags &= ~(wxPG_FL_MOUSE_CAPTURED); \
71
// -----------------------------------------------------------------------
72
// wxPropertyGridManager
73
// -----------------------------------------------------------------------
75
const char wxPropertyGridManagerNameStr[] = "wxPropertyGridManager";
78
// Categoric Mode Icon
79
static const char* const gs_xpm_catmode[] = {
104
// Alphabetic Mode Icon
105
static const char* const gs_xpm_noncatmode[] = {
130
// Default Page Icon.
131
static const char* const gs_xpm_defpage[] = {
156
// -----------------------------------------------------------------------
157
// wxPropertyGridPage
158
// -----------------------------------------------------------------------
161
IMPLEMENT_CLASS(wxPropertyGridPage, wxEvtHandler)
164
BEGIN_EVENT_TABLE(wxPropertyGridPage, wxEvtHandler)
168
wxPropertyGridPage::wxPropertyGridPage()
169
: wxEvtHandler(), wxPropertyGridInterface(), wxPropertyGridPageState()
171
m_pState = this; // wxPropertyGridInterface to point to State
176
wxPropertyGridPage::~wxPropertyGridPage()
180
void wxPropertyGridPage::Clear()
182
GetStatePtr()->DoClear();
185
wxSize wxPropertyGridPage::FitColumns()
187
wxSize sz = DoFitColumns();
191
void wxPropertyGridPage::RefreshProperty( wxPGProperty* p )
194
m_manager->RefreshProperty(p);
197
void wxPropertyGridPage::OnShow()
201
void wxPropertyGridPage::SetSplitterPosition( int splitterPos, int col )
203
wxPropertyGrid* pg = GetGrid();
204
if ( pg->GetState() == this )
205
pg->SetSplitterPosition(splitterPos);
207
DoSetSplitterPosition(splitterPos, col, false);
210
void wxPropertyGridPage::DoSetSplitterPosition( int pos,
214
if ( (flags & wxPG_SPLITTER_ALL_PAGES) && m_manager->GetPageCount() )
215
m_manager->SetSplitterPosition( pos, splitterColumn );
217
wxPropertyGridPageState::DoSetSplitterPosition( pos,
222
// -----------------------------------------------------------------------
224
// -----------------------------------------------------------------------
228
class wxPGHeaderCtrl : public wxHeaderCtrl
231
wxPGHeaderCtrl(wxPropertyGridManager* manager) :
235
EnsureColumnCount(2);
237
// Seed titles with defaults
238
m_columns[0]->SetTitle(_("Property"));
239
m_columns[1]->SetTitle(_("Value"));
242
virtual ~wxPGHeaderCtrl()
244
for (unsigned int i=0; i<m_columns.size(); i++ )
248
int DetermineColumnWidth(unsigned int idx, int* pMinWidth) const
250
const wxPropertyGridPage* page = m_page;
251
int colWidth = page->GetColumnWidth(idx);
252
int colMinWidth = page->GetColumnMinWidth(idx);
255
wxPropertyGrid* pg = m_manager->GetGrid();
256
int margin = pg->GetMarginWidth();
258
// Compensate for the internal border
259
margin += (pg->GetSize().x - pg->GetClientSize().x) / 2;
262
colMinWidth += margin;
264
*pMinWidth = colMinWidth;
268
void OnPageChanged(const wxPropertyGridPage* page)
276
// Get column info from the page
277
const wxPropertyGridPage* page = m_page;
278
unsigned int colCount = page->GetColumnCount();
279
EnsureColumnCount(colCount);
281
for ( unsigned int i=0; i<colCount; i++ )
283
wxHeaderColumnSimple* colInfo = m_columns[i];
285
int colWidth = DetermineColumnWidth(i, &colMinWidth);
286
colInfo->SetWidth(colWidth);
287
colInfo->SetMinWidth(colMinWidth);
290
SetColumnCount(colCount);
293
void OnColumWidthsChanged()
295
const wxPropertyGridPage* page = m_page;
296
unsigned int colCount = page->GetColumnCount();
298
for ( unsigned int i=0; i<colCount; i++ )
300
wxHeaderColumnSimple* colInfo = m_columns[i];
302
int colWidth = DetermineColumnWidth(i, &colMinWidth);
303
colInfo->SetWidth(colWidth);
304
colInfo->SetMinWidth(colMinWidth);
309
virtual const wxHeaderColumn& GetColumn(unsigned int idx) const
311
return *m_columns[idx];
314
void SetColumnTitle(unsigned int idx, const wxString& title)
316
EnsureColumnCount(idx+1);
317
m_columns[idx]->SetTitle(title);
321
void EnsureColumnCount(unsigned int count)
323
while ( m_columns.size() < count )
325
wxHeaderColumnSimple* colInfo = new wxHeaderColumnSimple("");
326
m_columns.push_back(colInfo);
330
void OnSetColumnWidth(int col, int colWidth)
332
wxPropertyGrid* pg = m_manager->GetGrid();
334
// Compensate for the internal border
335
int x = -((pg->GetSize().x - pg->GetClientSize().x) / 2);
337
for ( int i=0; i<col; i++ )
338
x += m_columns[i]->GetWidth();
342
pg->DoSetSplitterPosition(x, col,
343
wxPG_SPLITTER_REFRESH |
344
wxPG_SPLITTER_FROM_EVENT);
347
virtual bool ProcessEvent( wxEvent& event )
349
if ( event.IsKindOf(wxCLASSINFO(wxHeaderCtrlEvent)) )
351
wxHeaderCtrlEvent& hcEvent =
352
static_cast<wxHeaderCtrlEvent&>(event);
354
wxPropertyGrid* pg = m_manager->GetGrid();
355
int col = hcEvent.GetColumn();
356
int evtType = event.GetEventType();
358
if ( evtType == wxEVT_COMMAND_HEADER_RESIZING )
360
int colWidth = hcEvent.GetWidth();
362
OnSetColumnWidth(col, colWidth);
364
pg->SendEvent(wxEVT_PG_COL_DRAGGING,
370
else if ( evtType == wxEVT_COMMAND_HEADER_BEGIN_RESIZE )
372
// Never allow column resize if layout is static
373
if ( m_manager->HasFlag(wxPG_STATIC_SPLITTER) )
375
// Allow application to veto dragging
376
else if ( pg->SendEvent(wxEVT_PG_COL_BEGIN_DRAG,
383
else if ( evtType == wxEVT_COMMAND_HEADER_END_RESIZE )
385
pg->SendEvent(wxEVT_PG_COL_END_DRAG,
393
return wxHeaderCtrl::ProcessEvent(event);
396
wxPropertyGridManager* m_manager;
397
const wxPropertyGridPage* m_page;
398
wxVector<wxHeaderColumnSimple*> m_columns;
401
#endif // wxUSE_HEADERCTRL
403
// -----------------------------------------------------------------------
404
// wxPropertyGridManager
405
// -----------------------------------------------------------------------
407
// Final default splitter y is client height minus this.
408
#define wxPGMAN_DEFAULT_NEGATIVE_SPLITTER_Y 100
410
// -----------------------------------------------------------------------
412
IMPLEMENT_CLASS(wxPropertyGridManager, wxPanel)
414
// -----------------------------------------------------------------------
416
BEGIN_EVENT_TABLE(wxPropertyGridManager, wxPanel)
417
EVT_MOTION(wxPropertyGridManager::OnMouseMove)
418
EVT_SIZE(wxPropertyGridManager::OnResize)
419
EVT_PAINT(wxPropertyGridManager::OnPaint)
420
EVT_LEFT_DOWN(wxPropertyGridManager::OnMouseClick)
421
EVT_LEFT_UP(wxPropertyGridManager::OnMouseUp)
422
EVT_LEAVE_WINDOW(wxPropertyGridManager::OnMouseEntry)
423
//EVT_ENTER_WINDOW(wxPropertyGridManager::OnMouseEntry)
426
// -----------------------------------------------------------------------
428
wxPropertyGridManager::wxPropertyGridManager()
434
// -----------------------------------------------------------------------
436
wxPropertyGridManager::wxPropertyGridManager( wxWindow *parent,
441
const wxString& name )
445
Create(parent,id,pos,size,style,name);
448
// -----------------------------------------------------------------------
450
bool wxPropertyGridManager::Create( wxWindow *parent,
455
const wxString& name )
458
m_pPropGrid = CreatePropertyGrid();
460
bool res = wxPanel::Create( parent, id, pos, size,
461
(style&0xFFFF0000)|wxWANTS_CHARS,
465
// FIXME: this changes call ordering so wxPropertyGrid is created
466
// immediately, before SetExtraStyle has a chance to be called. However,
467
// without it, we may get assertions if size is wxDefaultSize.
468
//SetInitialSize(size);
473
// -----------------------------------------------------------------------
476
// Initialize values to defaults
478
void wxPropertyGridManager::Init1()
487
m_pHeaderCtrl = NULL;
488
m_showHeader = false;
490
m_pTxtHelpCaption = NULL;
491
m_pTxtHelpContent = NULL;
497
m_width = m_height = 0;
499
m_splitterHeight = 5;
501
m_splitterY = -1; // -1 causes default to be set.
503
m_nextDescBoxSize = -1;
505
m_categorizedModeToolId = -1;
506
m_alphabeticModeToolId = -1;
514
// -----------------------------------------------------------------------
516
// These flags are always used in wxPropertyGrid integrated in wxPropertyGridManager.
517
#define wxPG_MAN_PROPGRID_FORCED_FLAGS ( wxBORDER_THEME | \
518
wxNO_FULL_REPAINT_ON_RESIZE| \
521
// Which flags can be passed to underlying wxPropertyGrid.
522
#define wxPG_MAN_PASS_FLAGS_MASK (0xFFF0|wxTAB_TRAVERSAL)
525
// Initialize after parent etc. set
527
void wxPropertyGridManager::Init2( int style )
530
if ( m_iFlags & wxPG_FL_INITIALIZED )
533
m_windowStyle |= (style&0x0000FFFF);
535
wxSize csz = GetClientSize();
537
m_cursorSizeNS = wxCursor(wxCURSOR_SIZENS);
539
// Prepare the first page
540
// NB: But just prepare - you still need to call Add/InsertPage
541
// to actually add properties on it.
542
wxPropertyGridPage* pd = new wxPropertyGridPage();
543
pd->m_isDefault = true;
544
pd->m_manager = this;
545
wxPropertyGridPageState* state = pd->GetStatePtr();
546
state->m_pPropGrid = m_pPropGrid;
547
m_arrPages.push_back( pd );
548
m_pPropGrid->m_pState = state;
550
wxWindowID baseId = GetId();
551
wxWindowID useId = baseId;
553
baseId = wxPG_MAN_ALTERNATE_BASE_ID;
556
// Smaller controls on Mac
557
SetWindowVariant(wxWINDOW_VARIANT_SMALL);
560
long propGridFlags = (m_windowStyle&wxPG_MAN_PASS_FLAGS_MASK)
561
|wxPG_MAN_PROPGRID_FORCED_FLAGS;
563
propGridFlags &= ~wxBORDER_MASK;
565
if ((style & wxPG_NO_INTERNAL_BORDER) == 0)
567
propGridFlags |= wxBORDER_THEME;
571
propGridFlags |= wxBORDER_NONE;
572
wxWindow::SetExtraStyle(wxPG_EX_TOOLBAR_SEPARATOR);
575
// Create propertygrid.
576
m_pPropGrid->Create(this,baseId,wxPoint(0,0),csz, propGridFlags);
578
m_pPropGrid->m_eventObject = this;
580
m_pPropGrid->SetId(useId);
582
m_pPropGrid->m_iFlags |= wxPG_FL_IN_MANAGER;
584
m_pState = m_pPropGrid->m_pState;
586
m_pPropGrid->SetExtraStyle(wxPG_EX_INIT_NOCAT);
588
// Connect to property grid onselect event.
589
// NB: Even if wxID_ANY is used, this doesn't connect properly in wxPython
590
// (see wxPropertyGridManager::ProcessEvent).
591
Connect(m_pPropGrid->GetId(),
593
wxPropertyGridEventHandler(wxPropertyGridManager::OnPropertyGridSelect));
595
Connect(m_pPropGrid->GetId(),
596
wxEVT_PG_COL_DRAGGING,
597
wxPropertyGridEventHandler(wxPropertyGridManager::OnPGColDrag));
599
// Optional initial controls.
602
m_iFlags |= wxPG_FL_INITIALIZED;
606
// -----------------------------------------------------------------------
608
wxPropertyGridManager::~wxPropertyGridManager()
612
//m_pPropGrid->ClearSelection();
613
wxDELETE(m_pPropGrid);
616
for ( i=0; i<m_arrPages.size(); i++ )
618
delete m_arrPages[i];
624
// -----------------------------------------------------------------------
626
wxPropertyGrid* wxPropertyGridManager::CreatePropertyGrid() const
628
return new wxPropertyGrid();
631
// -----------------------------------------------------------------------
633
void wxPropertyGridManager::SetId( wxWindowID winid )
635
wxWindow::SetId(winid);
637
// TODO: Reconnect propgrid event handler(s).
639
m_pPropGrid->SetId(winid);
642
// -----------------------------------------------------------------------
644
wxSize wxPropertyGridManager::DoGetBestSize() const
646
return wxSize(60,150);
649
// -----------------------------------------------------------------------
651
bool wxPropertyGridManager::SetFont( const wxFont& font )
653
bool res = wxWindow::SetFont(font);
654
m_pPropGrid->SetFont(font);
656
// TODO: Need to do caption recacalculations for other pages as well.
658
for ( i=0; i<m_arrPages.size(); i++ )
660
wxPropertyGridPage* page = GetPage(i);
662
if ( page != m_pPropGrid->GetState() )
663
page->CalculateFontAndBitmapStuff(-1);
669
// -----------------------------------------------------------------------
671
void wxPropertyGridManager::SetExtraStyle( long exStyle )
673
wxWindow::SetExtraStyle( exStyle );
674
m_pPropGrid->SetExtraStyle( exStyle & 0xFFFFF000 );
676
if ( (exStyle & wxPG_EX_NO_FLAT_TOOLBAR) && m_pToolbar )
681
// -----------------------------------------------------------------------
683
void wxPropertyGridManager::Freeze()
685
m_pPropGrid->Freeze();
689
// -----------------------------------------------------------------------
691
void wxPropertyGridManager::Thaw()
697
// -----------------------------------------------------------------------
699
void wxPropertyGridManager::SetWindowStyleFlag( long style )
701
int oldWindowStyle = GetWindowStyleFlag();
703
wxWindow::SetWindowStyleFlag( style );
704
m_pPropGrid->SetWindowStyleFlag( (m_pPropGrid->GetWindowStyleFlag()&~(wxPG_MAN_PASS_FLAGS_MASK)) |
705
(style&wxPG_MAN_PASS_FLAGS_MASK) );
707
// Need to re-position windows?
708
if ( (oldWindowStyle & (wxPG_TOOLBAR|wxPG_DESCRIPTION)) !=
709
(style & (wxPG_TOOLBAR|wxPG_DESCRIPTION)) )
715
// -----------------------------------------------------------------------
717
bool wxPropertyGridManager::Reparent( wxWindowBase *newParent )
720
m_pPropGrid->OnTLPChanging((wxWindow*)newParent);
722
bool res = wxPanel::Reparent(newParent);
727
// -----------------------------------------------------------------------
729
// Actually shows given page.
730
bool wxPropertyGridManager::DoSelectPage( int index )
732
// -1 means no page was selected
733
//wxASSERT( m_selPage >= 0 );
735
wxCHECK_MSG( index >= -1 && index < (int)GetPageCount(),
737
wxT("invalid page index") );
739
if ( m_selPage == index )
742
if ( m_pPropGrid->GetSelection() )
744
if ( !m_pPropGrid->ClearSelection() )
748
wxPropertyGridPage* prevPage;
750
if ( m_selPage >= 0 )
751
prevPage = GetPage(m_selPage);
753
prevPage = m_emptyPage;
755
wxPropertyGridPage* nextPage;
759
nextPage = m_arrPages[index];
767
m_emptyPage = new wxPropertyGridPage();
768
m_emptyPage->m_pPropGrid = m_pPropGrid;
771
nextPage = m_emptyPage;
774
m_iFlags |= wxPG_FL_DESC_REFRESH_REQUIRED;
776
m_pPropGrid->SwitchState( nextPage->GetStatePtr() );
778
m_pState = m_pPropGrid->m_pState;
786
m_pToolbar->ToggleTool( nextPage->m_toolId, true );
788
m_pToolbar->ToggleTool( prevPage->m_toolId, false );
794
m_pHeaderCtrl->OnPageChanged(nextPage);
800
// -----------------------------------------------------------------------
802
// Changes page *and* set the target page for insertion operations.
803
void wxPropertyGridManager::SelectPage( int index )
808
// -----------------------------------------------------------------------
810
int wxPropertyGridManager::GetPageByName( const wxString& name ) const
813
for ( i=0; i<GetPageCount(); i++ )
815
if ( m_arrPages[i]->m_label == name )
821
// -----------------------------------------------------------------------
823
int wxPropertyGridManager::GetPageByState( const wxPropertyGridPageState* pState ) const
828
for ( i=0; i<GetPageCount(); i++ )
830
if ( pState == m_arrPages[i]->GetStatePtr() )
837
// -----------------------------------------------------------------------
839
const wxString& wxPropertyGridManager::GetPageName( int index ) const
841
wxASSERT( index >= 0 && index < (int)GetPageCount() );
842
return m_arrPages[index]->m_label;
845
// -----------------------------------------------------------------------
847
wxPropertyGridPageState* wxPropertyGridManager::GetPageState( int page ) const
849
// Do not change this into wxCHECK because returning NULL is important
850
// for wxPropertyGridInterface page enumeration mechanics.
851
if ( page >= (int)GetPageCount() )
856
return m_arrPages[page];
859
// -----------------------------------------------------------------------
861
void wxPropertyGridManager::Clear()
863
m_pPropGrid->ClearSelection(false);
865
m_pPropGrid->Freeze();
868
for ( i=(int)GetPageCount()-1; i>=0; i-- )
874
// -----------------------------------------------------------------------
876
void wxPropertyGridManager::ClearPage( int page )
878
wxASSERT( page >= 0 );
879
wxASSERT( page < (int)GetPageCount() );
881
if ( page >= 0 && page < (int)GetPageCount() )
883
wxPropertyGridPageState* state = m_arrPages[page];
885
if ( state == m_pPropGrid->GetState() )
886
m_pPropGrid->Clear();
892
// -----------------------------------------------------------------------
894
int wxPropertyGridManager::GetColumnCount( int page ) const
896
wxASSERT( page >= -1 );
897
wxASSERT( page < (int)GetPageCount() );
899
return GetPageState(page)->GetColumnCount();
902
// -----------------------------------------------------------------------
904
void wxPropertyGridManager::SetColumnCount( int colCount, int page )
906
wxASSERT( page >= -1 );
907
wxASSERT( page < (int)GetPageCount() );
909
GetPageState(page)->SetColumnCount( colCount );
910
GetGrid()->Refresh();
914
m_pHeaderCtrl->OnPageUpdated();
917
// -----------------------------------------------------------------------
919
size_t wxPropertyGridManager::GetPageCount() const
921
if ( !(m_iFlags & wxPG_MAN_FL_PAGE_INSERTED) )
924
return m_arrPages.size();
927
// -----------------------------------------------------------------------
929
wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index,
930
const wxString& label,
932
wxPropertyGridPage* pageObj )
935
index = GetPageCount();
937
wxCHECK_MSG( (size_t)index == GetPageCount(), NULL,
938
wxT("wxPropertyGridManager currently only supports appending pages (due to wxToolBar limitation)."));
940
bool needInit = true;
941
bool isPageInserted = m_iFlags & wxPG_MAN_FL_PAGE_INSERTED ? true : false;
943
wxASSERT( index == 0 || isPageInserted );
947
// No custom page object was given, so we will either re-use the default base
948
// page (if index==0), or create a new default page object.
949
if ( !isPageInserted )
951
pageObj = GetPage(0);
952
// Of course, if the base page was custom, we need to delete and
954
if ( !pageObj->m_isDefault )
957
pageObj = new wxPropertyGridPage();
958
m_arrPages[0] = pageObj;
964
pageObj = new wxPropertyGridPage();
966
pageObj->m_isDefault = true;
970
if ( !isPageInserted )
972
// Initial page needs to be deleted and replaced
974
m_arrPages[0] = pageObj;
975
m_pPropGrid->m_pState = pageObj->GetStatePtr();
979
wxPropertyGridPageState* state = pageObj->GetStatePtr();
981
pageObj->m_manager = this;
985
state->m_pPropGrid = m_pPropGrid;
986
state->InitNonCatMode();
989
if ( !label.empty() )
991
wxASSERT_MSG( !pageObj->m_label.length(),
992
wxT("If page label is given in constructor, empty label must be given in AddPage"));
993
pageObj->m_label = label;
996
pageObj->m_toolId = -1;
998
if ( !HasFlag(wxPG_SPLITTER_AUTO_CENTER) )
999
pageObj->m_dontCenterSplitter = true;
1001
if ( isPageInserted )
1002
m_arrPages.push_back( pageObj );
1005
if ( m_windowStyle & wxPG_TOOLBAR )
1010
if ( !(GetExtraStyle()&wxPG_EX_HIDE_PAGE_BUTTONS) )
1012
wxASSERT( m_pToolbar );
1014
// Add separator before first page.
1015
if ( GetPageCount() < 2 && (GetExtraStyle()&wxPG_EX_MODE_BUTTONS) &&
1016
m_pToolbar->GetToolsCount() < 3 )
1017
m_pToolbar->AddSeparator();
1019
wxToolBarToolBase* tool;
1021
if ( &bmp != &wxNullBitmap )
1022
tool = m_pToolbar->AddTool(wxID_ANY, label, bmp,
1023
label, wxITEM_RADIO);
1025
tool = m_pToolbar->AddTool(wxID_ANY, label,
1026
wxBitmap(gs_xpm_defpage),
1027
label, wxITEM_RADIO);
1029
pageObj->m_toolId = tool->GetId();
1031
// Connect to toolbar button events.
1032
Connect(pageObj->m_toolId,
1033
wxEVT_COMMAND_TOOL_CLICKED,
1034
wxCommandEventHandler(
1035
wxPropertyGridManager::OnToolbarClick));
1037
m_pToolbar->Realize();
1044
// If selected page was above the point of insertion, fix the current page index
1045
if ( isPageInserted )
1047
if ( m_selPage >= index )
1054
// Set this value only when adding the first page
1060
m_iFlags |= wxPG_MAN_FL_PAGE_INSERTED;
1062
wxASSERT( pageObj->GetGrid() );
1067
// -----------------------------------------------------------------------
1069
bool wxPropertyGridManager::IsAnyModified() const
1072
for ( i=0; i<GetPageCount(); i++ )
1074
if ( m_arrPages[i]->GetStatePtr()->m_anyModified )
1080
// -----------------------------------------------------------------------
1082
bool wxPropertyGridManager::IsPageModified( size_t index ) const
1084
if ( m_arrPages[index]->GetStatePtr()->m_anyModified )
1089
// -----------------------------------------------------------------------
1091
#if wxUSE_HEADERCTRL
1092
void wxPropertyGridManager::ShowHeader(bool show)
1094
if ( show != m_showHeader)
1096
m_showHeader = show;
1102
// -----------------------------------------------------------------------
1104
#if wxUSE_HEADERCTRL
1105
void wxPropertyGridManager::SetColumnTitle( int idx, const wxString& title )
1107
if ( !m_pHeaderCtrl )
1110
m_pHeaderCtrl->SetColumnTitle(idx, title);
1114
// -----------------------------------------------------------------------
1116
bool wxPropertyGridManager::IsPropertySelected( wxPGPropArg id ) const
1118
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
1119
for ( unsigned int i=0; i<GetPageCount(); i++ )
1121
if ( GetPageState(i)->DoIsPropertySelected(p) )
1127
// -----------------------------------------------------------------------
1129
wxPGProperty* wxPropertyGridManager::GetPageRoot( int index ) const
1131
wxASSERT( index >= 0 );
1132
wxASSERT( index < (int)m_arrPages.size() );
1134
return m_arrPages[index]->GetStatePtr()->m_properties;
1137
// -----------------------------------------------------------------------
1139
bool wxPropertyGridManager::RemovePage( int page )
1141
wxCHECK_MSG( (page >= 0) && (page < (int)GetPageCount()),
1143
wxT("invalid page index") );
1145
wxPropertyGridPage* pd = m_arrPages[page];
1147
if ( m_arrPages.size() == 1 )
1149
// Last page: do not remove page entry
1150
m_pPropGrid->Clear();
1152
m_iFlags &= ~wxPG_MAN_FL_PAGE_INSERTED;
1153
pd->m_label.clear();
1156
// Change selection if current is page
1157
else if ( page == m_selPage )
1159
if ( !m_pPropGrid->ClearSelection() )
1162
// Substitute page to select
1163
int substitute = page - 1;
1164
if ( substitute < 0 )
1165
substitute = page + 1;
1167
SelectPage(substitute);
1170
// Remove toolbar icon
1172
if ( HasFlag(wxPG_TOOLBAR) )
1174
wxASSERT( m_pToolbar );
1176
int toolPos = GetExtraStyle() & wxPG_EX_MODE_BUTTONS ? 3 : 0;
1179
// Delete separator as well, for consistency
1180
if ( (GetExtraStyle() & wxPG_EX_MODE_BUTTONS) &&
1181
GetPageCount() == 1 )
1182
m_pToolbar->DeleteToolByPos(2);
1184
m_pToolbar->DeleteToolByPos(toolPos);
1188
if ( m_arrPages.size() > 1 )
1190
m_arrPages.erase(m_arrPages.begin() + page);
1194
// Adjust indexes that were above removed
1195
if ( m_selPage > page )
1201
// -----------------------------------------------------------------------
1203
bool wxPropertyGridManager::ProcessEvent( wxEvent& event )
1205
int evtType = event.GetEventType();
1207
// NB: For some reason, under wxPython, Connect in Init doesn't work properly,
1208
// so we'll need to call OnPropertyGridSelect manually. Multiple call's
1209
// don't really matter.
1210
if ( evtType == wxEVT_PG_SELECTED )
1211
OnPropertyGridSelect((wxPropertyGridEvent&)event);
1213
// Property grid events get special attention
1214
if ( evtType >= wxPG_BASE_EVT_TYPE &&
1215
evtType < (wxPG_MAX_EVT_TYPE) &&
1218
wxPropertyGridPage* page = GetPage(m_selPage);
1219
wxPropertyGridEvent* pgEvent = wxDynamicCast(&event, wxPropertyGridEvent);
1221
// Add property grid events to appropriate custom pages
1222
// but stop propagating to parent if page says it is
1223
// handling everything.
1224
if ( pgEvent && !page->m_isDefault )
1226
/*if ( pgEvent->IsPending() )
1227
page->AddPendingEvent(event);
1229
page->ProcessEvent(event);
1231
if ( page->IsHandlingAllEvents() )
1232
event.StopPropagation();
1236
return wxPanel::ProcessEvent(event);
1239
// -----------------------------------------------------------------------
1241
void wxPropertyGridManager::RepaintDescBoxDecorations( wxDC& dc,
1247
wxColour bgcol = GetBackgroundColour();
1250
int rectHeight = m_splitterHeight;
1251
dc.DrawRectangle(0, newSplitterY, newWidth, rectHeight);
1252
dc.SetPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW) );
1253
int splitterBottom = newSplitterY + m_splitterHeight - 1;
1254
int boxHeight = newHeight - splitterBottom;
1255
if ( boxHeight > 1 )
1256
dc.DrawRectangle(0, splitterBottom, newWidth, boxHeight);
1258
dc.DrawLine(0, splitterBottom, newWidth, splitterBottom);
1261
// -----------------------------------------------------------------------
1263
void wxPropertyGridManager::UpdateDescriptionBox( int new_splittery, int new_width, int new_height )
1265
int use_hei = new_height;
1268
// Fix help control positions.
1269
int cap_hei = m_pPropGrid->m_fontHeight;
1270
int cap_y = new_splittery+m_splitterHeight+5;
1271
int cnt_y = cap_y+cap_hei+3;
1272
int sub_cap_hei = cap_y+cap_hei-use_hei;
1273
int cnt_hei = use_hei-cnt_y;
1274
if ( sub_cap_hei > 0 )
1276
cap_hei -= sub_cap_hei;
1281
m_pTxtHelpCaption->Show( false );
1282
m_pTxtHelpContent->Show( false );
1286
m_pTxtHelpCaption->SetSize(3,cap_y,new_width-6,cap_hei);
1287
m_pTxtHelpCaption->Wrap(-1);
1288
m_pTxtHelpCaption->Show( true );
1291
m_pTxtHelpContent->Show( false );
1295
m_pTxtHelpContent->SetSize(3,cnt_y,new_width-6,cnt_hei);
1296
m_pTxtHelpContent->Show( true );
1300
wxRect r(0, new_splittery, new_width, new_height-new_splittery);
1303
m_splitterY = new_splittery;
1305
m_iFlags &= ~(wxPG_FL_DESC_REFRESH_REQUIRED);
1308
// -----------------------------------------------------------------------
1310
void wxPropertyGridManager::RecalculatePositions( int width, int height )
1313
int propgridBottomY = height;
1315
// Toolbar at the top.
1319
m_pToolbar->SetSize(0, 0, width, -1);
1320
propgridY += m_pToolbar->GetSize().y;
1322
if (GetExtraStyle() & wxPG_EX_TOOLBAR_SEPARATOR)
1327
// Header comes after the tool bar
1328
#if wxUSE_HEADERCTRL
1331
m_pHeaderCtrl->SetSize(0, propgridY, width, -1);
1332
propgridY += m_pHeaderCtrl->GetSize().y;
1337
if ( m_pTxtHelpCaption )
1339
int new_splittery = m_splitterY;
1342
if ( ( m_splitterY >= 0 || m_nextDescBoxSize ) && m_height > 32 )
1344
if ( m_nextDescBoxSize >= 0 )
1346
new_splittery = m_height - m_nextDescBoxSize - m_splitterHeight;
1347
m_nextDescBoxSize = -1;
1349
new_splittery += (height-m_height);
1353
new_splittery = height - wxPGMAN_DEFAULT_NEGATIVE_SPLITTER_Y;
1354
if ( new_splittery < 32 )
1358
// Check if beyond minimum.
1359
int nspy_min = propgridY + m_pPropGrid->m_lineHeight;
1360
if ( new_splittery < nspy_min )
1361
new_splittery = nspy_min;
1363
propgridBottomY = new_splittery;
1365
UpdateDescriptionBox( new_splittery, width, height );
1368
if ( m_iFlags & wxPG_FL_INITIALIZED )
1370
int pgh = propgridBottomY - propgridY;
1373
m_pPropGrid->SetSize( 0, propgridY, width, pgh );
1375
m_extraHeight = height - pgh;
1382
// -----------------------------------------------------------------------
1384
void wxPropertyGridManager::SetDescBoxHeight( int ht, bool refresh )
1386
if ( m_windowStyle & wxPG_DESCRIPTION )
1388
if ( ht != GetDescBoxHeight() )
1390
m_nextDescBoxSize = ht;
1392
RecalculatePositions(m_width, m_height);
1397
// -----------------------------------------------------------------------
1399
int wxPropertyGridManager::GetDescBoxHeight() const
1401
return GetClientSize().y - m_splitterY - m_splitterHeight;
1404
// -----------------------------------------------------------------------
1406
void wxPropertyGridManager::OnPaint( wxPaintEvent& WXUNUSED(event) )
1410
// Update everything inside the box
1411
wxRect r = GetUpdateRegion().GetBox();
1413
if (GetExtraStyle() & wxPG_EX_TOOLBAR_SEPARATOR)
1415
if (m_pToolbar && m_pPropGrid)
1417
wxPen marginPen(m_pPropGrid->GetMarginColour());
1418
dc.SetPen(marginPen);
1420
int y = m_pPropGrid->GetPosition().y-1;
1421
dc.DrawLine(0, y, GetClientSize().x, y);
1425
// Repaint splitter and any other description box decorations
1426
if ( (r.y + r.height) >= m_splitterY && m_splitterY != -1)
1427
RepaintDescBoxDecorations( dc, m_splitterY, m_width, m_height );
1430
// -----------------------------------------------------------------------
1432
void wxPropertyGridManager::Refresh(bool eraseBackground, const wxRect* rect )
1434
m_pPropGrid->Refresh(eraseBackground);
1435
wxWindow::Refresh(eraseBackground,rect);
1438
// -----------------------------------------------------------------------
1440
void wxPropertyGridManager::RefreshProperty( wxPGProperty* p )
1442
wxPropertyGrid* grid = p->GetGrid();
1444
if ( GetPage(m_selPage)->GetStatePtr() == p->GetParent()->GetParentState() )
1445
grid->RefreshProperty(p);
1448
// -----------------------------------------------------------------------
1450
void wxPropertyGridManager::RecreateControls()
1453
bool was_shown = IsShown();
1458
if ( m_windowStyle & wxPG_TOOLBAR )
1463
long toolBarFlags = ((GetExtraStyle()&wxPG_EX_NO_FLAT_TOOLBAR)?0:wxTB_FLAT);
1464
if (GetExtraStyle() & wxPG_EX_NO_TOOLBAR_DIVIDER)
1465
toolBarFlags |= wxTB_NODIVIDER;
1467
m_pToolbar = new wxToolBar(this, wxID_ANY,
1471
m_pToolbar->SetToolBitmapSize(wxSize(16, 15));
1473
#if defined(__WXMSW__)
1474
// Eliminate toolbar flicker on XP
1475
// NOTE: Not enabled since it corrupts drawing somewhat.
1478
#ifndef WS_EX_COMPOSITED
1479
#define WS_EX_COMPOSITED 0x02000000L
1482
HWND hWnd = (HWND)m_pToolbar->GetHWND();
1484
::SetWindowLong( hWnd, GWL_EXSTYLE,
1485
::GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_COMPOSITED );
1490
m_pToolbar->SetCursor ( *wxSTANDARD_CURSOR );
1492
if ( (GetExtraStyle()&wxPG_EX_MODE_BUTTONS) )
1494
wxString desc1(_("Categorized Mode"));
1495
wxString desc2(_("Alphabetic Mode"));
1497
wxToolBarToolBase* tool;
1499
tool = m_pToolbar->AddTool(wxID_ANY,
1501
wxBitmap(gs_xpm_catmode),
1504
m_categorizedModeToolId = tool->GetId();
1506
tool = m_pToolbar->AddTool(wxID_ANY,
1508
wxBitmap(gs_xpm_noncatmode),
1511
m_alphabeticModeToolId = tool->GetId();
1513
m_pToolbar->Realize();
1515
Connect(m_categorizedModeToolId,
1516
wxEVT_COMMAND_TOOL_CLICKED,
1517
wxCommandEventHandler(
1518
wxPropertyGridManager::OnToolbarClick));
1519
Connect(m_alphabeticModeToolId,
1520
wxEVT_COMMAND_TOOL_CLICKED,
1521
wxCommandEventHandler(
1522
wxPropertyGridManager::OnToolbarClick));
1526
m_categorizedModeToolId = -1;
1527
m_alphabeticModeToolId = -1;
1532
if ( (GetExtraStyle() & wxPG_EX_MODE_BUTTONS) )
1534
// Toggle correct mode button.
1535
// TODO: This doesn't work in wxMSW (when changing,
1536
// both items will get toggled).
1537
int toggle_but_on_ind;
1538
int toggle_but_off_ind;
1539
if ( m_pPropGrid->m_pState->IsInNonCatMode() )
1541
toggle_but_on_ind = m_alphabeticModeToolId;
1542
toggle_but_off_ind = m_categorizedModeToolId;
1546
toggle_but_on_ind = m_categorizedModeToolId;
1547
toggle_but_off_ind = m_alphabeticModeToolId;
1550
m_pToolbar->ToggleTool(toggle_but_on_ind, true);
1551
m_pToolbar->ToggleTool(toggle_but_off_ind, false);
1559
m_pToolbar->Destroy();
1564
#if wxUSE_HEADERCTRL
1569
if ( !m_pHeaderCtrl )
1571
hc = new wxPGHeaderCtrl(this);
1572
hc->Create(this, wxID_ANY);
1577
m_pHeaderCtrl->Show();
1580
m_pHeaderCtrl->OnPageChanged(GetCurrentPage());
1584
if ( m_pHeaderCtrl )
1585
m_pHeaderCtrl->Hide();
1589
if ( m_windowStyle & wxPG_DESCRIPTION )
1592
m_pPropGrid->m_iFlags |= (wxPG_FL_NOSTATUSBARHELP);
1594
if ( !m_pTxtHelpCaption )
1596
m_pTxtHelpCaption = new wxStaticText(this,
1601
wxALIGN_LEFT|wxST_NO_AUTORESIZE);
1602
m_pTxtHelpCaption->SetFont( m_pPropGrid->m_captionFont );
1603
m_pTxtHelpCaption->SetCursor( *wxSTANDARD_CURSOR );
1605
if ( !m_pTxtHelpContent )
1607
m_pTxtHelpContent = new wxStaticText(this,
1612
wxALIGN_LEFT|wxST_NO_AUTORESIZE);
1613
m_pTxtHelpContent->SetCursor( *wxSTANDARD_CURSOR );
1616
SetDescribedProperty(GetSelection());
1621
m_pPropGrid->m_iFlags &= ~(wxPG_FL_NOSTATUSBARHELP);
1623
if ( m_pTxtHelpCaption )
1624
m_pTxtHelpCaption->Destroy();
1626
m_pTxtHelpCaption = NULL;
1628
if ( m_pTxtHelpContent )
1629
m_pTxtHelpContent->Destroy();
1631
m_pTxtHelpContent = NULL;
1636
GetClientSize(&width,&height);
1638
RecalculatePositions(width,height);
1644
// -----------------------------------------------------------------------
1646
wxPGProperty* wxPropertyGridManager::DoGetPropertyByName( const wxString& name ) const
1649
for ( i=0; i<GetPageCount(); i++ )
1651
wxPropertyGridPageState* pState = m_arrPages[i]->GetStatePtr();
1652
wxPGProperty* p = pState->BaseGetPropertyByName(name);
1661
// -----------------------------------------------------------------------
1663
bool wxPropertyGridManager::EnsureVisible( wxPGPropArg id )
1665
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
1667
wxPropertyGridPageState* parentState = p->GetParentState();
1669
// Select correct page.
1670
if ( m_pPropGrid->m_pState != parentState )
1671
DoSelectPage( GetPageByState(parentState) );
1673
return m_pPropGrid->EnsureVisible(id);
1676
// -----------------------------------------------------------------------
1678
void wxPropertyGridManager::OnToolbarClick( wxCommandEvent &event )
1680
int id = event.GetId();
1682
if ( id == m_categorizedModeToolId )
1684
// Categorized mode.
1685
if ( m_pPropGrid->m_windowStyle & wxPG_HIDE_CATEGORIES )
1687
if ( !m_pPropGrid->HasInternalFlag(wxPG_FL_CATMODE_AUTO_SORT) )
1688
m_pPropGrid->m_windowStyle &= ~wxPG_AUTO_SORT;
1689
m_pPropGrid->EnableCategories( true );
1692
else if ( id == m_alphabeticModeToolId )
1695
if ( !(m_pPropGrid->m_windowStyle & wxPG_HIDE_CATEGORIES) )
1697
if ( m_pPropGrid->HasFlag(wxPG_AUTO_SORT) )
1698
m_pPropGrid->SetInternalFlag(wxPG_FL_CATMODE_AUTO_SORT);
1700
m_pPropGrid->ClearInternalFlag(wxPG_FL_CATMODE_AUTO_SORT);
1702
m_pPropGrid->m_windowStyle |= wxPG_AUTO_SORT;
1703
m_pPropGrid->EnableCategories( false );
1712
wxPropertyGridPage* pdc;
1714
// Find page with given id.
1715
for ( i=0; i<GetPageCount(); i++ )
1717
pdc = m_arrPages[i];
1718
if ( pdc->m_toolId == id )
1725
wxASSERT( index >= 0 );
1727
if ( DoSelectPage( index ) )
1729
// Event dispatching must be last.
1730
m_pPropGrid->SendEvent( wxEVT_PG_PAGE_CHANGED, NULL );
1734
// TODO: Depress the old button on toolbar.
1739
// -----------------------------------------------------------------------
1741
bool wxPropertyGridManager::SetEditableStateItem( const wxString& name, wxVariant value )
1743
if ( name == wxS("descboxheight") )
1745
SetDescBoxHeight(value.GetLong(), true);
1751
// -----------------------------------------------------------------------
1753
wxVariant wxPropertyGridManager::GetEditableStateItem( const wxString& name ) const
1755
if ( name == wxS("descboxheight") )
1757
return (long) GetDescBoxHeight();
1759
return wxNullVariant;
1762
// -----------------------------------------------------------------------
1764
void wxPropertyGridManager::SetDescription( const wxString& label, const wxString& content )
1766
if ( m_pTxtHelpCaption )
1768
wxSize osz1 = m_pTxtHelpCaption->GetSize();
1769
wxSize osz2 = m_pTxtHelpContent->GetSize();
1771
m_pTxtHelpCaption->SetLabel(label);
1772
m_pTxtHelpContent->SetLabel(content);
1774
m_pTxtHelpCaption->SetSize(-1,osz1.y);
1775
m_pTxtHelpContent->SetSize(-1,osz2.y);
1777
UpdateDescriptionBox( m_splitterY, m_width, m_height );
1781
// -----------------------------------------------------------------------
1783
void wxPropertyGridManager::SetDescribedProperty( wxPGProperty* p )
1785
if ( m_pTxtHelpCaption )
1789
SetDescription( p->GetLabel(), p->GetHelpString() );
1793
SetDescription( wxEmptyString, wxEmptyString );
1798
// -----------------------------------------------------------------------
1800
void wxPropertyGridManager::SetSplitterLeft( bool subProps, bool allPages )
1804
m_pPropGrid->SetSplitterLeft(subProps);
1808
wxClientDC dc(this);
1809
dc.SetFont(m_pPropGrid->GetFont());
1814
for ( i=0; i<GetPageCount(); i++ )
1816
int maxW = m_pState->GetColumnFitWidth(dc, m_arrPages[i]->m_properties, 0, subProps );
1817
maxW += m_pPropGrid->m_marginWidth;
1818
if ( maxW > highest )
1820
m_pState->m_dontCenterSplitter = true;
1824
SetSplitterPosition( highest );
1827
#if wxUSE_HEADERCTRL
1829
m_pHeaderCtrl->OnColumWidthsChanged();
1833
void wxPropertyGridManager::SetPageSplitterLeft(int page, bool subProps)
1835
wxASSERT_MSG( (page < (int) GetPageCount()),
1836
wxT("SetPageSplitterLeft() has no effect until pages have been added") );
1838
if (page < (int) GetPageCount())
1840
wxClientDC dc(this);
1841
dc.SetFont(m_pPropGrid->GetFont());
1843
int maxW = m_pState->GetColumnFitWidth(dc, m_arrPages[page]->m_properties, 0, subProps );
1844
maxW += m_pPropGrid->m_marginWidth;
1845
SetPageSplitterPosition( page, maxW );
1847
#if wxUSE_HEADERCTRL
1849
m_pHeaderCtrl->OnColumWidthsChanged();
1854
// -----------------------------------------------------------------------
1856
void wxPropertyGridManager::OnPropertyGridSelect( wxPropertyGridEvent& event )
1859
wxASSERT_MSG( GetId() == m_pPropGrid->GetId(),
1860
wxT("wxPropertyGridManager id must be set with wxPropertyGridManager::SetId (not wxWindow::SetId).") );
1862
SetDescribedProperty(event.GetProperty());
1866
// -----------------------------------------------------------------------
1869
wxPropertyGridManager::OnPGColDrag( wxPropertyGridEvent& WXUNUSED(event) )
1871
#if wxUSE_HEADERCTRL
1872
if ( !m_showHeader )
1875
m_pHeaderCtrl->OnColumWidthsChanged();
1879
// -----------------------------------------------------------------------
1881
void wxPropertyGridManager::OnResize( wxSizeEvent& WXUNUSED(event) )
1885
GetClientSize(&width, &height);
1887
if ( m_width == -12345 )
1890
RecalculatePositions(width, height);
1892
if ( m_pPropGrid && m_pPropGrid->m_parent )
1894
int pgWidth, pgHeight;
1895
m_pPropGrid->GetClientSize(&pgWidth, &pgHeight);
1897
// Regenerate splitter positions for non-current pages
1898
for ( unsigned int i=0; i<GetPageCount(); i++ )
1900
wxPropertyGridPage* page = GetPage(i);
1901
if ( page != m_pPropGrid->GetState() )
1903
page->OnClientWidthChange(pgWidth,
1904
pgWidth - page->m_width,
1911
// -----------------------------------------------------------------------
1913
void wxPropertyGridManager::OnMouseEntry( wxMouseEvent& WXUNUSED(event) )
1915
// Correct cursor. This is required atleast for wxGTK, for which
1916
// setting button's cursor to *wxSTANDARD_CURSOR does not work.
1917
SetCursor( wxNullCursor );
1921
// -----------------------------------------------------------------------
1923
void wxPropertyGridManager::OnMouseMove( wxMouseEvent &event )
1925
if ( !m_pTxtHelpCaption )
1930
if ( m_dragStatus > 0 )
1932
int sy = y - m_dragOffset;
1934
// Calculate drag limits
1935
int bottom_limit = m_height - m_splitterHeight + 1;
1936
int top_limit = m_pPropGrid->m_lineHeight;
1938
if ( m_pToolbar ) top_limit += m_pToolbar->GetSize().y;
1941
if ( sy >= top_limit && sy < bottom_limit )
1944
int change = sy - m_splitterY;
1949
m_pPropGrid->SetSize( m_width, m_splitterY - m_pPropGrid->GetPosition().y );
1950
UpdateDescriptionBox( m_splitterY, m_width, m_height );
1952
m_extraHeight -= change;
1953
InvalidateBestSize();
1961
if ( y >= m_splitterY && y < (m_splitterY+m_splitterHeight+2) )
1963
SetCursor ( m_cursorSizeNS );
1970
SetCursor ( wxNullCursor );
1977
// -----------------------------------------------------------------------
1979
void wxPropertyGridManager::OnMouseClick( wxMouseEvent &event )
1983
// Click on splitter.
1984
if ( y >= m_splitterY && y < (m_splitterY+m_splitterHeight+2) )
1986
if ( m_dragStatus == 0 )
1989
// Begin draggin the splitter
1996
m_dragOffset = y - m_splitterY;
2002
// -----------------------------------------------------------------------
2004
void wxPropertyGridManager::OnMouseUp( wxMouseEvent &event )
2006
// No event type check - basicly calling this method should
2007
// just stop dragging.
2009
if ( m_dragStatus >= 1 )
2012
// End Splitter Dragging
2017
// DO NOT ENABLE FOLLOWING LINE!
2018
// (it is only here as a reminder to not to do it)
2021
// This is necessary to return cursor
2024
// Set back the default cursor, if necessary
2025
if ( y < m_splitterY || y >= (m_splitterY+m_splitterHeight+2) )
2027
SetCursor ( wxNullCursor );
2034
// -----------------------------------------------------------------------
2036
void wxPropertyGridManager::SetSplitterPosition( int pos, int splitterColumn )
2038
wxASSERT_MSG( GetPageCount(),
2039
wxT("SetSplitterPosition() has no effect until pages have been added") );
2042
for ( i=0; i<GetPageCount(); i++ )
2044
wxPropertyGridPage* page = GetPage(i);
2045
page->DoSetSplitterPosition( pos, splitterColumn,
2046
wxPG_SPLITTER_REFRESH );
2049
#if wxUSE_HEADERCTRL
2051
m_pHeaderCtrl->OnColumWidthsChanged();
2055
// -----------------------------------------------------------------------
2057
void wxPropertyGridManager::SetPageSplitterPosition( int page,
2061
GetPage(page)->DoSetSplitterPosition( pos, column );
2063
#if wxUSE_HEADERCTRL
2065
m_pHeaderCtrl->OnColumWidthsChanged();
2069
// -----------------------------------------------------------------------
2070
// wxPGVIterator_Manager
2071
// -----------------------------------------------------------------------
2073
// Default returned by wxPropertyGridInterface::CreateVIterator().
2074
class wxPGVIteratorBase_Manager : public wxPGVIteratorBase
2077
wxPGVIteratorBase_Manager( wxPropertyGridManager* manager, int flags )
2078
: m_manager(manager), m_flags(flags), m_curPage(0)
2080
m_it.Init(manager->GetPage(0), flags);
2082
virtual ~wxPGVIteratorBase_Manager() { }
2091
if ( m_curPage < m_manager->GetPageCount() )
2092
m_it.Init( m_manager->GetPage(m_curPage), m_flags );
2096
wxPropertyGridManager* m_manager;
2098
unsigned int m_curPage;
2101
wxPGVIterator wxPropertyGridManager::GetVIterator( int flags ) const
2103
return wxPGVIterator( new wxPGVIteratorBase_Manager( (wxPropertyGridManager*)this, flags ) );
2106
#endif // wxUSE_PROPGRID