wxPropertyGrid: added wxPG_NO_INTERNAL_BORDER, wxPG_EX_NO_TOOLBAR_DIVIDER
and wxPG_EX_TOOLBAR_SEPARATOR styles for finer control over borders. Borders around property grid are now native for consistency. Some strange VC6 compiler errors fixed, plus size assertion in sample. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8a05a8d7d0
commit
521f1d8371
@ -403,6 +403,9 @@ All (GUI):
|
||||
- Fixed wxOwnerDrawComboCtrl popup size on Mac (scrollbars were always shown).
|
||||
- Fixed wxOwnerDrawComboCtrl focus problem on Mac (first-time popup
|
||||
dismissed immediately as text control grabbed the focus).
|
||||
- wxPropertyGrid: added wxPG_NO_INTERNAL_BORDER, wxPG_EX_NO_TOOLBAR_DIVIDER
|
||||
and wxPG_EX_TOOLBAR_SEPARATOR styles for finer control over borders.
|
||||
Borders around property grid are now native for consistency.
|
||||
|
||||
GTK:
|
||||
|
||||
|
@ -181,8 +181,11 @@ wxPG_TOOLBAR = 0x00001000,
|
||||
/** wxPropertyGridManager only: Show adjustable text box showing description
|
||||
or help text, if available, for currently selected property.
|
||||
*/
|
||||
wxPG_DESCRIPTION = 0x00002000
|
||||
wxPG_DESCRIPTION = 0x00002000,
|
||||
|
||||
/** wxPropertyGridManager only: don't show an internal border around the property grid
|
||||
*/
|
||||
wxPG_NO_INTERNAL_BORDER = 0x00004000
|
||||
};
|
||||
|
||||
enum wxPG_EX_WINDOW_STYLES
|
||||
@ -273,7 +276,15 @@ wxPG_EX_MULTIPLE_SELECTION = 0x02000000,
|
||||
wxPropertyGrid's top-level parent window on its own, then you
|
||||
are recommended to enable this style.
|
||||
*/
|
||||
wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000
|
||||
wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000,
|
||||
|
||||
/** Don't show divider above toolbar, on Windows.
|
||||
*/
|
||||
wxPG_EX_NO_TOOLBAR_DIVIDER = 0x04000000,
|
||||
|
||||
/** Show a separator below the toolbar.
|
||||
*/
|
||||
wxPG_EX_TOOLBAR_SEPARATOR = 0x08000000
|
||||
|
||||
};
|
||||
|
||||
|
@ -89,7 +89,11 @@ wxPG_TOOLBAR = 0x00001000,
|
||||
wxPropertyGridManager only: Show adjustable text box showing description
|
||||
or help text, if available, for currently selected property.
|
||||
*/
|
||||
wxPG_DESCRIPTION = 0x00002000
|
||||
wxPG_DESCRIPTION = 0x00002000,
|
||||
|
||||
/** wxPropertyGridManager only: don't show an internal border around the property grid
|
||||
*/
|
||||
wxPG_NO_INTERNAL_BORDER = 0x00004000
|
||||
|
||||
};
|
||||
|
||||
@ -178,7 +182,15 @@ wxPG_EX_MULTIPLE_SELECTION = 0x02000000,
|
||||
wxPropertyGrid's top-level parent window on its own, then you
|
||||
are recommended to enable this style.
|
||||
*/
|
||||
wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000
|
||||
wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000,
|
||||
|
||||
/** Don't show divider above toolbar, on Windows.
|
||||
*/
|
||||
wxPG_EX_NO_TOOLBAR_DIVIDER = 0x04000000,
|
||||
|
||||
/** Show a separator below the toolbar.
|
||||
*/
|
||||
wxPG_EX_TOOLBAR_SEPARATOR = 0x08000000
|
||||
|
||||
};
|
||||
|
||||
|
@ -2091,7 +2091,10 @@ void FormMain::CreateGrid( int style, int extraStyle )
|
||||
// event handling will obviously be broken.
|
||||
PGID, /*wxID_ANY*/
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxSize(100, 100), // FIXME: wxDefaultSize gives assertion in propgrid.
|
||||
// But calling SetInitialSize in manager changes the code
|
||||
// order to the grid gets created immediately, before SetExtraStyle
|
||||
// is called.
|
||||
style );
|
||||
|
||||
m_propGrid = pgman->GetGrid();
|
||||
@ -2936,6 +2939,7 @@ void FormMain::OnSelectStyle( wxCommandEvent& WXUNUSED(event) )
|
||||
ADD_FLAG(wxPG_LIMITED_EDITING)
|
||||
ADD_FLAG(wxPG_TOOLBAR)
|
||||
ADD_FLAG(wxPG_DESCRIPTION)
|
||||
ADD_FLAG(wxPG_NO_INTERNAL_BORDER)
|
||||
wxMultiChoiceDialog dlg( this, wxT("Select window styles to use"),
|
||||
wxT("wxPropertyGrid Window Style"), chs );
|
||||
dlg.SetSelections(sel);
|
||||
@ -2966,6 +2970,8 @@ void FormMain::OnSelectStyle( wxCommandEvent& WXUNUSED(event) )
|
||||
ADD_FLAG(wxPG_EX_HIDE_PAGE_BUTTONS)
|
||||
ADD_FLAG(wxPG_EX_MULTIPLE_SELECTION)
|
||||
ADD_FLAG(wxPG_EX_ENABLE_TLP_TRACKING)
|
||||
ADD_FLAG(wxPG_EX_NO_TOOLBAR_DIVIDER)
|
||||
ADD_FLAG(wxPG_EX_TOOLBAR_SEPARATOR)
|
||||
wxMultiChoiceDialog dlg( this, wxT("Select extra window styles to use"),
|
||||
wxT("wxPropertyGrid Extra Style"), chs );
|
||||
dlg.SetSelections(sel);
|
||||
|
@ -289,6 +289,11 @@ bool wxPropertyGridManager::Create( wxWindow *parent,
|
||||
name );
|
||||
Init2(style);
|
||||
|
||||
// FIXME: this changes call ordering so wxPropertyGrid is created
|
||||
// immediately, before SetExtraStyle has a chance to be called. However,
|
||||
// without it, we may get assertions if size is wxDefaultSize.
|
||||
//SetInitialSize(size);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -329,15 +334,9 @@ void wxPropertyGridManager::Init1()
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// These flags are always used in wxPropertyGrid integrated in wxPropertyGridManager.
|
||||
#ifndef __WXMAC__
|
||||
#define wxPG_MAN_PROPGRID_FORCED_FLAGS (wxSIMPLE_BORDER| \
|
||||
#define wxPG_MAN_PROPGRID_FORCED_FLAGS ( wxBORDER_THEME | \
|
||||
wxNO_FULL_REPAINT_ON_RESIZE| \
|
||||
wxCLIP_CHILDREN)
|
||||
#else
|
||||
#define wxPG_MAN_PROPGRID_FORCED_FLAGS (wxNO_BORDER| \
|
||||
wxNO_FULL_REPAINT_ON_RESIZE| \
|
||||
wxCLIP_CHILDREN)
|
||||
#endif
|
||||
|
||||
// Which flags can be passed to underlying wxPropertyGrid.
|
||||
#define wxPG_MAN_PASS_FLAGS_MASK (0xFFF0|wxTAB_TRAVERSAL)
|
||||
@ -380,10 +379,23 @@ void wxPropertyGridManager::Init2( int style )
|
||||
SetWindowVariant(wxWINDOW_VARIANT_SMALL);
|
||||
#endif
|
||||
|
||||
long propGridFlags = (m_windowStyle&wxPG_MAN_PASS_FLAGS_MASK)
|
||||
|wxPG_MAN_PROPGRID_FORCED_FLAGS;
|
||||
|
||||
propGridFlags &= ~wxBORDER_MASK;
|
||||
|
||||
if ((style & wxPG_NO_INTERNAL_BORDER) == 0)
|
||||
{
|
||||
propGridFlags |= wxBORDER_THEME;
|
||||
}
|
||||
else
|
||||
{
|
||||
propGridFlags |= wxBORDER_NONE;
|
||||
wxWindow::SetExtraStyle(wxPG_EX_TOOLBAR_SEPARATOR);
|
||||
}
|
||||
|
||||
// Create propertygrid.
|
||||
m_pPropGrid->Create(this,baseId,wxPoint(0,0),csz,
|
||||
(m_windowStyle&wxPG_MAN_PASS_FLAGS_MASK)
|
||||
|wxPG_MAN_PROPGRID_FORCED_FLAGS);
|
||||
m_pPropGrid->Create(this,baseId,wxPoint(0,0),csz, propGridFlags);
|
||||
|
||||
m_pPropGrid->m_eventObject = this;
|
||||
|
||||
@ -1089,6 +1101,9 @@ void wxPropertyGridManager::RecalculatePositions( int width, int height )
|
||||
{
|
||||
m_pToolbar->SetSize(0, 0, width, -1);
|
||||
propgridY += m_pToolbar->GetSize().y;
|
||||
|
||||
if (GetExtraStyle() & wxPG_EX_TOOLBAR_SEPARATOR)
|
||||
propgridY += 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1169,8 +1184,20 @@ void wxPropertyGridManager::OnPaint( wxPaintEvent& WXUNUSED(event) )
|
||||
// Update everything inside the box
|
||||
wxRect r = GetUpdateRegion().GetBox();
|
||||
|
||||
if (GetExtraStyle() & wxPG_EX_TOOLBAR_SEPARATOR)
|
||||
{
|
||||
if (m_pToolbar && m_pPropGrid)
|
||||
{
|
||||
wxPen marginPen(m_pPropGrid->GetMarginColour());
|
||||
dc.SetPen(marginPen);
|
||||
|
||||
int y = m_pPropGrid->GetPosition().y-1;
|
||||
dc.DrawLine(0, y, GetClientSize().x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// Repaint splitter and any other description box decorations
|
||||
if ( (r.y + r.height) >= m_splitterY )
|
||||
if ( (r.y + r.height) >= m_splitterY && m_splitterY != -1)
|
||||
RepaintDescBoxDecorations( dc, m_splitterY, m_width, m_height );
|
||||
}
|
||||
|
||||
@ -1211,10 +1238,13 @@ void wxPropertyGridManager::RecreateControls()
|
||||
// Has toolbar.
|
||||
if ( !m_pToolbar )
|
||||
{
|
||||
long toolBarFlags = ((GetExtraStyle()&wxPG_EX_NO_FLAT_TOOLBAR)?0:wxTB_FLAT);
|
||||
if (GetExtraStyle() & wxPG_EX_NO_TOOLBAR_DIVIDER)
|
||||
toolBarFlags |= wxTB_NODIVIDER;
|
||||
|
||||
m_pToolbar = new wxToolBar(this,baseId+ID_ADVTOOLBAR_OFFSET,
|
||||
wxDefaultPosition,wxDefaultSize,
|
||||
((GetExtraStyle()&wxPG_EX_NO_FLAT_TOOLBAR)?0:wxTB_FLAT)
|
||||
/*| wxTB_HORIZONTAL | wxNO_BORDER*/ );
|
||||
toolBarFlags);
|
||||
m_pToolbar->SetToolBitmapSize(wxSize(16, 15));
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
|
@ -1430,10 +1430,14 @@ void wxPGProperty::EnsureCells( unsigned int column )
|
||||
wxPropertyGrid* pg = GetGrid();
|
||||
wxPGCell defaultCell;
|
||||
|
||||
// Work around possible VC6 bug by using intermediate variables
|
||||
const wxPGCell& propDefCell = pg->GetPropertyDefaultCell();
|
||||
const wxPGCell& catDefCell = pg->GetCategoryDefaultCell();
|
||||
|
||||
if ( !HasFlag(wxPG_PROP_CATEGORY) )
|
||||
defaultCell = pg->GetPropertyDefaultCell();
|
||||
defaultCell = propDefCell;
|
||||
else
|
||||
defaultCell = pg->GetCategoryDefaultCell();
|
||||
defaultCell = catDefCell;
|
||||
|
||||
// TODO: Replace with resize() call
|
||||
unsigned int cellCountMax = column+1;
|
||||
|
@ -394,8 +394,10 @@ bool wxPropertyGrid::Create( wxWindow *parent,
|
||||
const wxString& name )
|
||||
{
|
||||
|
||||
if ( !(style&wxBORDER_MASK) )
|
||||
style |= wxSIMPLE_BORDER;
|
||||
if (!(style&wxBORDER_MASK))
|
||||
{
|
||||
style |= wxBORDER_THEME;
|
||||
}
|
||||
|
||||
style |= wxVSCROLL;
|
||||
|
||||
@ -635,7 +637,9 @@ wxPropertyGrid::~wxPropertyGrid()
|
||||
// Delete common value records
|
||||
for ( i=0; i<m_commonValues.size(); i++ )
|
||||
{
|
||||
delete GetCommonValue(i);
|
||||
// Use temporary variable to work around possible strange VC6 (asserts because m_size is zero)
|
||||
wxPGCommonValue* value = m_commonValues[i];
|
||||
delete value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1451,7 +1455,7 @@ bool wxPropertyGrid::SetFont( const wxFont& font )
|
||||
DoClearSelection();
|
||||
|
||||
bool res = wxScrolledWindow::SetFont( font );
|
||||
if ( res && GetParent()) // may not have been Create()ed yet
|
||||
if ( res && GetParent()) // may not have been Create()ed yet if SetFont called from SetWindowVariant
|
||||
{
|
||||
CalculateFontAndBitmapStuff( m_vspacing );
|
||||
Refresh();
|
||||
@ -2165,8 +2169,28 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
|
||||
|
||||
int y2 = y + lh;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Margin Edge
|
||||
dc.DrawLine( greyDepthX, y, greyDepthX, y2 );
|
||||
// Modified by JACS to not draw a margin if wxPG_HIDE_MARGIN is specified, since it
|
||||
// looks better, at least under Windows when we have a themed border (the themed-window-specific
|
||||
// whitespace between the real border and the propgrid margin exacerbates the double-border look).
|
||||
|
||||
// Is this or its parent themed?
|
||||
bool suppressMarginEdge = (GetWindowStyle() & wxPG_HIDE_MARGIN) &&
|
||||
(((GetWindowStyle() & wxBORDER_MASK) == wxBORDER_THEME) ||
|
||||
(((GetWindowStyle() & wxBORDER_MASK) == wxBORDER_NONE) && ((GetParent()->GetWindowStyle() & wxBORDER_MASK) == wxBORDER_THEME)));
|
||||
#else
|
||||
bool suppressMarginEdge = false;
|
||||
#endif
|
||||
if (!suppressMarginEdge)
|
||||
dc.DrawLine( greyDepthX, y, greyDepthX, y2 );
|
||||
else
|
||||
{
|
||||
// Blank out the margin edge
|
||||
dc.SetPen(wxPen(GetBackgroundColour()));
|
||||
dc.DrawLine( greyDepthX, y, greyDepthX, y2 );
|
||||
dc.SetPen( linepen );
|
||||
}
|
||||
|
||||
// Splitters
|
||||
unsigned int si;
|
||||
@ -4263,7 +4287,10 @@ void wxPropertyGrid::RecalculateVirtualSize( int forceXPos )
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
|
||||
m_canvas->SetSize( x, y );
|
||||
// Explicitly pass the position - works around a bug in wxWidgets when the property grid
|
||||
// has a native XP border and a contained window creeps up-and-left when size is set without
|
||||
// the position.
|
||||
m_canvas->SetSize( 0, 0, x, y );
|
||||
|
||||
m_pState->CheckColumnWidths();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user