diff --git a/include/wx/richtext/richtextbackgroundpage.h b/include/wx/richtext/richtextbackgroundpage.h
index 8b9a8156a4..db24690bdf 100644
--- a/include/wx/richtext/richtextbackgroundpage.h
+++ b/include/wx/richtext/richtextbackgroundpage.h
@@ -80,6 +80,21 @@ public:
////@begin wxRichTextBackgroundPage event handler declarations
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET
+ void OnRichtextShadowUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSHADOWCOLOURSWATCHCTRL
+ void OnRichtextshadowcolourswatchctrlUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_SPREAD
+ void OnRichtextShadowSpreadUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_BLUR_DISTANCE
+ void OnRichtextShadowBlurUpdate( wxUpdateUIEvent& event );
+
+ /// wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_OPACITY
+ void OnRichtextShadowOpacityUpdate( wxUpdateUIEvent& event );
+
////@end wxRichTextBackgroundPage event handler declarations
////@begin wxRichTextBackgroundPage member function declarations
@@ -97,11 +112,42 @@ public:
////@begin wxRichTextBackgroundPage member variables
wxCheckBox* m_backgroundColourCheckBox;
wxRichTextColourSwatchCtrl* m_backgroundColourSwatch;
+ wxBoxSizer* m_shadowBox;
+ wxCheckBox* m_useShadow;
+ wxTextCtrl* m_offsetX;
+ wxComboBox* m_unitsHorizontalOffset;
+ wxTextCtrl* m_offsetY;
+ wxComboBox* m_unitsVerticalOffset;
+ wxCheckBox* m_shadowColourCheckBox;
+ wxRichTextColourSwatchCtrl* m_shadowColourSwatch;
+ wxCheckBox* m_useShadowSpread;
+ wxTextCtrl* m_spread;
+ wxComboBox* m_unitsShadowSpread;
+ wxCheckBox* m_useBlurDistance;
+ wxTextCtrl* m_blurDistance;
+ wxComboBox* m_unitsBlurDistance;
+ wxCheckBox* m_useShadowOpacity;
+ wxTextCtrl* m_opacity;
/// Control identifiers
enum {
ID_RICHTEXTBACKGROUNDPAGE = 10845,
ID_RICHTEXT_BACKGROUND_COLOUR_CHECKBOX = 10846,
- ID_RICHTEXT_BACKGROUND_COLOUR_SWATCH = 10847
+ ID_RICHTEXT_BACKGROUND_COLOUR_SWATCH = 10847,
+ ID_RICHTEXT_USE_SHADOW = 10840,
+ ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET = 10703,
+ ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET_UNITS = 10712,
+ ID_RICHTEXT_SHADOW_VERTICAL_OFFSET = 10841,
+ ID_RICHTEXT_SHADOW_VERTICAL_OFFSET_UNITS = 10842,
+ ID_RICHTEXT_USE_SHADOW_COLOUR = 10843,
+ ID_RICHTEXTSHADOWCOLOURSWATCHCTRL = 10844,
+ ID_RICHTEXT_USE_SHADOW_SPREAD = 10851,
+ ID_RICHTEXT_SHADOW_SPREAD = 10848,
+ ID_RICHTEXT_SHADOW_SPREAD_UNITS = 10849,
+ ID_RICHTEXT_USE_BLUR_DISTANCE = 10855,
+ ID_RICHTEXT_SHADOW_BLUR_DISTANCE = 10852,
+ ID_RICHTEXT_SHADOW_BLUR_DISTANCE_UNITS = 10853,
+ ID_RICHTEXT_USE_SHADOW_OPACITY = 10856,
+ ID_RICHTEXT_SHADOW_OPACITY = 10854
};
////@end wxRichTextBackgroundPage member variables
};
diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h
index 5b26abca85..26ef86426a 100644
--- a/include/wx/richtext/richtextbuffer.h
+++ b/include/wx/richtext/richtextbuffer.h
@@ -1113,6 +1113,187 @@ public:
};
+/**
+ @class wxTextAttrShadow
+ A class representing a shadow.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrShadow
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrShadow() { Reset(); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrShadow& shadow) const;
+
+ /**
+ Resets the shadow.
+ */
+ void Reset();
+
+ /**
+ Partial equality test. If @a weakTest is @true, attributes of this object do not
+ have to be present if those attributes of @a border are present. If @a weakTest is
+ @false, the function will fail if an attribute is present in @a border but not
+ in this object.
+ */
+ bool EqPartial(const wxTextAttrShadow& shadow, bool weakTest = true) const;
+
+ /**
+ Applies the border to this object, but not if the same as @a compareWith.
+
+ */
+ bool Apply(const wxTextAttrShadow& shadow, const wxTextAttrShadow* compareWith = NULL);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextAttrShadow& attr);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxTextAttrShadow& attr, wxTextAttrShadow& clashingAttr, wxTextAttrShadow& absentAttr);
+
+ /**
+ Sets the shadow colour.
+ */
+ void SetColour(unsigned long colour) { m_shadowColour = colour; m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+
+ /**
+ Sets the shadow colour.
+ */
+#if wxCHECK_VERSION(2,9,0)
+ void SetColour(const wxColour& colour) { m_shadowColour = colour.GetRGB(); m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+#else
+ void SetColour(const wxColour& colour) { m_shadowColour = (colour.Red() | (colour.Green() << 8) | (colour.Blue() << 16)); m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+#endif
+
+ /**
+ Gets the colour as a long.
+ */
+ unsigned long GetColourLong() const { return m_shadowColour; }
+
+ /**
+ Gets the colour.
+ */
+ wxColour GetColour() const { return wxColour(m_shadowColour); }
+
+ /**
+ True if the shadow has a valid colour.
+ */
+ bool HasColour() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_COLOUR) != 0; }
+
+ /**
+ Gets the shadow horizontal offset.
+ */
+ wxTextAttrDimension& GetOffsetX() { return m_offsetX; }
+ const wxTextAttrDimension& GetOffsetX() const { return m_offsetX; }
+
+ /**
+ Sets the shadow horizontal offset.
+ */
+ void SetOffsetX(const wxTextAttrDimension& offset) { m_offsetX = offset; }
+
+ /**
+ Gets the shadow vertical offset.
+ */
+ wxTextAttrDimension& GetOffsetY() { return m_offsetY; }
+ const wxTextAttrDimension& GetOffsetY() const { return m_offsetY; }
+
+ /**
+ Sets the shadow vertical offset.
+ */
+ void SetOffsetY(const wxTextAttrDimension& offset) { m_offsetY = offset; }
+
+ /**
+ Gets the shadow spread size.
+ */
+ wxTextAttrDimension& GetSpread() { return m_spread; }
+ const wxTextAttrDimension& GetSpread() const { return m_spread; }
+
+ /**
+ Sets the shadow spread size.
+ */
+ void SetSpread(const wxTextAttrDimension& spread) { m_spread = spread; }
+
+ /**
+ Gets the shadow blur distance.
+ */
+ wxTextAttrDimension& GetBlurDistance() { return m_blurDistance; }
+ const wxTextAttrDimension& GetBlurDistance() const { return m_blurDistance; }
+
+ /**
+ Sets the shadow blur distance.
+ */
+ void SetBlurDistance(const wxTextAttrDimension& blur) { m_blurDistance = blur; }
+
+ /**
+ Gets the shadow opacity.
+ */
+ wxTextAttrDimension& GetOpacity() { return m_opacity; }
+ const wxTextAttrDimension& GetOpacity() const { return m_opacity; }
+
+ /**
+ Returns @true if the dimension is valid.
+ */
+ bool IsValid() const { return (m_flags & wxTEXT_ATTR_VALUE_VALID) != 0; }
+
+ /**
+ Sets the valid flag.
+ */
+ void SetValid(bool b) { m_flags &= ~wxTEXT_ATTR_VALUE_VALID_MASK; m_flags |= (b ? wxTEXT_ATTR_VALUE_VALID : 0); }
+
+ /**
+ Returns the border flags.
+ */
+ int GetFlags() const { return m_flags; }
+
+ /**
+ Sets the border flags.
+ */
+ void SetFlags(int flags) { m_flags = flags; }
+
+ /**
+ Adds a border flag.
+ */
+ void AddFlag(int flag) { m_flags |= flag; }
+
+ /**
+ Removes a border flag.
+ */
+ void RemoveFlag(int flag) { m_flags &= ~flag; }
+
+ /**
+ Sets the shadow opacity.
+ */
+ void SetOpacity(const wxTextAttrDimension& opacity) { m_opacity = opacity; }
+
+ /**
+ True if the shadow has no attributes set.
+ */
+ bool IsDefault() const { return !HasColour() && !m_offsetX.IsValid() && !m_offsetY.IsValid() && !m_spread.IsValid() && !m_blurDistance.IsValid() && !m_opacity.IsValid(); }
+
+ int m_flags;
+ unsigned long m_shadowColour;
+ wxTextAttrDimension m_offsetX;
+ wxTextAttrDimension m_offsetY;
+ wxTextAttrDimension m_spread;
+ wxTextAttrDimension m_blurDistance;
+ wxTextAttrDimension m_opacity;
+};
+
/**
@class wxTextBoxAttr
A class representing the box attributes of a rich text object.
@@ -1522,6 +1703,17 @@ public:
*/
bool HasBoxStyleName() const { return HasFlag(wxTEXT_BOX_ATTR_BOX_STYLE_NAME); }
+ /**
+ Returns the box shadow attributes.
+ */
+ wxTextAttrShadow& GetShadow() { return m_shadow; }
+ const wxTextAttrShadow& GetShadow() const { return m_shadow; }
+
+ /**
+ Sets the box shadow attributes.
+ */
+ void SetShadow(const wxTextAttrShadow& shadow) { m_shadow = shadow; }
+
public:
int m_flags;
@@ -1544,6 +1736,7 @@ public:
wxTextBoxAttrWhitespaceMode m_whitespaceMode;
wxTextAttrDimension m_cornerRadius;
wxString m_boxStyleName;
+ wxTextAttrShadow m_shadow;
};
/**
diff --git a/interface/wx/richtext/richtextbuffer.h b/interface/wx/richtext/richtextbuffer.h
index 8b3e42db35..12f556efaf 100644
--- a/interface/wx/richtext/richtextbuffer.h
+++ b/interface/wx/richtext/richtextbuffer.h
@@ -961,6 +961,183 @@ public:
};
+/**
+ @class wxTextAttrShadow
+ A class representing a shadow.
+
+ @library{wxrichtext}
+ @category{richtext}
+
+ @see wxRichTextAttr, wxRichTextCtrl
+*/
+
+class WXDLLIMPEXP_RICHTEXT wxTextAttrShadow
+{
+public:
+ /**
+ Default constructor.
+ */
+ wxTextAttrShadow() { Reset(); }
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxTextAttrShadow& shadow) const;
+
+ /**
+ Resets the shadow.
+ */
+ void Reset();
+
+ /**
+ Partial equality test. If @a weakTest is @true, attributes of this object do not
+ have to be present if those attributes of @a border are present. If @a weakTest is
+ @false, the function will fail if an attribute is present in @a border but not
+ in this object.
+ */
+ bool EqPartial(const wxTextAttrShadow& shadow, bool weakTest = true) const;
+
+ /**
+ Applies the border to this object, but not if the same as @a compareWith.
+
+ */
+ bool Apply(const wxTextAttrShadow& shadow, const wxTextAttrShadow* compareWith = NULL);
+
+ /**
+ Removes the specified attributes from this object.
+ */
+ bool RemoveStyle(const wxTextAttrShadow& attr);
+
+ /**
+ Collects the attributes that are common to a range of content, building up a note of
+ which attributes are absent in some objects and which clash in some objects.
+ */
+ void CollectCommonAttributes(const wxTextAttrShadow& attr, wxTextAttrShadow& clashingAttr, wxTextAttrShadow& absentAttr);
+
+ /**
+ Sets the shadow colour.
+ */
+ void SetColour(unsigned long colour) { m_shadowColour = colour; m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+
+ /**
+ Sets the shadow colour.
+ */
+ void SetColour(const wxColour& colour) { m_shadowColour = colour.GetRGB(); m_flags |= wxTEXT_BOX_ATTR_BORDER_COLOUR; }
+
+ /**
+ Gets the colour as a long.
+ */
+ unsigned long GetColourLong() const { return m_shadowColour; }
+
+ /**
+ Gets the colour.
+ */
+ wxColour GetColour() const { return wxColour(m_shadowColour); }
+
+ /**
+ True if the shadow has a valid colour.
+ */
+ bool HasColour() const { return (m_flags & wxTEXT_BOX_ATTR_BORDER_COLOUR) != 0; }
+
+ /**
+ Gets the shadow horizontal offset.
+ */
+ wxTextAttrDimension& GetOffsetX() { return m_offsetX; }
+ const wxTextAttrDimension& GetOffsetX() const { return m_offsetX; }
+
+ /**
+ Sets the shadow horizontal offset.
+ */
+ void SetOffsetX(const wxTextAttrDimension& offset) { m_offsetX = offset; }
+
+ /**
+ Gets the shadow vertical offset.
+ */
+ wxTextAttrDimension& GetOffsetY() { return m_offsetY; }
+ const wxTextAttrDimension& GetOffsetY() const { return m_offsetY; }
+
+ /**
+ Sets the shadow vertical offset.
+ */
+ void SetOffsetY(const wxTextAttrDimension& offset) { m_offsetY = offset; }
+
+ /**
+ Gets the shadow spread size.
+ */
+ wxTextAttrDimension& GetSpread() { return m_spread; }
+ const wxTextAttrDimension& GetSpread() const { return m_spread; }
+
+ /**
+ Sets the shadow spread size.
+ */
+ void SetSpread(const wxTextAttrDimension& spread) { m_spread = spread; }
+
+ /**
+ Gets the shadow blur distance.
+ */
+ wxTextAttrDimension& GetBlurDistance() { return m_blurDistance; }
+ const wxTextAttrDimension& GetBlurDistance() const { return m_blurDistance; }
+
+ /**
+ Sets the shadow blur distance.
+ */
+ void SetBlurDistance(const wxTextAttrDimension& blur) { m_blurDistance = blur; }
+
+ /**
+ Gets the shadow opacity.
+ */
+ wxTextAttrDimension& GetOpacity() { return m_opacity; }
+ const wxTextAttrDimension& GetOpacity() const { return m_opacity; }
+
+ /**
+ Returns @true if the dimension is valid.
+ */
+ bool IsValid() const { return (m_flags & wxTEXT_ATTR_VALUE_VALID) != 0; }
+
+ /**
+ Sets the valid flag.
+ */
+ void SetValid(bool b) { m_flags &= ~wxTEXT_ATTR_VALUE_VALID_MASK; m_flags |= (b ? wxTEXT_ATTR_VALUE_VALID : 0); }
+
+ /**
+ Returns the border flags.
+ */
+ int GetFlags() const { return m_flags; }
+
+ /**
+ Sets the border flags.
+ */
+ void SetFlags(int flags) { m_flags = flags; }
+
+ /**
+ Adds a border flag.
+ */
+ void AddFlag(int flag) { m_flags |= flag; }
+
+ /**
+ Removes a border flag.
+ */
+ void RemoveFlag(int flag) { m_flags &= ~flag; }
+
+ /**
+ Sets the shadow opacity.
+ */
+ void SetOpacity(const wxTextAttrDimension& opacity) { m_opacity = opacity; }
+
+ /**
+ True if the shadow has no attributes set.
+ */
+ bool IsDefault() const { return !HasColour() && !m_offsetX.IsValid() && !m_offsetY.IsValid() && !m_spread.IsValid() && !m_blurDistance.IsValid() && !m_opacity.IsValid(); }
+
+ int m_flags;
+ unsigned long m_shadowColour;
+ wxTextAttrDimension m_offsetX;
+ wxTextAttrDimension m_offsetY;
+ wxTextAttrDimension m_spread;
+ wxTextAttrDimension m_blurDistance;
+ wxTextAttrDimension m_opacity;
+};
+
/**
@class wxTextBoxAttr
A class representing the box attributes of a rich text object.
@@ -1370,6 +1547,12 @@ public:
*/
bool HasBoxStyleName() const { return HasFlag(wxTEXT_BOX_ATTR_BOX_STYLE_NAME); }
+ /**
+ Returns the box shadow attributes.
+ */
+ wxTextAttrShadow& GetShadow() { return m_shadow; }
+ const wxTextAttrShadow& GetShadow() const { return m_shadow; }
+
public:
int m_flags;
@@ -1392,6 +1575,7 @@ public:
wxTextBoxAttrWhitespaceMode m_whitespaceMode;
wxTextAttrDimension m_cornerRadius;
wxString m_boxStyleName;
+ wxTextAttrShadow m_shadow;
};
/**
diff --git a/src/richtext/richtextbackgroundpage.cpp b/src/richtext/richtextbackgroundpage.cpp
index 5e8d26e18d..8b08962eb2 100644
--- a/src/richtext/richtextbackgroundpage.cpp
+++ b/src/richtext/richtextbackgroundpage.cpp
@@ -31,6 +31,20 @@ BEGIN_EVENT_TABLE( wxRichTextBackgroundPage, wxRichTextDialogPage )
EVT_BUTTON(ID_RICHTEXT_BACKGROUND_COLOUR_SWATCH, wxRichTextBackgroundPage::OnColourSwatch)
////@begin wxRichTextBackgroundPage event table entries
+ EVT_UPDATE_UI( ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET, wxRichTextBackgroundPage::OnRichtextShadowUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET_UNITS, wxRichTextBackgroundPage::OnRichtextShadowUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_SHADOW_VERTICAL_OFFSET, wxRichTextBackgroundPage::OnRichtextShadowUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_SHADOW_VERTICAL_OFFSET_UNITS, wxRichTextBackgroundPage::OnRichtextShadowUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_USE_SHADOW_COLOUR, wxRichTextBackgroundPage::OnRichtextShadowUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXTSHADOWCOLOURSWATCHCTRL, wxRichTextBackgroundPage::OnRichtextshadowcolourswatchctrlUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_USE_SHADOW_SPREAD, wxRichTextBackgroundPage::OnRichtextShadowUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_SHADOW_SPREAD, wxRichTextBackgroundPage::OnRichtextShadowSpreadUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_SHADOW_SPREAD_UNITS, wxRichTextBackgroundPage::OnRichtextShadowSpreadUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_USE_BLUR_DISTANCE, wxRichTextBackgroundPage::OnRichtextShadowUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_SHADOW_BLUR_DISTANCE, wxRichTextBackgroundPage::OnRichtextShadowBlurUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_SHADOW_BLUR_DISTANCE_UNITS, wxRichTextBackgroundPage::OnRichtextShadowBlurUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_USE_SHADOW_OPACITY, wxRichTextBackgroundPage::OnRichtextShadowUpdate )
+ EVT_UPDATE_UI( ID_RICHTEXT_SHADOW_OPACITY, wxRichTextBackgroundPage::OnRichtextShadowOpacityUpdate )
////@end wxRichTextBackgroundPage event table entries
END_EVENT_TABLE()
@@ -94,6 +108,22 @@ void wxRichTextBackgroundPage::Init()
////@begin wxRichTextBackgroundPage member initialisation
m_backgroundColourCheckBox = NULL;
m_backgroundColourSwatch = NULL;
+ m_shadowBox = NULL;
+ m_useShadow = NULL;
+ m_offsetX = NULL;
+ m_unitsHorizontalOffset = NULL;
+ m_offsetY = NULL;
+ m_unitsVerticalOffset = NULL;
+ m_shadowColourCheckBox = NULL;
+ m_shadowColourSwatch = NULL;
+ m_useShadowSpread = NULL;
+ m_spread = NULL;
+ m_unitsShadowSpread = NULL;
+ m_useBlurDistance = NULL;
+ m_blurDistance = NULL;
+ m_unitsBlurDistance = NULL;
+ m_useShadowOpacity = NULL;
+ m_opacity = NULL;
////@end wxRichTextBackgroundPage member initialisation
}
@@ -117,7 +147,7 @@ void wxRichTextBackgroundPage::CreateControls()
itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW, 5);
wxStaticText* itemStaticText5 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Background"), wxDefaultPosition, wxDefaultSize, 0 );
- itemStaticText5->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxFONTWEIGHT_BOLD));
+ itemStaticText5->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxFONTWEIGHT_BOLD, false, wxT("")));
itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticLine* itemStaticLine6 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
@@ -141,6 +171,177 @@ void wxRichTextBackgroundPage::CreateControls()
m_backgroundColourSwatch->SetToolTip(_("The background colour."));
itemBoxSizer7->Add(m_backgroundColourSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+ m_shadowBox = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer3->Add(m_shadowBox, 0, wxGROW, 5);
+
+ wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
+ m_shadowBox->Add(itemBoxSizer12, 0, wxGROW, 5);
+
+ wxStaticText* itemStaticText13 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Shadow"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemStaticText13->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxFONTWEIGHT_BOLD, false, wxT("")));
+ itemBoxSizer12->Add(itemStaticText13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxStaticLine* itemStaticLine14 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
+ itemBoxSizer12->Add(itemStaticLine14, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL);
+ m_shadowBox->Add(itemBoxSizer15, 0, wxGROW, 5);
+
+ itemBoxSizer15->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer15->Add(itemBoxSizer17, 0, wxALIGN_CENTER_VERTICAL, 5);
+
+ m_useShadow = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_USE_SHADOW, _("Use &shadow"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_useShadow->SetValue(false);
+ m_useShadow->SetHelpText(_("Enables a shadow."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_useShadow->SetToolTip(_("Enables a shadow."));
+ itemBoxSizer17->Add(m_useShadow, 0, wxALIGN_LEFT|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxHORIZONTAL);
+ itemBoxSizer17->Add(itemBoxSizer19, 0, wxGROW, 5);
+
+ itemBoxSizer19->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer19->Add(itemBoxSizer21, 0, wxALIGN_CENTER_VERTICAL, 5);
+
+ wxFlexGridSizer* itemFlexGridSizer22 = new wxFlexGridSizer(0, 2, 0, 0);
+ itemBoxSizer21->Add(itemFlexGridSizer22, 0, wxGROW, 5);
+
+ wxStaticText* itemStaticText23 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Horizontal offset:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer22->Add(itemStaticText23, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer22->Add(itemBoxSizer24, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
+
+ m_offsetX = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
+ m_offsetX->SetHelpText(_("The horizontal offset."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_offsetX->SetToolTip(_("The horizontal offset."));
+ itemBoxSizer24->Add(m_offsetX, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
+
+ wxArrayString m_unitsHorizontalOffsetStrings;
+ m_unitsHorizontalOffsetStrings.Add(_("px"));
+ m_unitsHorizontalOffsetStrings.Add(_("cm"));
+ m_unitsHorizontalOffsetStrings.Add(_("pt"));
+ m_unitsHorizontalOffset = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsHorizontalOffsetStrings, wxCB_READONLY );
+ m_unitsHorizontalOffset->SetStringSelection(_("px"));
+ m_unitsHorizontalOffset->SetHelpText(_("Units for this value."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_unitsHorizontalOffset->SetToolTip(_("Units for this value."));
+ itemBoxSizer24->Add(m_unitsHorizontalOffset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxStaticText* itemStaticText27 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Vertical offset:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer22->Add(itemStaticText27, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer22->Add(itemBoxSizer28, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
+
+ m_offsetY = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_SHADOW_VERTICAL_OFFSET, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
+ m_offsetY->SetHelpText(_("The vertical offset."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_offsetY->SetToolTip(_("The vertical offset."));
+ itemBoxSizer28->Add(m_offsetY, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
+
+ wxArrayString m_unitsVerticalOffsetStrings;
+ m_unitsVerticalOffsetStrings.Add(_("px"));
+ m_unitsVerticalOffsetStrings.Add(_("cm"));
+ m_unitsVerticalOffsetStrings.Add(_("pt"));
+ m_unitsVerticalOffset = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_SHADOW_VERTICAL_OFFSET_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsVerticalOffsetStrings, wxCB_READONLY );
+ m_unitsVerticalOffset->SetStringSelection(_("px"));
+ m_unitsVerticalOffset->SetHelpText(_("Units for this value."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_unitsVerticalOffset->SetToolTip(_("Units for this value."));
+ itemBoxSizer28->Add(m_unitsVerticalOffset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ m_shadowColourCheckBox = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_USE_SHADOW_COLOUR, _("Shadow c&olour:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_shadowColourCheckBox->SetValue(false);
+ m_shadowColourCheckBox->SetHelpText(_("Enables the shadow colour."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_shadowColourCheckBox->SetToolTip(_("Enables the shadow colour."));
+ itemFlexGridSizer22->Add(m_shadowColourCheckBox, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ m_shadowColourSwatch = new wxRichTextColourSwatchCtrl( itemRichTextDialogPage1, ID_RICHTEXTSHADOWCOLOURSWATCHCTRL, wxDefaultPosition, wxSize(60, 20), wxBORDER_THEME );
+ m_shadowColourSwatch->SetHelpText(_("The shadow colour."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_shadowColourSwatch->SetToolTip(_("The shadow colour."));
+ itemFlexGridSizer22->Add(m_shadowColourSwatch, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ m_useShadowSpread = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_USE_SHADOW_SPREAD, _("Sh&adow spread:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_useShadowSpread->SetValue(false);
+ m_useShadowSpread->SetHelpText(_("Enables the shadow spread."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_useShadowSpread->SetToolTip(_("Enables the shadow spread."));
+ itemFlexGridSizer22->Add(m_useShadowSpread, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer22->Add(itemBoxSizer34, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
+
+ m_spread = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_SHADOW_SPREAD, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
+ m_spread->SetHelpText(_("The shadow spread."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_spread->SetToolTip(_("The shadow spread."));
+ itemBoxSizer34->Add(m_spread, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
+
+ wxArrayString m_unitsShadowSpreadStrings;
+ m_unitsShadowSpreadStrings.Add(_("px"));
+ m_unitsShadowSpreadStrings.Add(_("cm"));
+ m_unitsShadowSpreadStrings.Add(_("pt"));
+ m_unitsShadowSpread = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_SHADOW_SPREAD_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsShadowSpreadStrings, wxCB_READONLY );
+ m_unitsShadowSpread->SetStringSelection(_("px"));
+ m_unitsShadowSpread->SetHelpText(_("Units for this value."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_unitsShadowSpread->SetToolTip(_("Units for this value."));
+ itemBoxSizer34->Add(m_unitsShadowSpread, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ m_useBlurDistance = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_USE_BLUR_DISTANCE, _("&Blur distance:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_useBlurDistance->SetValue(false);
+ m_useBlurDistance->SetHelpText(_("Enables the blur distance."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_useBlurDistance->SetToolTip(_("Enables the blur distance."));
+ itemFlexGridSizer22->Add(m_useBlurDistance, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer38 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer22->Add(itemBoxSizer38, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
+
+ m_blurDistance = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_SHADOW_BLUR_DISTANCE, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
+ m_blurDistance->SetHelpText(_("The shadow blur distance."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_blurDistance->SetToolTip(_("The shadow blur distance."));
+ itemBoxSizer38->Add(m_blurDistance, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
+
+ wxArrayString m_unitsBlurDistanceStrings;
+ m_unitsBlurDistanceStrings.Add(_("px"));
+ m_unitsBlurDistanceStrings.Add(_("cm"));
+ m_unitsBlurDistanceStrings.Add(_("pt"));
+ m_unitsBlurDistance = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXT_SHADOW_BLUR_DISTANCE_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsBlurDistanceStrings, wxCB_READONLY );
+ m_unitsBlurDistance->SetStringSelection(_("px"));
+ m_unitsBlurDistance->SetHelpText(_("Units for this value."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_unitsBlurDistance->SetToolTip(_("Units for this value."));
+ itemBoxSizer38->Add(m_unitsBlurDistance, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ m_useShadowOpacity = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXT_USE_SHADOW_OPACITY, _("Opaci&ty:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_useShadowOpacity->SetValue(false);
+ m_useShadowOpacity->SetHelpText(_("Enables the shadow opacity."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_useShadowOpacity->SetToolTip(_("Enables the shadow opacity."));
+ itemFlexGridSizer22->Add(m_useShadowOpacity, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer42 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer22->Add(itemBoxSizer42, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
+
+ m_opacity = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXT_SHADOW_OPACITY, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0 );
+ m_opacity->SetHelpText(_("The shadow opacity."));
+ if (wxRichTextBackgroundPage::ShowToolTips())
+ m_opacity->SetToolTip(_("The shadow opacity."));
+ itemBoxSizer42->Add(m_opacity, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
+
+ wxStaticText* itemStaticText44 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemBoxSizer42->Add(itemStaticText44, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
////@end wxRichTextBackgroundPage content construction
}
@@ -168,6 +369,43 @@ bool wxRichTextBackgroundPage::TransferDataToWindow()
m_backgroundColourSwatch->SetColour(attr->GetBackgroundColour());
}
+ m_useShadow->SetValue(attr->GetTextBoxAttr().GetShadow().IsValid());
+
+ wxArrayInt units;
+ units.Add(wxTEXT_ATTR_UNITS_PIXELS);
+ units.Add(wxTEXT_ATTR_UNITS_TENTHS_MM);
+ units.Add(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT);
+
+ wxArrayInt percentUnits;
+ percentUnits.Add(wxTEXT_ATTR_UNITS_PERCENTAGE);
+
+ if (!attr->GetTextBoxAttr().GetShadow().GetOffsetX().IsValid())
+ attr->GetTextBoxAttr().GetShadow().GetOffsetX().SetValue(0, wxTEXT_ATTR_UNITS_PIXELS);
+ if (!attr->GetTextBoxAttr().GetShadow().GetOffsetY().IsValid())
+ attr->GetTextBoxAttr().GetShadow().GetOffsetY().SetValue(0, wxTEXT_ATTR_UNITS_PIXELS);
+
+ wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetX(), m_offsetX, m_unitsHorizontalOffset, NULL,
+ & units);
+ wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetY(), m_offsetY, m_unitsVerticalOffset, NULL,
+ & units);
+ wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetSpread(), m_spread, m_unitsShadowSpread, m_useShadowSpread,
+ & units);
+ wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetBlurDistance(), m_blurDistance, m_unitsBlurDistance, m_useBlurDistance,
+ & units);
+ wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOpacity(), m_opacity, NULL, m_useShadowOpacity,
+ & percentUnits);
+
+ if (!attr->GetTextBoxAttr().GetShadow().HasColour() || !attr->GetTextBoxAttr().GetShadow().IsValid())
+ {
+ m_shadowColourCheckBox->SetValue(false);
+ m_shadowColourSwatch->SetColour(*wxWHITE);
+ }
+ else
+ {
+ m_shadowColourCheckBox->SetValue(true);
+ m_shadowColourSwatch->SetColour(attr->GetTextBoxAttr().GetShadow().GetColour());
+ }
+
return true;
}
@@ -183,6 +421,41 @@ bool wxRichTextBackgroundPage::TransferDataFromWindow()
attr->SetFlags(attr->GetFlags() & ~wxTEXT_ATTR_BACKGROUND_COLOUR);
}
+ if (!m_useShadow->GetValue())
+ attr->GetTextBoxAttr().GetShadow().Reset();
+ else
+ {
+ attr->GetTextBoxAttr().GetShadow().SetValid(true);
+
+ wxArrayInt units;
+ units.Add(wxTEXT_ATTR_UNITS_PIXELS);
+ units.Add(wxTEXT_ATTR_UNITS_TENTHS_MM);
+ units.Add(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT);
+
+ wxArrayInt percentUnits;
+ percentUnits.Add(wxTEXT_ATTR_UNITS_PERCENTAGE);
+
+ wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetX(), m_offsetX, m_unitsHorizontalOffset, NULL,
+ & units);
+ wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetY(), m_offsetY, m_unitsVerticalOffset, NULL,
+ & units);
+ wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetSpread(), m_spread, m_unitsShadowSpread, m_useShadowSpread,
+ & units);
+ wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetBlurDistance(), m_blurDistance, m_unitsBlurDistance, m_useBlurDistance,
+ & units);
+ wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOpacity(), m_opacity, NULL, m_useShadowOpacity,
+ & percentUnits);
+
+ if (m_shadowColourCheckBox->GetValue())
+ {
+ attr->GetTextBoxAttr().GetShadow().SetColour(m_shadowColourSwatch->GetColour());
+ }
+ else
+ {
+ attr->GetTextBoxAttr().GetShadow().SetFlags(attr->GetTextBoxAttr().GetShadow().GetFlags() & ~wxTEXT_BOX_ATTR_BORDER_COLOUR);
+ }
+ }
+
return true;
}
@@ -223,3 +496,48 @@ wxIcon wxRichTextBackgroundPage::GetIconResource( const wxString& name )
return wxNullIcon;
////@end wxRichTextBackgroundPage icon retrieval
}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET
+ */
+
+void wxRichTextBackgroundPage::OnRichtextShadowUpdate( wxUpdateUIEvent& event )
+{
+ event.Enable(m_useShadow->GetValue());
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXTSHADOWCOLOURSWATCHCTRL
+ */
+
+void wxRichTextBackgroundPage::OnRichtextshadowcolourswatchctrlUpdate( wxUpdateUIEvent& event )
+{
+ // For now don't disable because of ugly disabled border on Windows
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_SPREAD
+ */
+
+void wxRichTextBackgroundPage::OnRichtextShadowSpreadUpdate( wxUpdateUIEvent& event )
+{
+ event.Enable(m_useShadow->GetValue() && m_useShadowSpread->GetValue());
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_BLUR_DISTANCE
+ */
+
+void wxRichTextBackgroundPage::OnRichtextShadowBlurUpdate( wxUpdateUIEvent& event )
+{
+ event.Enable(m_useShadow->GetValue() && m_useBlurDistance->GetValue());
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_RICHTEXT_SHADOW_OPACITY
+ */
+
+void wxRichTextBackgroundPage::OnRichtextShadowOpacityUpdate( wxUpdateUIEvent& event )
+{
+ event.Enable(m_useShadow->GetValue() && m_useShadowOpacity->GetValue());
+}
diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp
index b4119aeefd..2e4a8119b2 100644
--- a/src/richtext/richtextbuffer.cpp
+++ b/src/richtext/richtextbuffer.cpp
@@ -696,6 +696,75 @@ bool wxRichTextObject::DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, con
GetBoxRects(dc, buffer, attr, marginRect, borderRect, contentRect, paddingRect, outlineRect);
+ if (attr.GetTextBoxAttr().GetShadow().IsValid())
+ {
+ wxTextAttrDimensionConverter converter(dc, buffer ? buffer->GetScale() : 1.0);
+ wxColour shadowColour;
+ if (attr.GetTextBoxAttr().GetShadow().HasColour())
+ shadowColour = attr.GetTextBoxAttr().GetShadow().GetColour();
+ else
+ shadowColour = *wxLIGHT_GREY;
+ if (attr.GetTextBoxAttr().GetShadow().GetOpacity().IsValid())
+ {
+ // Let's pretend our background is always white. Calculate a colour value
+ // from this and the opacity.
+ double p = attr.GetTextBoxAttr().GetShadow().GetOpacity().GetValue() / 100.0;
+ shadowColour.Set((1.0 - p)*255 + p*shadowColour.Red(), (1.0 - p)*255 + p*shadowColour.Green(), (1.0 - p)*255 + p*shadowColour.Blue());
+ }
+ wxRect shadowRect = borderRect;
+ if (attr.GetTextBoxAttr().GetShadow().GetOffsetX().IsValid())
+ {
+ int pxX = converter.GetPixels(attr.GetTextBoxAttr().GetShadow().GetOffsetX());
+ shadowRect.x += pxX;
+ }
+ if (attr.GetTextBoxAttr().GetShadow().GetOffsetY().IsValid())
+ {
+ int pxY = converter.GetPixels(attr.GetTextBoxAttr().GetShadow().GetOffsetY());
+ shadowRect.y += pxY;
+ }
+ if (attr.GetTextBoxAttr().GetShadow().GetSpread().IsValid())
+ {
+ int pxSpread = converter.GetPixels(attr.GetTextBoxAttr().GetShadow().GetSpread());
+ shadowRect.x -= pxSpread;
+ shadowRect.y -= pxSpread;
+ shadowRect.width += 2*pxSpread;
+ shadowRect.height += 2*pxSpread;
+ }
+ dc.SetPen(*wxTRANSPARENT_PEN);
+ dc.SetBrush(wxBrush(shadowColour));
+ if (attr.GetTextBoxAttr().HasCornerRadius() && attr.GetTextBoxAttr().GetCornerRadius().GetValue() > 0)
+ {
+ wxTextAttrDimensionConverter converter(dc, buffer ? buffer->GetScale() : 1.0);
+ int cornerRadius = converter.GetPixels(attr.GetTextBoxAttr().GetCornerRadius());
+ if (cornerRadius > 0)
+ {
+ dc.DrawRoundedRectangle(shadowRect, cornerRadius);
+ }
+ else
+ dc.DrawRectangle(shadowRect);
+ }
+ else
+ dc.DrawRectangle(shadowRect);
+
+ // If there's no box colour, draw over the shadow in the nearest available colour
+ if (!attr.HasBackgroundColour())
+ {
+ wxColour bgColour;
+ if (obj)
+ {
+ wxRichTextCompositeObject* composite = obj->GetParentContainer();
+ if (composite && composite->GetAttributes().HasBackgroundColour())
+ bgColour = composite->GetAttributes().GetBackgroundColour();
+ }
+ if (!bgColour.IsOk() && buffer)
+ bgColour = buffer->GetAttributes().GetBackgroundColour();
+ if (!bgColour.IsOk())
+ bgColour = *wxWHITE;
+ dc.SetBrush(wxBrush(bgColour));
+ dc.DrawRectangle(borderRect);
+ }
+ }
+
// Margin is transparent. Draw background from margin.
if (attr.HasBackgroundColour() || (flags & wxRICHTEXT_DRAW_SELECTED))
{
@@ -13426,6 +13495,7 @@ void wxTextBoxAttr::Reset()
m_border.Reset();
m_outline.Reset();
m_cornerRadius.Reset();
+ m_shadow.Reset();
}
// Equality test
@@ -13451,7 +13521,8 @@ bool wxTextBoxAttr::operator== (const wxTextBoxAttr& attr) const
m_border == attr.m_border &&
m_outline == attr.m_outline &&
- m_boxStyleName == attr.m_boxStyleName
+ m_boxStyleName == attr.m_boxStyleName &&
+ m_shadow == attr.m_shadow
);
}
@@ -13465,6 +13536,7 @@ bool wxTextBoxAttr::EqPartial(const wxTextBoxAttr& attr, bool weakTest) const
(!HasVerticalAlignment() && attr.HasVerticalAlignment()) ||
(!HasWhitespaceMode() && attr.HasWhitespaceMode()) ||
(!HasCornerRadius() && attr.HasCornerRadius()) ||
+ (!m_shadow.IsValid() && attr.m_shadow.IsValid()) ||
(!HasBoxStyleName() && attr.HasBoxStyleName())))
{
return false;
@@ -13524,6 +13596,11 @@ bool wxTextBoxAttr::EqPartial(const wxTextBoxAttr& attr, bool weakTest) const
if (!GetOutline().EqPartial(attr.GetOutline(), weakTest))
return false;
+ // Shadow
+
+ if (!GetShadow().EqPartial(attr.GetShadow(), weakTest))
+ return false;
+
return true;
}
@@ -13584,6 +13661,8 @@ bool wxTextBoxAttr::Apply(const wxTextBoxAttr& attr, const wxTextBoxAttr* compar
m_border.Apply(attr.m_border, compareWith ? (& compareWith->m_border) : (const wxTextAttrBorders*) NULL);
m_outline.Apply(attr.m_outline, compareWith ? (& compareWith->m_outline) : (const wxTextAttrBorders*) NULL);
+ m_shadow.Apply(attr.m_shadow, compareWith ? (& compareWith->m_shadow) : (const wxTextAttrShadow*) NULL);
+
return true;
}
@@ -13625,6 +13704,8 @@ bool wxTextBoxAttr::RemoveStyle(const wxTextBoxAttr& attr)
m_border.RemoveStyle(attr.m_border);
m_outline.RemoveStyle(attr.m_outline);
+ m_shadow.RemoveStyle(attr.m_shadow);
+
return true;
}
@@ -13776,6 +13857,8 @@ void wxTextBoxAttr::CollectCommonAttributes(const wxTextBoxAttr& attr, wxTextBox
m_border.CollectCommonAttributes(attr.m_border, clashingAttr.m_border, absentAttr.m_border);
m_outline.CollectCommonAttributes(attr.m_outline, clashingAttr.m_outline, absentAttr.m_outline);
+
+ m_shadow.CollectCommonAttributes(attr.m_shadow, clashingAttr.m_shadow, absentAttr.m_shadow);
}
bool wxTextBoxAttr::IsDefault() const
@@ -13786,7 +13869,8 @@ bool wxTextBoxAttr::IsDefault() const
!m_maxSize.GetWidth().IsValid() && !m_maxSize.GetHeight().IsValid() &&
!m_position.GetLeft().IsValid() && !m_position.GetRight().IsValid() && !m_position.GetTop().IsValid() && !m_position.GetBottom().IsValid() &&
!m_padding.GetLeft().IsValid() && !m_padding.GetRight().IsValid() && !m_padding.GetTop().IsValid() && !m_padding.GetBottom().IsValid() &&
- !m_margins.GetLeft().IsValid() && !m_margins.GetRight().IsValid() && !m_margins.GetTop().IsValid() && !m_margins.GetBottom().IsValid();
+ !m_margins.GetLeft().IsValid() && !m_margins.GetRight().IsValid() && !m_margins.GetTop().IsValid() && !m_margins.GetBottom().IsValid() &&
+ m_shadow.IsDefault();
}
// wxRichTextAttr
@@ -15406,5 +15490,127 @@ void wxRichTextBuffer::CleanUpFieldTypes()
sm_fieldTypes.clear();
}
+// Shadow
+
+bool wxTextAttrShadow::operator==(const wxTextAttrShadow& shadow) const
+{
+ return (m_flags == shadow.m_flags &&
+ m_shadowColour == shadow.m_shadowColour &&
+ m_offsetX == shadow.m_offsetX &&
+ m_offsetY == shadow.m_offsetY &&
+ m_spread == shadow.m_spread &&
+ m_blurDistance == shadow.m_blurDistance &&
+ m_opacity == shadow.m_opacity);
+}
+
+void wxTextAttrShadow::Reset()
+{
+ m_flags = 0;
+ m_shadowColour = 0;
+ m_offsetX.Reset();
+ m_offsetY.Reset();
+ m_spread.Reset();
+ m_blurDistance.Reset();
+ m_opacity.Reset();
+}
+
+bool wxTextAttrShadow::EqPartial(const wxTextAttrShadow& shadow, bool weakTest) const
+{
+ if (!weakTest &&
+ ((!m_offsetX.IsValid() && shadow.m_offsetX.IsValid()) ||
+ (!m_offsetY.IsValid() && shadow.m_offsetY.IsValid()) ||
+ (!m_spread.IsValid() && shadow.m_spread.IsValid()) ||
+ (!m_blurDistance.IsValid() && shadow.m_blurDistance.IsValid()) ||
+ (!m_opacity.IsValid() && shadow.m_opacity.IsValid()) ||
+ (!HasColour() && shadow.HasColour())
+ ))
+ {
+ return false;
+ }
+
+ if (m_offsetX.IsValid() && shadow.m_offsetX.IsValid() && !(m_offsetX == shadow.m_offsetX))
+ return false;
+
+ if (m_offsetY.IsValid() && shadow.m_offsetY.IsValid() && !(m_offsetY == shadow.m_offsetY))
+ return false;
+
+ if (m_spread.IsValid() && shadow.m_spread.IsValid() && !(m_spread == shadow.m_spread))
+ return false;
+
+ if (m_blurDistance.IsValid() && shadow.m_blurDistance.IsValid() && !(m_blurDistance == shadow.m_blurDistance))
+ return false;
+
+ if (m_opacity.IsValid() && shadow.m_opacity.IsValid() && !(m_opacity == shadow.m_opacity))
+ return false;
+
+ if (HasColour() && shadow.HasColour() && m_shadowColour != shadow.m_shadowColour)
+ return false;
+
+ return true;
+}
+
+bool wxTextAttrShadow::Apply(const wxTextAttrShadow& shadow, const wxTextAttrShadow* compareWith)
+{
+ m_offsetX.Apply(shadow.m_offsetX, compareWith ? (& compareWith->m_offsetX) : NULL);
+ m_offsetY.Apply(shadow.m_offsetY, compareWith ? (& compareWith->m_offsetY) : NULL);
+ m_spread.Apply(shadow.m_spread, compareWith ? (& compareWith->m_spread) : NULL);
+ m_blurDistance.Apply(shadow.m_blurDistance, compareWith ? (& compareWith->m_blurDistance) : NULL);
+ m_opacity.Apply(shadow.m_opacity, compareWith ? (& compareWith->m_opacity) : NULL);
+
+ if (shadow.HasColour() && !(compareWith && (shadow.m_shadowColour == compareWith->m_shadowColour)))
+ SetColour(shadow.m_shadowColour);
+
+ if (!IsDefault())
+ SetValid(true);
+
+ return true;
+}
+
+bool wxTextAttrShadow::RemoveStyle(const wxTextAttrShadow& attr)
+{
+ if (attr.GetOffsetX().IsValid() && GetOffsetX().IsValid())
+ GetOffsetX().Reset();
+ if (attr.GetOffsetY().IsValid() && GetOffsetY().IsValid())
+ GetOffsetY().Reset();
+ if (attr.GetSpread().IsValid() && GetSpread().IsValid())
+ GetSpread().Reset();
+ if (attr.GetBlurDistance().IsValid() && GetBlurDistance().IsValid())
+ GetBlurDistance().Reset();
+ if (attr.GetOpacity().IsValid() && GetOpacity().IsValid())
+ GetOpacity().Reset();
+ if (attr.HasColour() && HasColour())
+ RemoveFlag(wxTEXT_BOX_ATTR_BORDER_COLOUR);
+
+ return true;
+}
+
+void wxTextAttrShadow::CollectCommonAttributes(const wxTextAttrShadow& attr, wxTextAttrShadow& clashingAttr, wxTextAttrShadow& absentAttr)
+{
+ GetOffsetX().CollectCommonAttributes(attr.GetOffsetX(), clashingAttr.GetOffsetX(), absentAttr.GetOffsetX());
+ GetOffsetY().CollectCommonAttributes(attr.GetOffsetY(), clashingAttr.GetOffsetY(), absentAttr.GetOffsetY());
+ GetSpread().CollectCommonAttributes(attr.GetSpread(), clashingAttr.GetSpread(), absentAttr.GetSpread());
+ GetBlurDistance().CollectCommonAttributes(attr.GetBlurDistance(), clashingAttr.GetBlurDistance(), absentAttr.GetBlurDistance());
+ GetOpacity().CollectCommonAttributes(attr.GetOpacity(), clashingAttr.GetOpacity(), absentAttr.GetOpacity());
+
+ if (attr.HasColour())
+ {
+ if (!clashingAttr.HasColour() && !absentAttr.HasColour())
+ {
+ if (HasColour())
+ {
+ if (GetColour() != attr.GetColour())
+ {
+ clashingAttr.AddFlag(wxTEXT_BOX_ATTR_BORDER_COLOUR);
+ RemoveFlag(wxTEXT_BOX_ATTR_BORDER_COLOUR);
+ }
+ }
+ else
+ SetColour(attr.GetColourLong());
+ }
+ }
+ else
+ absentAttr.AddFlag(wxTEXT_BOX_ATTR_BORDER_COLOUR);
+}
+
#endif
// wxUSE_RICHTEXT
diff --git a/src/richtext/richtextdialogs.pjd b/src/richtext/richtextdialogs.pjd
index 845982ffc9..353af82f62 100644
--- a/src/richtext/richtextdialogs.pjd
+++ b/src/richtext/richtextdialogs.pjd
@@ -15208,6 +15208,14 @@
"wbBoxSizerProxy"
"Vertical"
""
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
0
0
0
@@ -15307,6 +15315,14 @@
"wbBoxSizerProxy"
"Vertical"
""
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
0
0
0
@@ -22780,6 +22796,14 @@
"wbBoxSizerProxy"
"Vertical"
""
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
0
0
0
@@ -27979,14 +28003,6 @@
"wbBoxSizerProxy"
"Vertical"
""
- "Centre"
- "Centre"
- 0
- 5
- 1
- 1
- 1
- 1
0
0
0
@@ -28358,6 +28374,1795 @@
""
+
+ "wxBoxSizer V"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Vertical"
+ "m_shadowBox"
+ "Expand"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+
+ "wxBoxSizer H"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Horizontal"
+ ""
+ "Expand"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+ "wxStaticText: wxID_STATIC"
+ "dialog-control-document"
+ ""
+ "statictext"
+ 0
+ 1
+ 0
+ 0
+ "wbStaticTextProxy"
+ "wxID_STATIC"
+ 5105
+ ""
+ "wxStaticText"
+ "wxStaticText"
+ 1
+ 0
+ ""
+ ""
+ ""
+ "Shadow"
+ -1
+ ""
+ ""
+ ""
+ ""
+ "wxSYS_DEFAULT_GUI_FONT:default,default,default, wxBOLD, false"
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ -1
+ -1
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxStaticLine: wxID_STATIC"
+ "dialog-control-document"
+ ""
+ "staticline"
+ 0
+ 1
+ 0
+ 0
+ "wbStaticLineProxy"
+ "wxID_STATIC"
+ 5105
+ ""
+ "wxStaticLine"
+ "wxStaticLine"
+ 1
+ 0
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ -1
+ -1
+ "Centre"
+ "Centre"
+ 1
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+
+ "wxBoxSizer H"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Horizontal"
+ ""
+ "Expand"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+ "Spacer"
+ "dialog-control-document"
+ ""
+ "spacer"
+ 0
+ 1
+ 0
+ 0
+ "wbSpacerProxy"
+ 5
+ 5
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+
+ "wxBoxSizer V"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Vertical"
+ ""
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+ "wxCheckBox: ID_RICHTEXT_USE_SHADOW"
+ "dialog-control-document"
+ ""
+ "checkbox"
+ 0
+ 1
+ 0
+ 0
+ "wbCheckBoxProxy"
+ "ID_RICHTEXT_USE_SHADOW"
+ 10840
+ ""
+ "wxCheckBox"
+ "wxCheckBox"
+ 1
+ 0
+ ""
+ ""
+ "m_useShadow"
+ "Use &shadow"
+ 0
+ "Enables a shadow."
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ -1
+ -1
+ "Left"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxBoxSizer H"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Horizontal"
+ ""
+ "Expand"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+ "Spacer"
+ "dialog-control-document"
+ ""
+ "spacer"
+ 0
+ 1
+ 0
+ 0
+ "wbSpacerProxy"
+ 5
+ 5
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+
+ "wxBoxSizer V"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Vertical"
+ ""
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+ "wxFlexGridSizer"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbFlexGridSizerProxy"
+ ""
+ ""
+ 2
+ 0
+ 0
+ 0
+ ""
+ "<Any platform>"
+ "Expand"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+ "wxStaticText: wxID_STATIC"
+ "dialog-control-document"
+ ""
+ "statictext"
+ 0
+ 1
+ 0
+ 0
+ "wbStaticTextProxy"
+ "wxID_STATIC"
+ 5105
+ ""
+ "wxStaticText"
+ "wxStaticText"
+ 1
+ 0
+ ""
+ ""
+ ""
+ "&Horizontal offset:"
+ -1
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ -1
+ -1
+ "Right"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxBoxSizer H"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Horizontal"
+ ""
+ "Left"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+ "wxTextCtrl: ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET"
+ "dialog-control-document"
+ ""
+ "textctrl"
+ 0
+ 1
+ 0
+ 0
+ "wbTextCtrlProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET"
+ 10703
+ ""
+ "wxTextCtrl"
+ "wxTextCtrl"
+ 1
+ 0
+ ""
+ ""
+ "m_offsetX"
+ ""
+ 0
+ "The horizontal offset."
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ 60
+ -1
+ "Left"
+ "Centre"
+ 0
+ 5
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxComboBox: ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET_UNITS"
+ "dialog-control-document"
+ ""
+ "combobox"
+ 0
+ 1
+ 0
+ 0
+ "wbComboBoxProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_SHADOW_HORIZONTAL_OFFSET_UNITS"
+ 10712
+ ""
+ "wxComboBox"
+ "wxComboBox"
+ 1
+ 0
+ ""
+ ""
+ "m_unitsHorizontalOffset"
+ "px|cm|pt"
+ "px"
+ "Units for this value."
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ 60
+ -1
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+
+ "wxStaticText: wxID_STATIC"
+ "dialog-control-document"
+ ""
+ "statictext"
+ 0
+ 1
+ 0
+ 0
+ "wbStaticTextProxy"
+ "wxID_STATIC"
+ 5105
+ ""
+ "wxStaticText"
+ "wxStaticText"
+ 1
+ 0
+ ""
+ ""
+ ""
+ "&Vertical offset:"
+ -1
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ -1
+ -1
+ "Right"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxBoxSizer H"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Horizontal"
+ ""
+ "Left"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+ "wxTextCtrl: ID_RICHTEXT_SHADOW_VERTICAL_OFFSET"
+ "dialog-control-document"
+ ""
+ "textctrl"
+ 0
+ 1
+ 0
+ 0
+ "wbTextCtrlProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_SHADOW_VERTICAL_OFFSET"
+ 10841
+ ""
+ "wxTextCtrl"
+ "wxTextCtrl"
+ 1
+ 0
+ ""
+ ""
+ "m_offsetY"
+ ""
+ 0
+ "The vertical offset."
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ 60
+ -1
+ "Left"
+ "Centre"
+ 0
+ 5
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxComboBox: ID_RICHTEXT_SHADOW_VERTICAL_OFFSET_UNITS"
+ "dialog-control-document"
+ ""
+ "combobox"
+ 0
+ 1
+ 0
+ 0
+ "wbComboBoxProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_SHADOW_VERTICAL_OFFSET_UNITS"
+ 10842
+ ""
+ "wxComboBox"
+ "wxComboBox"
+ 1
+ 0
+ ""
+ ""
+ "m_unitsVerticalOffset"
+ "px|cm|pt"
+ "px"
+ "Units for this value."
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ 60
+ -1
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+
+ "wxCheckBox: ID_RICHTEXT_USE_SHADOW_COLOUR"
+ "dialog-control-document"
+ ""
+ "checkbox"
+ 0
+ 1
+ 0
+ 0
+ "wbCheckBoxProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_USE_SHADOW_COLOUR"
+ 10843
+ ""
+ "wxCheckBox"
+ "wxCheckBox"
+ 1
+ 0
+ ""
+ ""
+ "m_shadowColourCheckBox"
+ "Shadow c&olour:"
+ 0
+ "Enables the shadow colour."
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ -1
+ -1
+ "Right"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxRichTextColourSwatchCtrl: ID_RICHTEXTSHADOWCOLOURSWATCHCTRL"
+ "dialog-control-document"
+ ""
+ "foreign"
+ 0
+ 1
+ 0
+ 0
+ "wbForeignCtrlProxy"
+ "wxEVT_UPDATE_UI|OnRichtextshadowcolourswatchctrlUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXTSHADOWCOLOURSWATCHCTRL"
+ 10844
+ ""
+ "wxRichTextColourSwatchCtrl"
+ "wxWindow"
+ 1
+ 0
+ ""
+ ""
+ "m_shadowColourSwatch"
+ 1
+ "The shadow colour."
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ 60
+ 20
+ "Left"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+ ""
+
+
+ "wxCheckBox: ID_RICHTEXT_USE_SHADOW_SPREAD"
+ "dialog-control-document"
+ ""
+ "checkbox"
+ 0
+ 1
+ 0
+ 0
+ "wbCheckBoxProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_USE_SHADOW_SPREAD"
+ 10851
+ ""
+ "wxCheckBox"
+ "wxCheckBox"
+ 1
+ 0
+ ""
+ ""
+ "m_useShadowSpread"
+ "Sh&adow spread:"
+ 0
+ "Enables the shadow spread."
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ -1
+ -1
+ "Right"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxBoxSizer H"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Horizontal"
+ ""
+ "Left"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+ "wxTextCtrl: ID_RICHTEXT_SHADOW_SPREAD"
+ "dialog-control-document"
+ ""
+ "textctrl"
+ 0
+ 1
+ 0
+ 0
+ "wbTextCtrlProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowSpreadUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_SHADOW_SPREAD"
+ 10848
+ ""
+ "wxTextCtrl"
+ "wxTextCtrl"
+ 1
+ 0
+ ""
+ ""
+ "m_spread"
+ ""
+ 0
+ "The shadow spread."
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ 60
+ -1
+ "Left"
+ "Centre"
+ 0
+ 5
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxComboBox: ID_RICHTEXT_SHADOW_SPREAD_UNITS"
+ "dialog-control-document"
+ ""
+ "combobox"
+ 0
+ 1
+ 0
+ 0
+ "wbComboBoxProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowSpreadUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_SHADOW_SPREAD_UNITS"
+ 10849
+ ""
+ "wxComboBox"
+ "wxComboBox"
+ 1
+ 0
+ ""
+ ""
+ "m_unitsShadowSpread"
+ "px|cm|pt"
+ "px"
+ "Units for this value."
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ 60
+ -1
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+
+ "wxCheckBox: ID_RICHTEXT_USE_BLUR_DISTANCE"
+ "dialog-control-document"
+ ""
+ "checkbox"
+ 0
+ 1
+ 0
+ 0
+ "wbCheckBoxProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_USE_BLUR_DISTANCE"
+ 10855
+ ""
+ "wxCheckBox"
+ "wxCheckBox"
+ 1
+ 0
+ ""
+ ""
+ "m_useBlurDistance"
+ "&Blur distance:"
+ 0
+ "Enables the blur distance."
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ -1
+ -1
+ "Right"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxBoxSizer H"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Horizontal"
+ ""
+ "Left"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+ "wxTextCtrl: ID_RICHTEXT_SHADOW_BLUR_DISTANCE"
+ "dialog-control-document"
+ ""
+ "textctrl"
+ 0
+ 1
+ 0
+ 0
+ "wbTextCtrlProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowBlurUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_SHADOW_BLUR_DISTANCE"
+ 10852
+ ""
+ "wxTextCtrl"
+ "wxTextCtrl"
+ 1
+ 0
+ ""
+ ""
+ "m_blurDistance"
+ ""
+ 0
+ "The shadow blur distance."
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ 60
+ -1
+ "Left"
+ "Centre"
+ 0
+ 5
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxComboBox: ID_RICHTEXT_SHADOW_BLUR_DISTANCE_UNITS"
+ "dialog-control-document"
+ ""
+ "combobox"
+ 0
+ 1
+ 0
+ 0
+ "wbComboBoxProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowBlurUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_SHADOW_BLUR_DISTANCE_UNITS"
+ 10853
+ ""
+ "wxComboBox"
+ "wxComboBox"
+ 1
+ 0
+ ""
+ ""
+ "m_unitsBlurDistance"
+ "px|cm|pt"
+ "px"
+ "Units for this value."
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ 60
+ -1
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+
+ "wxCheckBox: ID_RICHTEXT_USE_SHADOW_OPACITY"
+ "dialog-control-document"
+ ""
+ "checkbox"
+ 0
+ 1
+ 0
+ 0
+ "wbCheckBoxProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_USE_SHADOW_OPACITY"
+ 10856
+ ""
+ "wxCheckBox"
+ "wxCheckBox"
+ 1
+ 0
+ ""
+ ""
+ "m_useShadowOpacity"
+ "Opaci&ty:"
+ 0
+ "Enables the shadow opacity."
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ -1
+ -1
+ "Right"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxBoxSizer H"
+ "dialog-control-document"
+ ""
+ "sizer"
+ 0
+ 1
+ 0
+ 0
+ "wbBoxSizerProxy"
+ "Horizontal"
+ ""
+ "Left"
+ "Centre"
+ 0
+ 5
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ "<Any platform>"
+
+ "wxTextCtrl: ID_RICHTEXT_SHADOW_OPACITY"
+ "dialog-control-document"
+ ""
+ "textctrl"
+ 0
+ 1
+ 0
+ 0
+ "wbTextCtrlProxy"
+ "wxEVT_UPDATE_UI|OnRichtextShadowOpacityUpdate|NONE||wxRichTextBackgroundPage"
+ "ID_RICHTEXT_SHADOW_OPACITY"
+ 10854
+ ""
+ "wxTextCtrl"
+ "wxTextCtrl"
+ 1
+ 0
+ ""
+ ""
+ "m_opacity"
+ ""
+ 0
+ "The shadow opacity."
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ 60
+ -1
+ "Left"
+ "Centre"
+ 0
+ 5
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+ "wxStaticText: wxID_STATIC"
+ "dialog-control-document"
+ ""
+ "statictext"
+ 0
+ 1
+ 0
+ 0
+ "wbStaticTextProxy"
+ "wxID_STATIC"
+ 5105
+ ""
+ "wxStaticText"
+ "wxStaticText"
+ 1
+ 0
+ ""
+ ""
+ ""
+ "%"
+ -1
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 1
+ "<Any platform>"
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ""
+ -1
+ -1
+ -1
+ -1
+ "Centre"
+ "Centre"
+ 0
+ 5
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ ""
+ ""
+
+
+
+
+
+
+
+
diff --git a/src/richtext/richtextformatdlg.cpp b/src/richtext/richtextformatdlg.cpp
index 1b8c4d4dc9..8383ca479f 100644
--- a/src/richtext/richtextformatdlg.cpp
+++ b/src/richtext/richtextformatdlg.cpp
@@ -614,7 +614,8 @@ void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxT
if (checkBox)
checkBox->SetValue(false);
valueCtrl->SetValue(wxT("0"));
- unitsCtrl->SetSelection(0);
+ if (unitsCtrl)
+ unitsCtrl->SetSelection(0);
}
else
{
@@ -656,12 +657,17 @@ void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxT
unitsIdx = 0;
}
- unitsCtrl->SetSelection(unitsIdx);
+ if (unitsCtrl)
+ unitsCtrl->SetSelection(unitsIdx);
}
}
void wxRichTextFormattingDialog::GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units)
{
+ int unitsSel = 0;
+ if (unitsCtrl)
+ unitsSel = unitsCtrl->GetSelection();
+
if (checkBox && !checkBox->GetValue())
{
dim.Reset();
@@ -670,18 +676,18 @@ void wxRichTextFormattingDialog::GetDimensionValue(wxTextAttrDimension& dim, wxT
{
if (units)
{
- int unit = (*units)[unitsCtrl->GetSelection()];
+ int unit = (*units)[unitsSel];
dim.SetUnits((wxTextAttrUnits) unit);
}
else
{
- if (unitsCtrl->GetSelection() == 0)
+ if (unitsSel == 0)
dim.SetUnits(wxTEXT_ATTR_UNITS_PIXELS);
- else if (unitsCtrl->GetSelection() == 1)
+ else if (unitsSel == 1)
dim.SetUnits(wxTEXT_ATTR_UNITS_TENTHS_MM);
- else if (unitsCtrl->GetSelection() == 2)
+ else if (unitsSel == 2)
dim.SetUnits(wxTEXT_ATTR_UNITS_PERCENTAGE);
- else if (unitsCtrl->GetSelection() == 3)
+ else if (unitsSel == 3)
dim.SetUnits(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT);
}
@@ -703,6 +709,7 @@ bool wxRichTextFormattingDialog::ConvertFromString(const wxString& str, int& ret
float value = 0.0;
wxSscanf(str.c_str(), wxT("%f"), &value);
// Convert from cm
+ // Do this in two steps, since using one step causes strange rounding error for VS 2010 at least.
float v = (value * 100.0);
ret = (int) (v);
return true;