Merge branch 'master' of https://github.com/wxWidgets/wxWidgets
This commit is contained in:
commit
0e541e7a57
@ -101,6 +101,7 @@ wxGTK:
|
||||
- Support background colour in wxDataViewCtrl attributes.
|
||||
- Improve wxSpinCtrl best size calculation.
|
||||
- Implement support for icon locations in wxMimeTypesManager (Hanmac).
|
||||
- Cosmetic fix for empty wxCheckBoxes display (Chuddah).
|
||||
|
||||
wxMSW:
|
||||
|
||||
|
@ -449,13 +449,13 @@ public:
|
||||
DoGetSize(&dcWidth, &dcHeight);
|
||||
|
||||
if ( x )
|
||||
*x = m_clipping ? m_clipX1 : 0;
|
||||
*x = m_clipping ? m_clipX1 : DeviceToLogicalX(0);
|
||||
if ( y )
|
||||
*y = m_clipping ? m_clipY1 : 0;
|
||||
*y = m_clipping ? m_clipY1 : DeviceToLogicalY(0);
|
||||
if ( w )
|
||||
*w = m_clipping ? m_clipX2 - m_clipX1 : dcWidth;
|
||||
*w = m_clipping ? m_clipX2 - m_clipX1 : DeviceToLogicalXRel(dcWidth);
|
||||
if ( h )
|
||||
*h = m_clipping ? m_clipY2 - m_clipY1 : dcHeight;
|
||||
*h = m_clipping ? m_clipY2 - m_clipY1 : DeviceToLogicalYRel(dcHeight);
|
||||
}
|
||||
|
||||
virtual void DestroyClippingRegion() { ResetClipping(); }
|
||||
|
@ -1527,8 +1527,8 @@ public:
|
||||
|
||||
// Hides or reveals the property.
|
||||
// hide - true for hide, false for reveal.
|
||||
// flags - By default changes are applied recursively. Set this paramter
|
||||
// wxPG_DONT_RECURSE to prevent this.
|
||||
// flags - By default changes are applied recursively. Set this
|
||||
// parameter to wxPG_DONT_RECURSE to prevent this.
|
||||
bool Hide( bool hide, int flags = wxPG_RECURSE );
|
||||
|
||||
// Returns true if property has visible children.
|
||||
|
@ -317,34 +317,38 @@ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxObject*, wxArrayPGObject,
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
enum wxPG_GETPROPERTYVALUES_FLAGS
|
||||
enum wxPG_PROPERTYVALUES_FLAGS
|
||||
{
|
||||
// Flag for wxPropertyGridInterface::SetProperty* functions,
|
||||
// wxPropertyGridInterface::HideProperty(), etc.
|
||||
// Apply changes only for the property in question.
|
||||
wxPG_DONT_RECURSE = 0x00000000,
|
||||
|
||||
/** Flags for wxPropertyGridInterface::GetPropertyValues */
|
||||
// Flag for wxPropertyGridInterface::GetPropertyValues().
|
||||
// Use this flag to retain category structure; each sub-category
|
||||
// will be its own wxVariantList of wxVariant.
|
||||
wxPG_KEEP_STRUCTURE = 0x00000010,
|
||||
|
||||
/** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
|
||||
// Flag for wxPropertyGridInterface::SetProperty* functions,
|
||||
// wxPropertyGridInterface::HideProperty(), etc.
|
||||
// Apply changes recursively for the property and all its children.
|
||||
wxPG_RECURSE = 0x00000020,
|
||||
|
||||
/** Include attributes for GetPropertyValues. */
|
||||
// Flag for wxPropertyGridInterface::GetPropertyValues().
|
||||
// Use this flag to include property attributes as well.
|
||||
wxPG_INC_ATTRIBUTES = 0x00000040,
|
||||
|
||||
/** Used when first starting recursion. */
|
||||
// Used when first starting recursion.
|
||||
wxPG_RECURSE_STARTS = 0x00000080,
|
||||
|
||||
/** Force value change. */
|
||||
// Force value change.
|
||||
wxPG_FORCE = 0x00000100,
|
||||
|
||||
/** Only sort categories and their immediate children.
|
||||
Sorting done by wxPG_AUTO_SORT option uses this.
|
||||
*/
|
||||
// Only sort categories and their immediate children.
|
||||
// Sorting done by wxPG_AUTO_SORT option uses this.
|
||||
wxPG_SORT_TOP_LEVEL_ONLY = 0x00000200
|
||||
|
||||
};
|
||||
|
||||
/** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
|
||||
#define wxPG_DONT_RECURSE 0x00000000
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// Misc. argument flags.
|
||||
|
@ -85,10 +85,22 @@ public:
|
||||
|
||||
bool IsKindOf(const wxClassInfo *info) const
|
||||
{
|
||||
return info != 0 &&
|
||||
( info == this ||
|
||||
( m_baseInfo1 && m_baseInfo1->IsKindOf(info) ) ||
|
||||
( m_baseInfo2 && m_baseInfo2->IsKindOf(info) ) );
|
||||
if ( info == this )
|
||||
return true;
|
||||
|
||||
if ( m_baseInfo1 )
|
||||
{
|
||||
if ( m_baseInfo1->IsKindOf(info) )
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( m_baseInfo2 )
|
||||
{
|
||||
if ( m_baseInfo2->IsKindOf(info) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
wxDECLARE_CLASS_INFO_ITERATORS();
|
||||
|
@ -1664,6 +1664,10 @@ public:
|
||||
Default is wxPG_RECURSE which causes colour to be set recursively.
|
||||
Omit this flag to only set colour for the property in question
|
||||
and not any of its children.
|
||||
|
||||
@remarks
|
||||
Unlike wxPropertyGridInterface::SetPropertyBackgroundColour(),
|
||||
this does not automatically update the display.
|
||||
*/
|
||||
void SetBackgroundColour( const wxColour& colour,
|
||||
int flags = wxPG_RECURSE );
|
||||
@ -1753,8 +1757,11 @@ public:
|
||||
/**
|
||||
Sets property's label.
|
||||
|
||||
@remarks Properties under same parent may have same labels. However,
|
||||
property names must still remain unique.
|
||||
@remarks
|
||||
- Properties under same parent may have same labels. However,
|
||||
property names must still remain unique.
|
||||
- Unlike wxPropertyGridInterface::SetPropertyLabel(),
|
||||
this does not automatically update the display.
|
||||
*/
|
||||
void SetLabel( const wxString& label );
|
||||
|
||||
@ -1796,6 +1803,10 @@ public:
|
||||
Default is wxPG_RECURSE which causes colour to be set recursively.
|
||||
Omit this flag to only set colour for the property in question
|
||||
and not any of its children.
|
||||
|
||||
@remarks
|
||||
Unlike wxPropertyGridInterface::SetPropertyTextColour(),
|
||||
this does not automatically update the display.
|
||||
*/
|
||||
void SetTextColour( const wxColour& colour,
|
||||
int flags = wxPG_RECURSE );
|
||||
@ -1807,6 +1818,10 @@ public:
|
||||
Default is wxPG_RECURSE which causes colours to be set recursively.
|
||||
Omit this flag to only set colours for the property in question
|
||||
and not any of its children.
|
||||
|
||||
@remarks
|
||||
Unlike wxPropertyGridInterface::SetPropertyColoursToDefault(),
|
||||
this does not automatically update the display.
|
||||
*/
|
||||
void SetDefaultColours(int flags = wxPG_RECURSE);
|
||||
|
||||
|
@ -6,6 +6,70 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
/**
|
||||
@section propgrid_property_values_attributes wxPropertyGrid Property Values Attribute Identifiers
|
||||
|
||||
Many wxPropertyGridInterface and wxPropertyGrid methods to set property
|
||||
value or to modify its state use these flags to specify additional details
|
||||
of the operation.
|
||||
|
||||
@{
|
||||
*/
|
||||
enum wxPG_PROPERTYVALUES_FLAGS
|
||||
{
|
||||
/**
|
||||
Flag for wxPropertyGridInterface::SetProperty* functions,
|
||||
wxPropertyGridInterface::HideProperty(), etc.
|
||||
Apply changes only for the property in question.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_DONT_RECURSE = 0x00000000,
|
||||
|
||||
/**
|
||||
Flag for wxPropertyGridInterface::GetPropertyValues().
|
||||
Use this flag to retain category structure; each sub-category
|
||||
will be its own wxVariantList of wxVariant.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_KEEP_STRUCTURE = 0x00000010,
|
||||
|
||||
/**
|
||||
Flag for wxPropertyGridInterface::SetProperty* functions,
|
||||
wxPropertyGridInterface::HideProperty(), etc.
|
||||
Apply changes recursively for the property and all its children.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_RECURSE = 0x00000020,
|
||||
|
||||
/**
|
||||
Flag for wxPropertyGridInterface::GetPropertyValues().
|
||||
Use this flag to include property attributes as well.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_INC_ATTRIBUTES = 0x00000040,
|
||||
|
||||
/**
|
||||
Used when first starting recursion.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_RECURSE_STARTS = 0x00000080,
|
||||
|
||||
/**
|
||||
Force value change.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_FORCE = 0x00000100,
|
||||
|
||||
/**
|
||||
Only sort categories and their immediate children.
|
||||
Sorting done by wxPG_AUTO_SORT option uses this.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_SORT_TOP_LEVEL_ONLY = 0x00000200
|
||||
};
|
||||
|
||||
/** @}
|
||||
*/
|
||||
|
||||
/**
|
||||
@class wxPropertyGridInterface
|
||||
@ -156,6 +220,9 @@ public:
|
||||
/**
|
||||
Disables a property.
|
||||
|
||||
@remarks
|
||||
Property is refreshed with new settings.
|
||||
|
||||
@see EnableProperty(), wxPGProperty::Enable()
|
||||
*/
|
||||
bool DisableProperty( wxPGPropArg id );
|
||||
@ -176,6 +243,9 @@ public:
|
||||
@param enable
|
||||
If @false, property is disabled instead.
|
||||
|
||||
@remarks
|
||||
Property is refreshed with new settings.
|
||||
|
||||
@see wxPGProperty::Enable()
|
||||
*/
|
||||
bool EnableProperty( wxPGPropArg id, bool enable = true );
|
||||
@ -603,6 +673,9 @@ public:
|
||||
/**
|
||||
Disables (limit = @true) or enables (limit = @false) wxTextCtrl editor
|
||||
of a property, if it is not the sole mean to edit the value.
|
||||
|
||||
@remarks
|
||||
Property is refreshed with new settings.
|
||||
*/
|
||||
void LimitPropertyEditing( wxPGPropArg id, bool limit = true );
|
||||
|
||||
@ -768,8 +841,10 @@ public:
|
||||
Optional.
|
||||
Use wxPG_RECURSE to set the attribute to child properties recursively.
|
||||
|
||||
@remarks Setting attribute's value to wxNullVariant will simply remove it
|
||||
from property's set of attributes.
|
||||
@remarks
|
||||
- Setting attribute's value to wxNullVariant will simply remove it
|
||||
from property's set of attributes.
|
||||
- Property is refreshed with new settings.
|
||||
*/
|
||||
void SetPropertyAttribute( wxPGPropArg id, const wxString& attrName,
|
||||
wxVariant value, long argFlags = 0 );
|
||||
@ -778,11 +853,14 @@ public:
|
||||
Sets property attribute for all applicapple properties.
|
||||
Be sure to use this method only after all properties have been
|
||||
added to the grid.
|
||||
|
||||
@remarks
|
||||
Properties are refreshed with new settings.
|
||||
*/
|
||||
void SetPropertyAttributeAll( const wxString& attrName, wxVariant value );
|
||||
|
||||
/**
|
||||
Sets background colour of a property.
|
||||
Sets background colour of given property.
|
||||
|
||||
@param id
|
||||
Property name or pointer.
|
||||
@ -794,6 +872,10 @@ public:
|
||||
Default is wxPG_RECURSE which causes colour to be set recursively.
|
||||
Omit this flag to only set colour for the property in question
|
||||
and not any of its children.
|
||||
|
||||
@remarks
|
||||
- If category is tried to set recursively, only its children are affected.
|
||||
- Property is redrawn with new colour.
|
||||
*/
|
||||
void SetPropertyBackgroundColour( wxPGPropArg id,
|
||||
const wxColour& colour,
|
||||
@ -823,12 +905,17 @@ public:
|
||||
|
||||
/**
|
||||
Resets text and background colours of given property.
|
||||
|
||||
@param id
|
||||
Property name or pointer.
|
||||
|
||||
@param flags
|
||||
Default is wxPG_DONT_RECURSE which causes colour to be reset
|
||||
only for the property in question (for backward compatibility).
|
||||
|
||||
@remarks
|
||||
- If category is tried to set recursively, only its children are affected.
|
||||
- Property is redrawn with new colours.
|
||||
*/
|
||||
void SetPropertyColoursToDefault(wxPGPropArg id, int flags = wxPG_DONT_RECURSE);
|
||||
|
||||
@ -887,8 +974,10 @@ public:
|
||||
By default changes are applied recursively. Set this parameter
|
||||
to wxPG_DONT_RECURSE to prevent this.
|
||||
|
||||
@remarks This is mainly for use with textctrl editor. Only some other
|
||||
editors fully support it.
|
||||
@remarks
|
||||
- This is mainly for use with textctrl editor. Only some other
|
||||
editors fully support it.
|
||||
- Property is refreshed with new settings.
|
||||
*/
|
||||
void SetPropertyReadOnly( wxPGPropArg id, bool set = true,
|
||||
int flags = wxPG_RECURSE );
|
||||
@ -936,18 +1025,22 @@ public:
|
||||
|
||||
|
||||
/**
|
||||
Sets text colour of a property.
|
||||
Sets text colour of given property.
|
||||
|
||||
@param id
|
||||
Property name or pointer.
|
||||
|
||||
@param colour
|
||||
New background colour.
|
||||
New text colour.
|
||||
|
||||
@param flags
|
||||
Default is wxPG_RECURSE which causes colour to be set recursively.
|
||||
Omit this flag to only set colour for the property in question
|
||||
and not any of its children.
|
||||
|
||||
@remarks
|
||||
- If category is tried to set recursively, only its children are affected.
|
||||
- Property is redrawn with new colour.
|
||||
*/
|
||||
void SetPropertyTextColour( wxPGPropArg id,
|
||||
const wxColour& colour,
|
||||
|
@ -387,7 +387,8 @@ void wxDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
|
||||
// of required clipping box and DC surface.
|
||||
int dcWidth, dcHeight;
|
||||
DoGetSize(&dcWidth, &dcHeight);
|
||||
wxRect dcRect(wxSize(dcWidth, dcHeight));
|
||||
wxRect dcRect(DeviceToLogicalX(0), DeviceToLogicalY(0),
|
||||
DeviceToLogicalXRel(dcWidth), DeviceToLogicalYRel(dcHeight));
|
||||
clipRegion = dcRect.Intersect(newRegion);
|
||||
|
||||
m_clipping = true;
|
||||
|
@ -1151,9 +1151,10 @@ void wxGCDCImpl::Clear(void)
|
||||
wxCompositionMode formerMode = m_graphicContext->GetCompositionMode();
|
||||
m_graphicContext->SetCompositionMode(wxCOMPOSITION_SOURCE);
|
||||
// maximum positive coordinate Cairo can handle is 2^23 - 1
|
||||
// Use a value slightly less than this to be sure we avoid the limit
|
||||
DoDrawRectangle(
|
||||
DeviceToLogicalX(0), DeviceToLogicalY(0),
|
||||
DeviceToLogicalXRel(0x007fffff), DeviceToLogicalYRel(0x007fffff));
|
||||
DeviceToLogicalXRel(0x800000 - 64), DeviceToLogicalYRel(0x800000 - 64));
|
||||
m_graphicContext->SetCompositionMode(formerMode);
|
||||
m_graphicContext->SetPen( m_pen );
|
||||
m_graphicContext->SetBrush( m_brush );
|
||||
|
@ -82,7 +82,7 @@
|
||||
#endif
|
||||
|
||||
// TODO: Borland probably has _wgetcwd as well?
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define HAVE_WGETCWD
|
||||
#endif
|
||||
|
||||
|
@ -1171,7 +1171,7 @@ wxString wxStripMenuCodes(const wxString& in, int flags)
|
||||
}
|
||||
|
||||
// The initial '?' means we match "Foo(&F)" but not "(&F)"
|
||||
if (label.Matches("?*(&?)") > 0)
|
||||
if (label.Matches("?*(&?)"))
|
||||
{
|
||||
label = label.Left( label.Len()-4 ).Trim();
|
||||
return label + accel;
|
||||
|
@ -204,6 +204,13 @@ void wxCheckBox::SetLabel( const wxString& label )
|
||||
{
|
||||
wxCHECK_RET( m_widgetLabel != NULL, wxT("invalid checkbox") );
|
||||
|
||||
// If we don't hide the empty label, in some themes a focus rectangle is
|
||||
// still drawn around it and this looks out of place.
|
||||
if ( label.empty() )
|
||||
gtk_widget_hide(m_widgetLabel);
|
||||
else
|
||||
gtk_widget_show(m_widgetLabel);
|
||||
|
||||
// save the label inside m_label in case user calls GetLabel() later
|
||||
wxControl::SetLabel(label);
|
||||
|
||||
|
@ -709,30 +709,19 @@ int wxMSWDCImpl::GetDepth() const
|
||||
|
||||
void wxMSWDCImpl::Clear()
|
||||
{
|
||||
RECT rect;
|
||||
if (m_window)
|
||||
{
|
||||
GetClientRect((HWND) m_window->GetHWND(), &rect);
|
||||
}
|
||||
else
|
||||
if ( !m_window )
|
||||
{
|
||||
// No, I think we should simply ignore this if printing on e.g.
|
||||
// a printer DC.
|
||||
// wxCHECK_RET( m_selectedBitmap.IsOk(), wxT("this DC can't be cleared") );
|
||||
if (!m_selectedBitmap.IsOk())
|
||||
return;
|
||||
|
||||
rect.left = rect.top = 0;
|
||||
rect.right = m_selectedBitmap.GetWidth();
|
||||
rect.bottom = m_selectedBitmap.GetHeight();
|
||||
}
|
||||
|
||||
::OffsetRect(&rect, -m_deviceOriginX, -m_deviceOriginY);
|
||||
|
||||
(void) ::SetMapMode(GetHdc(), MM_TEXT);
|
||||
|
||||
DWORD colour = ::GetBkColor(GetHdc());
|
||||
HBRUSH brush = ::CreateSolidBrush(colour);
|
||||
RECT rect;
|
||||
::GetClipBox(GetHdc(), &rect);
|
||||
::FillRect(GetHdc(), &rect, brush);
|
||||
::DeleteObject(brush);
|
||||
|
||||
|
@ -279,9 +279,19 @@ void wxPropertyGridInterface::SetPropertyReadOnly( wxPGPropArg id, bool set, int
|
||||
wxPG_PROP_ARG_CALL_PROLOG()
|
||||
|
||||
if ( flags & wxPG_RECURSE )
|
||||
{
|
||||
p->SetFlagRecursively(wxPG_PROP_READONLY, set);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do nothing if flag is already set as required.
|
||||
if ( set && p->HasFlag(wxPG_PROP_READONLY) )
|
||||
return;
|
||||
if ( !set && !p->HasFlag(wxPG_PROP_READONLY) )
|
||||
return;
|
||||
|
||||
p->ChangeFlag(wxPG_PROP_READONLY, set);
|
||||
}
|
||||
|
||||
wxPropertyGridPageState* state = p->GetParentState();
|
||||
if( state )
|
||||
@ -557,6 +567,15 @@ bool wxPropertyGridInterface::HideProperty( wxPGPropArg id, bool hide, int flags
|
||||
{
|
||||
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
|
||||
|
||||
// Do nothing if single property is already hidden/visible as requested.
|
||||
if ( !(flags & wxPG_RECURSE) )
|
||||
{
|
||||
if ( hide && p->HasFlag(wxPG_PROP_HIDDEN) )
|
||||
return false;
|
||||
if ( !hide && !p->HasFlag(wxPG_PROP_HIDDEN) )
|
||||
return false;
|
||||
}
|
||||
|
||||
wxPropertyGrid* pg = m_pState->GetGrid();
|
||||
|
||||
if ( pg == p->GetGrid() )
|
||||
@ -618,6 +637,9 @@ void wxPropertyGridInterface::SetPropertyLabel( wxPGPropArg id, const wxString&
|
||||
{
|
||||
wxPG_PROP_ARG_CALL_PROLOG()
|
||||
|
||||
if ( p->GetLabel() == newproplabel )
|
||||
return;
|
||||
|
||||
p->SetLabel( newproplabel );
|
||||
|
||||
wxPropertyGridPageState* state = p->GetParentState();
|
||||
@ -629,9 +651,19 @@ void wxPropertyGridInterface::SetPropertyLabel( wxPGPropArg id, const wxString&
|
||||
if ( pg->GetState() == state )
|
||||
{
|
||||
if ( pg->HasFlag(wxPG_AUTO_SORT) )
|
||||
{
|
||||
pg->Refresh();
|
||||
// If any property is selected it has to
|
||||
// be refreshed in the new location.
|
||||
if ( pg == p->GetGrid() && pg->GetSelectedProperty() )
|
||||
{
|
||||
RefreshProperty(pg->GetSelectedProperty());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pg->DrawItem( p );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -669,7 +701,16 @@ wxPropertyGridInterface::SetPropertyBackgroundColour( wxPGPropArg id,
|
||||
{
|
||||
wxPG_PROP_ARG_CALL_PROLOG()
|
||||
p->SetBackgroundColour(colour, flags);
|
||||
RefreshProperty(p);
|
||||
|
||||
// Redraw the control
|
||||
wxPropertyGrid* pg = m_pState->GetGrid();
|
||||
if ( pg == p->GetGrid() )
|
||||
{
|
||||
if ( flags & wxPG_RECURSE )
|
||||
pg->DrawItemAndChildren(p);
|
||||
else
|
||||
pg->DrawItem(p);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -680,7 +721,16 @@ void wxPropertyGridInterface::SetPropertyTextColour( wxPGPropArg id,
|
||||
{
|
||||
wxPG_PROP_ARG_CALL_PROLOG()
|
||||
p->SetTextColour(colour, flags);
|
||||
RefreshProperty(p);
|
||||
|
||||
// Redraw the control
|
||||
wxPropertyGrid* pg = m_pState->GetGrid();
|
||||
if ( pg == p->GetGrid() )
|
||||
{
|
||||
if ( flags & wxPG_RECURSE )
|
||||
pg->DrawItemAndChildren(p);
|
||||
else
|
||||
pg->DrawItem(p);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -695,8 +745,17 @@ void wxPropertyGridInterface::SetPropertyColoursToDefault(wxPGPropArg id)
|
||||
void wxPropertyGridInterface::SetPropertyColoursToDefault(wxPGPropArg id, int flags)
|
||||
{
|
||||
wxPG_PROP_ARG_CALL_PROLOG()
|
||||
|
||||
p->SetDefaultColours(flags);
|
||||
|
||||
// Redraw the control
|
||||
wxPropertyGrid* pg = m_pState->GetGrid();
|
||||
if ( pg == p->GetGrid() )
|
||||
{
|
||||
if ( flags & wxPG_RECURSE )
|
||||
pg->DrawItemAndChildren(p);
|
||||
else
|
||||
pg->DrawItem(p);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
@ -27,7 +27,7 @@
|
||||
// test class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static const wxSize s_dcSize(100, 105);
|
||||
static const wxSize s_dcSize(100, 120);
|
||||
static const wxColour s_bgColour(*wxWHITE); // colour to draw outside clipping box
|
||||
static const wxColour s_fgColour(*wxGREEN); // colour to draw inside clipping box
|
||||
|
||||
@ -52,12 +52,14 @@ private:
|
||||
|
||||
protected:
|
||||
void InitialState();
|
||||
void InitialStateWithTransformedDC();
|
||||
void OneRegion();
|
||||
void OneLargeRegion();
|
||||
void OneOuterRegion();
|
||||
void OneRegionNegDim();
|
||||
void OneRegionAndReset();
|
||||
void OneRegionAndEmpty();
|
||||
void OneRegionWithTransformedDC();
|
||||
void TwoRegionsOverlapping();
|
||||
void TwoRegionsOverlappingNegDim();
|
||||
void TwoRegionsNonOverlapping();
|
||||
@ -100,12 +102,14 @@ public:
|
||||
private:
|
||||
CPPUNIT_TEST_SUITE( ClippingBoxTestCaseDC );
|
||||
CPPUNIT_TEST( InitialState );
|
||||
CPPUNIT_TEST( InitialStateWithTransformedDC );
|
||||
CPPUNIT_TEST( OneRegion );
|
||||
CPPUNIT_TEST( OneLargeRegion );
|
||||
CPPUNIT_TEST( OneOuterRegion );
|
||||
CPPUNIT_TEST( OneRegionNegDim );
|
||||
CPPUNIT_TEST( OneRegionAndReset );
|
||||
CPPUNIT_TEST( OneRegionAndEmpty );
|
||||
CPPUNIT_TEST( OneRegionWithTransformedDC );
|
||||
CPPUNIT_TEST( TwoRegionsOverlapping );
|
||||
CPPUNIT_TEST( TwoRegionsOverlappingNegDim );
|
||||
CPPUNIT_TEST( TwoRegionsNonOverlapping );
|
||||
@ -161,12 +165,14 @@ public:
|
||||
private:
|
||||
CPPUNIT_TEST_SUITE( ClippingBoxTestCaseGCDC );
|
||||
CPPUNIT_TEST( InitialState );
|
||||
CPPUNIT_TEST( InitialStateWithTransformedDC );
|
||||
CPPUNIT_TEST( OneRegion );
|
||||
CPPUNIT_TEST( OneLargeRegion );
|
||||
CPPUNIT_TEST( OneOuterRegion );
|
||||
CPPUNIT_TEST( OneRegionNegDim );
|
||||
CPPUNIT_TEST( OneRegionAndReset );
|
||||
CPPUNIT_TEST( OneRegionAndEmpty );
|
||||
CPPUNIT_TEST( OneRegionWithTransformedDC );
|
||||
CPPUNIT_TEST( TwoRegionsOverlapping );
|
||||
CPPUNIT_TEST( TwoRegionsOverlappingNegDim );
|
||||
CPPUNIT_TEST( TwoRegionsNonOverlapping );
|
||||
@ -208,12 +214,14 @@ public:
|
||||
private:
|
||||
CPPUNIT_TEST_SUITE( ClippingBoxTestCaseGDIPlus );
|
||||
CPPUNIT_TEST( InitialState );
|
||||
CPPUNIT_TEST( InitialStateWithTransformedDC );
|
||||
CPPUNIT_TEST( OneRegion );
|
||||
CPPUNIT_TEST( OneLargeRegion );
|
||||
CPPUNIT_TEST( OneOuterRegion );
|
||||
CPPUNIT_TEST( OneRegionNegDim );
|
||||
CPPUNIT_TEST( OneRegionAndReset );
|
||||
CPPUNIT_TEST( OneRegionAndEmpty );
|
||||
CPPUNIT_TEST( OneRegionWithTransformedDC );
|
||||
CPPUNIT_TEST( TwoRegionsOverlapping );
|
||||
CPPUNIT_TEST( TwoRegionsOverlappingNegDim );
|
||||
CPPUNIT_TEST( TwoRegionsNonOverlapping );
|
||||
@ -259,12 +267,14 @@ public:
|
||||
private:
|
||||
CPPUNIT_TEST_SUITE( ClippingBoxTestCaseDirect2D );
|
||||
CPPUNIT_TEST( InitialState );
|
||||
CPPUNIT_TEST( InitialStateWithTransformedDC );
|
||||
CPPUNIT_TEST( OneRegion );
|
||||
CPPUNIT_TEST( OneLargeRegion );
|
||||
CPPUNIT_TEST( OneOuterRegion );
|
||||
CPPUNIT_TEST( OneRegionNegDim );
|
||||
CPPUNIT_TEST( OneRegionAndReset );
|
||||
CPPUNIT_TEST( OneRegionAndEmpty );
|
||||
CPPUNIT_TEST( OneRegionWithTransformedDC );
|
||||
CPPUNIT_TEST( TwoRegionsOverlapping );
|
||||
CPPUNIT_TEST( TwoRegionsOverlappingNegDim );
|
||||
CPPUNIT_TEST( TwoRegionsNonOverlapping );
|
||||
@ -302,12 +312,14 @@ public:
|
||||
private:
|
||||
CPPUNIT_TEST_SUITE( ClippingBoxTestCaseCairo );
|
||||
CPPUNIT_TEST( InitialState );
|
||||
CPPUNIT_TEST( InitialStateWithTransformedDC );
|
||||
CPPUNIT_TEST( OneRegion );
|
||||
CPPUNIT_TEST( OneLargeRegion );
|
||||
CPPUNIT_TEST( OneOuterRegion );
|
||||
CPPUNIT_TEST( OneRegionNegDim );
|
||||
CPPUNIT_TEST( OneRegionAndReset );
|
||||
CPPUNIT_TEST( OneRegionAndEmpty );
|
||||
CPPUNIT_TEST( OneRegionWithTransformedDC );
|
||||
CPPUNIT_TEST( TwoRegionsOverlapping );
|
||||
CPPUNIT_TEST( TwoRegionsOverlappingNegDim );
|
||||
CPPUNIT_TEST( TwoRegionsNonOverlapping );
|
||||
@ -367,17 +379,26 @@ void ClippingBoxTestCaseBase::CheckBox(int x, int y, int width, int height)
|
||||
msg = msgDim;
|
||||
}
|
||||
|
||||
// We will examine pixels directly in the underlying bitmap
|
||||
// so we need to get device coordinates of examined area.
|
||||
x = m_dc->LogicalToDeviceX(x);
|
||||
y = m_dc->LogicalToDeviceY(y);
|
||||
width = m_dc->LogicalToDeviceXRel(width);
|
||||
height = m_dc->LogicalToDeviceYRel(height);
|
||||
|
||||
// Update wxDC contents.
|
||||
FlushDC();
|
||||
|
||||
// Check whether diagonal corners of the clipping box
|
||||
// are actually drawn at the edge of the clipping region.
|
||||
#if wxUSE_IMAGE
|
||||
// For some renderers is's not possible to get pixels
|
||||
// For some renderers it's not possible to get pixels
|
||||
// value from wxDC so we would have to examine pixels
|
||||
// in the underlying bitmap.
|
||||
wxImage img;
|
||||
img = m_bmp.ConvertToImage();
|
||||
#else
|
||||
return;
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
// Check area near the top-left corner
|
||||
@ -394,18 +415,15 @@ void ClippingBoxTestCaseBase::CheckBox(int x, int y, int width, int height)
|
||||
for( int px = xmin; px <= xmax; px++ )
|
||||
{
|
||||
wxColour c;
|
||||
if ( !m_dc->GetPixel(px, py, &c) )
|
||||
{
|
||||
#if wxUSE_IMAGE
|
||||
unsigned char r = img.GetRed(px, py);
|
||||
unsigned char g = img.GetGreen(px, py);
|
||||
unsigned char b = img.GetBlue(px, py);
|
||||
c.Set(r, g, b);
|
||||
unsigned char r = img.GetRed(px, py);
|
||||
unsigned char g = img.GetGreen(px, py);
|
||||
unsigned char b = img.GetBlue(px, py);
|
||||
c.Set(r, g, b);
|
||||
#else
|
||||
// We cannot get pixel value
|
||||
break;
|
||||
// We cannot get pixel value
|
||||
break;
|
||||
#endif // wxUSE_IMAGE / !wxUSE_IMAGE
|
||||
}
|
||||
|
||||
wxString msgColour;
|
||||
if ( px >= x && px <= x + (width-1) &&
|
||||
@ -458,18 +476,15 @@ void ClippingBoxTestCaseBase::CheckBox(int x, int y, int width, int height)
|
||||
for( int px = xmin; px <= xmax; px++ )
|
||||
{
|
||||
wxColour c;
|
||||
if ( !m_dc->GetPixel(px, py, &c) )
|
||||
{
|
||||
#if wxUSE_IMAGE
|
||||
unsigned char r = img.GetRed(px, py);
|
||||
unsigned char g = img.GetGreen(px, py);
|
||||
unsigned char b = img.GetBlue(px, py);
|
||||
c.Set(r, g, b);
|
||||
unsigned char r = img.GetRed(px, py);
|
||||
unsigned char g = img.GetGreen(px, py);
|
||||
unsigned char b = img.GetBlue(px, py);
|
||||
c.Set(r, g, b);
|
||||
#else
|
||||
// We cannot get pixel value
|
||||
break;
|
||||
// We cannot get pixel value
|
||||
break;
|
||||
#endif // wxUSE_IMAGE / !wxUSE_IMAGE
|
||||
}
|
||||
|
||||
wxString msgColour;
|
||||
if ( px >= x && px <= x + (width-1) &&
|
||||
@ -525,6 +540,18 @@ void ClippingBoxTestCaseBase::InitialState()
|
||||
CheckBox(0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight());
|
||||
}
|
||||
|
||||
void ClippingBoxTestCaseBase::InitialStateWithTransformedDC()
|
||||
{
|
||||
// Initial clipping box with transformed DC.
|
||||
m_dc->SetDeviceOrigin(10, 15);
|
||||
m_dc->SetUserScale(0.5, 1.5);
|
||||
m_dc->SetLogicalScale(4.0, 2.0);
|
||||
m_dc->SetLogicalOrigin(-15, -20);
|
||||
m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
|
||||
m_dc->Clear();
|
||||
CheckBox(-20, -25, 50, 40);
|
||||
}
|
||||
|
||||
void ClippingBoxTestCaseBase::OneRegion()
|
||||
{
|
||||
// Setting one clipping box inside DC area.
|
||||
@ -587,6 +614,20 @@ void ClippingBoxTestCaseBase::OneRegionAndEmpty()
|
||||
CheckBox(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void ClippingBoxTestCaseBase::OneRegionWithTransformedDC()
|
||||
{
|
||||
// Setting one clipping box inside DC area
|
||||
// with applied some transformations.
|
||||
m_dc->SetDeviceOrigin(10, 15);
|
||||
m_dc->SetUserScale(0.5, 1.5);
|
||||
m_dc->SetLogicalScale(4.0, 2.0);
|
||||
m_dc->SetLogicalOrigin(-15, -20);
|
||||
m_dc->SetClippingRegion(-10, -20, 80, 75);
|
||||
m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
|
||||
m_dc->Clear();
|
||||
CheckBox(-10, -20, 40, 35);
|
||||
}
|
||||
|
||||
void ClippingBoxTestCaseBase::TwoRegionsOverlapping()
|
||||
{
|
||||
// Setting one clipping box and next another box (partially overlapping).
|
||||
|
@ -633,7 +633,7 @@ bool TestApp::OnInit()
|
||||
|
||||
Connect(wxEVT_IDLE, wxIdleEventHandler(TestApp::OnIdle));
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#ifdef __WXGTK20__
|
||||
g_log_set_default_handler(wxTestGLogHandler, NULL);
|
||||
#endif // __WXGTK__
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user