use enumerations instead of integers for wxFont style/weight/family

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58159 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-01-16 20:46:20 +00:00
parent 634ad7722b
commit 7d76fbd5a1
7 changed files with 113 additions and 61 deletions

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Name: wx/textctrl.h // Name: wx/textctrl.h
// Purpose: wxTextCtrlBase class - the interface of wxTextCtrl // Purpose: wxTextAttr and wxTextCtrlBase class - the interface of wxTextCtrl
// Author: Vadim Zeitlin // Author: Vadim Zeitlin
// Modified by: // Modified by:
// Created: 13.07.99 // Created: 13.07.99
@@ -165,6 +165,7 @@ enum wxTextAttrFlags
{ {
wxTEXT_ATTR_TEXT_COLOUR = 0x00000001, wxTEXT_ATTR_TEXT_COLOUR = 0x00000001,
wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002, wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002,
wxTEXT_ATTR_FONT_FACE = 0x00000004, wxTEXT_ATTR_FONT_FACE = 0x00000004,
wxTEXT_ATTR_FONT_SIZE = 0x00000008, wxTEXT_ATTR_FONT_SIZE = 0x00000008,
wxTEXT_ATTR_FONT_WEIGHT = 0x00000010, wxTEXT_ATTR_FONT_WEIGHT = 0x00000010,
@@ -180,17 +181,23 @@ enum wxTextAttrFlags
wxTEXT_ATTR_LEFT_INDENT = 0x00000100, wxTEXT_ATTR_LEFT_INDENT = 0x00000100,
wxTEXT_ATTR_RIGHT_INDENT = 0x00000200, wxTEXT_ATTR_RIGHT_INDENT = 0x00000200,
wxTEXT_ATTR_TABS = 0x00000400, wxTEXT_ATTR_TABS = 0x00000400,
wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800, wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800,
wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000, wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000,
wxTEXT_ATTR_LINE_SPACING = 0x00002000, wxTEXT_ATTR_LINE_SPACING = 0x00002000,
wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000, wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000,
wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000, wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000,
wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000, wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000,
wxTEXT_ATTR_BULLET_STYLE = 0x00020000, wxTEXT_ATTR_BULLET_STYLE = 0x00020000,
wxTEXT_ATTR_BULLET_NUMBER = 0x00040000, wxTEXT_ATTR_BULLET_NUMBER = 0x00040000,
wxTEXT_ATTR_BULLET_TEXT = 0x00080000, wxTEXT_ATTR_BULLET_TEXT = 0x00080000,
wxTEXT_ATTR_BULLET_NAME = 0x00100000, wxTEXT_ATTR_BULLET_NAME = 0x00100000,
wxTEXT_ATTR_BULLET = \
( wxTEXT_ATTR_BULLET_STYLE | wxTEXT_ATTR_BULLET_NUMBER | wxTEXT_ATTR_BULLET_TEXT | \
wxTEXT_ATTR_BULLET_NAME ),
wxTEXT_ATTR_URL = 0x00200000, wxTEXT_ATTR_URL = 0x00200000,
wxTEXT_ATTR_PAGE_BREAK = 0x00400000, wxTEXT_ATTR_PAGE_BREAK = 0x00400000,
wxTEXT_ATTR_EFFECTS = 0x00800000, wxTEXT_ATTR_EFFECTS = 0x00800000,
@@ -207,8 +214,7 @@ enum wxTextAttrFlags
wxTEXT_ATTR_PARAGRAPH = \ wxTEXT_ATTR_PARAGRAPH = \
(wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\ (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\
wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\ wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\
wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|\ wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL),
wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL),
wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH) wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH)
}; };
@@ -307,12 +313,12 @@ public:
void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; } void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; }
void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags |= wxTEXT_ATTR_FONT_SIZE; } void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags |= wxTEXT_ATTR_FONT_SIZE; }
void SetFontStyle(int fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; } void SetFontStyle(wxFontStyle fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; }
void SetFontWeight(int fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; } void SetFontWeight(wxFontWeight fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; }
void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; } void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; }
void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; } void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; }
void SetFontEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; m_flags |= wxTEXT_ATTR_FONT_ENCODING; } void SetFontEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; m_flags |= wxTEXT_ATTR_FONT_ENCODING; }
void SetFontFamily(int family) { m_fontFamily = family; m_flags |= wxTEXT_ATTR_FONT_FAMILY; } void SetFontFamily(wxFontFamily family) { m_fontFamily = family; m_flags |= wxTEXT_ATTR_FONT_FAMILY; }
// Set font // Set font
void SetFont(const wxFont& font, int flags = wxTEXT_ATTR_FONT) { GetFontAttributes(font, flags); } void SetFont(const wxFont& font, int flags = wxTEXT_ATTR_FONT) { GetFontAttributes(font, flags); }
@@ -346,12 +352,12 @@ public:
long GetFlags() const { return m_flags; } long GetFlags() const { return m_flags; }
int GetFontSize() const { return m_fontSize; } int GetFontSize() const { return m_fontSize; }
int GetFontStyle() const { return m_fontStyle; } wxFontStyle GetFontStyle() const { return m_fontStyle; }
int GetFontWeight() const { return m_fontWeight; } wxFontWeight GetFontWeight() const { return m_fontWeight; }
bool GetFontUnderlined() const { return m_fontUnderlined; } bool GetFontUnderlined() const { return m_fontUnderlined; }
const wxString& GetFontFaceName() const { return m_fontFaceName; } const wxString& GetFontFaceName() const { return m_fontFaceName; }
wxFontEncoding GetFontEncoding() const { return m_fontEncoding; } wxFontEncoding GetFontEncoding() const { return m_fontEncoding; }
int GetFontFamily() const { return m_fontFamily; } wxFontFamily GetFontFamily() const { return m_fontFamily; }
wxFont GetFont() const; wxFont GetFont() const;
@@ -361,7 +367,6 @@ public:
int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; } int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; }
int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; } int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; }
// TODO: should return the relative wxTextAttr* enumeration values
int GetLineSpacing() const { return m_lineSpacing; } int GetLineSpacing() const { return m_lineSpacing; }
int GetBulletStyle() const { return m_bulletStyle; } int GetBulletStyle() const { return m_bulletStyle; }
int GetBulletNumber() const { return m_bulletNumber; } int GetBulletNumber() const { return m_bulletNumber; }
@@ -489,9 +494,9 @@ private:
wxColour m_colText, wxColour m_colText,
m_colBack; m_colBack;
int m_fontSize; int m_fontSize;
int m_fontStyle; wxFontStyle m_fontStyle;
int m_fontWeight; wxFontWeight m_fontWeight;
int m_fontFamily; wxFontFamily m_fontFamily;
bool m_fontUnderlined; bool m_fontUnderlined;
wxString m_fontFaceName; wxString m_fontFaceName;

View File

@@ -7,9 +7,8 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** /**
The following values can be passed to wxTextAttr::SetAlignment to determine paragraph alignment. One of the following values can be passed to wxTextAttr::SetAlignment to determine paragraph alignment.
*/ */
enum wxTextAttrAlignment enum wxTextAttrAlignment
{ {
@@ -32,6 +31,7 @@ enum wxTextAttrFlags
{ {
wxTEXT_ATTR_TEXT_COLOUR = 0x00000001, wxTEXT_ATTR_TEXT_COLOUR = 0x00000001,
wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002, wxTEXT_ATTR_BACKGROUND_COLOUR = 0x00000002,
wxTEXT_ATTR_FONT_FACE = 0x00000004, wxTEXT_ATTR_FONT_FACE = 0x00000004,
wxTEXT_ATTR_FONT_SIZE = 0x00000008, wxTEXT_ATTR_FONT_SIZE = 0x00000008,
wxTEXT_ATTR_FONT_WEIGHT = 0x00000010, wxTEXT_ATTR_FONT_WEIGHT = 0x00000010,
@@ -39,6 +39,10 @@ enum wxTextAttrFlags
wxTEXT_ATTR_FONT_UNDERLINE = 0x00000040, wxTEXT_ATTR_FONT_UNDERLINE = 0x00000040,
wxTEXT_ATTR_FONT_ENCODING = 0x02000000, wxTEXT_ATTR_FONT_ENCODING = 0x02000000,
wxTEXT_ATTR_FONT_FAMILY = 0x04000000, wxTEXT_ATTR_FONT_FAMILY = 0x04000000,
/**
Defined as the combination of all @c wxTEXT_ATTR_FONT_* values above.
*/
wxTEXT_ATTR_FONT = \ wxTEXT_ATTR_FONT = \
( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \ ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \
wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ), wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ENCODING | wxTEXT_ATTR_FONT_FAMILY ),
@@ -47,41 +51,55 @@ enum wxTextAttrFlags
wxTEXT_ATTR_LEFT_INDENT = 0x00000100, wxTEXT_ATTR_LEFT_INDENT = 0x00000100,
wxTEXT_ATTR_RIGHT_INDENT = 0x00000200, wxTEXT_ATTR_RIGHT_INDENT = 0x00000200,
wxTEXT_ATTR_TABS = 0x00000400, wxTEXT_ATTR_TABS = 0x00000400,
wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800, wxTEXT_ATTR_PARA_SPACING_AFTER = 0x00000800,
wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000, wxTEXT_ATTR_PARA_SPACING_BEFORE = 0x00001000,
wxTEXT_ATTR_LINE_SPACING = 0x00002000, wxTEXT_ATTR_LINE_SPACING = 0x00002000,
wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000, wxTEXT_ATTR_CHARACTER_STYLE_NAME = 0x00004000,
wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000, wxTEXT_ATTR_PARAGRAPH_STYLE_NAME = 0x00008000,
wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000, wxTEXT_ATTR_LIST_STYLE_NAME = 0x00010000,
wxTEXT_ATTR_BULLET_STYLE = 0x00020000, wxTEXT_ATTR_BULLET_STYLE = 0x00020000,
wxTEXT_ATTR_BULLET_NUMBER = 0x00040000, wxTEXT_ATTR_BULLET_NUMBER = 0x00040000,
wxTEXT_ATTR_BULLET_TEXT = 0x00080000, wxTEXT_ATTR_BULLET_TEXT = 0x00080000,
wxTEXT_ATTR_BULLET_NAME = 0x00100000, wxTEXT_ATTR_BULLET_NAME = 0x00100000,
/**
Defined as the combination of all @c wxTEXT_ATTR_BULLET_* values above.
*/
wxTEXT_ATTR_BULLET = \
( wxTEXT_ATTR_BULLET_STYLE | wxTEXT_ATTR_BULLET_NUMBER | wxTEXT_ATTR_BULLET_TEXT | \
wxTEXT_ATTR_BULLET_NAME ),
wxTEXT_ATTR_URL = 0x00200000, wxTEXT_ATTR_URL = 0x00200000,
wxTEXT_ATTR_PAGE_BREAK = 0x00400000, wxTEXT_ATTR_PAGE_BREAK = 0x00400000,
wxTEXT_ATTR_EFFECTS = 0x00800000, wxTEXT_ATTR_EFFECTS = 0x00800000,
wxTEXT_ATTR_OUTLINE_LEVEL = 0x01000000, wxTEXT_ATTR_OUTLINE_LEVEL = 0x01000000,
/** /**
Character and paragraph combined styles Combines the styles @c wxTEXT_ATTR_FONT, @c wxTEXT_ATTR_EFFECTS, @c wxTEXT_ATTR_BACKGROUND_COLOUR,
@c wxTEXT_ATTR_TEXT_COLOUR, @c wxTEXT_ATTR_CHARACTER_STYLE_NAME, @c wxTEXT_ATTR_URL.
*/ */
wxTEXT_ATTR_CHARACTER = \ wxTEXT_ATTR_CHARACTER = \
(wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS| \ (wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS| \
wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL), wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL),
/**
Combines all the styles regarding text paragraphs.
*/
wxTEXT_ATTR_PARAGRAPH = \ wxTEXT_ATTR_PARAGRAPH = \
(wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\ (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\
wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\ wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\
wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|\ wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL),
wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL),
/**
Combines all previous values.
*/
wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH) wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH)
}; };
/** /**
Styles for wxTextAttr::SetBulletStyle Styles for wxTextAttr::SetBulletStyle. They can be combined together as a bitlist.
*/ */
enum wxTextAttrBulletStyle enum wxTextAttrBulletStyle
{ {
@@ -107,7 +125,7 @@ enum wxTextAttrBulletStyle
}; };
/** /**
Styles for wxTextAttr::SetTextEffects(). Styles for wxTextAttr::SetTextEffects(). They can be combined together as a bitlist.
Of these, only wxTEXT_ATTR_EFFECT_CAPITALS and wxTEXT_ATTR_EFFECT_STRIKETHROUGH are implemented. Of these, only wxTEXT_ATTR_EFFECT_CAPITALS and wxTEXT_ATTR_EFFECT_STRIKETHROUGH are implemented.
*/ */
@@ -127,7 +145,7 @@ enum wxTextAttrEffects
}; };
/** /**
Line spacing values; see wxTextAttr::SetLineSpacing(). Convenience line spacing values; see wxTextAttr::SetLineSpacing().
*/ */
enum wxTextAttrLineSpacing enum wxTextAttrLineSpacing
{ {
@@ -207,6 +225,27 @@ public:
*/ */
wxFont CreateFont() const; wxFont CreateFont() const;
/**
Copies all defined/valid properties from overlay to current object.
*/
void Merge(const wxTextAttr& overlay);
/**
Creates a new @c wxTextAttr which is a merge of @a base and @a overlay.
Properties defined in @a overlay take precedence over those in @a base.
Properties undefined/invalid in both are undefined in the result.
*/
static wxTextAttr Merge(const wxTextAttr& base,
const wxTextAttr& overlay);
/**
@name GetXXX functions
*/
//@{
/** /**
Returns the alignment flags. Returns the alignment flags.
See ::wxTextAttrAlignment for a list of available styles. See ::wxTextAttrAlignment for a list of available styles.
@@ -299,7 +338,7 @@ public:
/** /**
Returns the font family. Returns the font family.
*/ */
int GetFontFamily() const; wxFontFamily GetFontFamily() const;
/** /**
Returns the font size in points. Returns the font size in points.
@@ -309,7 +348,7 @@ public:
/** /**
Returns the font style. Returns the font style.
*/ */
int GetFontStyle() const; wxFontStyle GetFontStyle() const;
/** /**
Returns @true if the font is underlined. Returns @true if the font is underlined.
@@ -319,7 +358,7 @@ public:
/** /**
Returns the font weight. Returns the font weight.
*/ */
int GetFontWeight() const; wxFontWeight GetFontWeight() const;
/** /**
Returns the left indent in tenths of a millimetre. Returns the left indent in tenths of a millimetre.
@@ -400,6 +439,16 @@ public:
*/ */
const wxString& GetURL() const; const wxString& GetURL() const;
//@}
/**
@name HasXXX and IsXXX functions
*/
//@{
/** /**
Returns @true if the attribute object specifies alignment. Returns @true if the attribute object specifies alignment.
*/ */
@@ -568,19 +617,14 @@ public:
*/ */
bool IsParagraphStyle() const; bool IsParagraphStyle() const;
/** //@}
Copies all defined/valid properties from overlay to current object.
*/
void Merge(const wxTextAttr& overlay);
/** /**
Creates a new @c wxTextAttr which is a merge of @a base and @a overlay. @name SetXXX functions
Properties defined in @a overlay take precedence over those in @a base.
Properties undefined/invalid in both are undefined in the result.
*/ */
static wxTextAttr Merge(const wxTextAttr& base,
const wxTextAttr& overlay); //@{
/** /**
Sets the paragraph alignment. See ::wxTextAttrAlignment enumeration values. Sets the paragraph alignment. See ::wxTextAttrAlignment enumeration values.
@@ -659,7 +703,7 @@ public:
/** /**
Sets the font family. Sets the font family.
*/ */
void SetFontFamily(int family); void SetFontFamily(wxFontFamily family);
/** /**
Sets the font size in points. Sets the font size in points.
@@ -669,7 +713,7 @@ public:
/** /**
Sets the font style (normal, italic or slanted). Sets the font style (normal, italic or slanted).
*/ */
void SetFontStyle(int fontStyle); void SetFontStyle(wxFontStyle fontStyle);
/** /**
Sets the font underlining. Sets the font underlining.
@@ -679,7 +723,7 @@ public:
/** /**
Sets the font weight. Sets the font weight.
*/ */
void SetFontWeight(int fontWeight); void SetFontWeight(wxFontWeight fontWeight);
/** /**
Sets the left indent and left subindent in tenths of a millimetre. Sets the left indent and left subindent in tenths of a millimetre.
@@ -788,6 +832,9 @@ public:
*/ */
void SetURL(const wxString& url); void SetURL(const wxString& url);
//@}
/** /**
Assignment from a wxTextAttr object. Assignment from a wxTextAttr object.
*/ */

View File

@@ -85,8 +85,8 @@ void wxTextAttr::Init()
m_rightIndent = 0; m_rightIndent = 0;
m_fontSize = 12; m_fontSize = 12;
m_fontStyle = wxNORMAL; m_fontStyle = wxFONTSTYLE_NORMAL;
m_fontWeight = wxNORMAL; m_fontWeight = wxFONTWEIGHT_NORMAL;
m_fontUnderlined = false; m_fontUnderlined = false;
m_fontEncoding = wxFONTENCODING_DEFAULT; m_fontEncoding = wxFONTENCODING_DEFAULT;
m_fontFamily = wxFONTFAMILY_DEFAULT; m_fontFamily = wxFONTFAMILY_DEFAULT;

View File

@@ -5686,7 +5686,7 @@ void wxRichTextBuffer::ClearStyleStack()
bool wxRichTextBuffer::BeginBold() bool wxRichTextBuffer::BeginBold()
{ {
wxTextAttr attr; wxTextAttr attr;
attr.SetFontWeight(wxBOLD); attr.SetFontWeight(wxFONTWEIGHT_BOLD);
return BeginStyle(attr); return BeginStyle(attr);
} }
@@ -5695,7 +5695,7 @@ bool wxRichTextBuffer::BeginBold()
bool wxRichTextBuffer::BeginItalic() bool wxRichTextBuffer::BeginItalic()
{ {
wxTextAttr attr; wxTextAttr attr;
attr.SetFontStyle(wxITALIC); attr.SetFontStyle(wxFONTSTYLE_ITALIC);
return BeginStyle(attr); return BeginStyle(attr);
} }

View File

@@ -2997,7 +2997,7 @@ bool wxRichTextCtrl::IsSelectionBold()
wxTextAttr attr; wxTextAttr attr;
wxRichTextRange range = GetSelectionRange(); wxRichTextRange range = GetSelectionRange();
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
attr.SetFontWeight(wxBOLD); attr.SetFontWeight(wxFONTWEIGHT_BOLD);
return HasCharacterAttributes(range, attr); return HasCharacterAttributes(range, attr);
} }
@@ -3013,7 +3013,7 @@ bool wxRichTextCtrl::IsSelectionBold()
{ {
if (IsDefaultStyleShowing()) if (IsDefaultStyleShowing())
wxRichTextApplyStyle(attr, GetDefaultStyleEx()); wxRichTextApplyStyle(attr, GetDefaultStyleEx());
return attr.GetFontWeight() == wxBOLD; return attr.GetFontWeight() == wxFONTWEIGHT_BOLD;
} }
} }
return false; return false;
@@ -3027,7 +3027,7 @@ bool wxRichTextCtrl::IsSelectionItalics()
wxRichTextRange range = GetSelectionRange(); wxRichTextRange range = GetSelectionRange();
wxTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC); attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC);
attr.SetFontStyle(wxITALIC); attr.SetFontStyle(wxFONTSTYLE_ITALIC);
return HasCharacterAttributes(range, attr); return HasCharacterAttributes(range, attr);
} }
@@ -3043,7 +3043,7 @@ bool wxRichTextCtrl::IsSelectionItalics()
{ {
if (IsDefaultStyleShowing()) if (IsDefaultStyleShowing())
wxRichTextApplyStyle(attr, GetDefaultStyleEx()); wxRichTextApplyStyle(attr, GetDefaultStyleEx());
return attr.GetFontStyle() == wxITALIC; return attr.GetFontStyle() == wxFONTSTYLE_ITALIC;
} }
} }
return false; return false;
@@ -3084,7 +3084,7 @@ bool wxRichTextCtrl::ApplyBoldToSelection()
{ {
wxTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
attr.SetFontWeight(IsSelectionBold() ? wxNORMAL : wxBOLD); attr.SetFontWeight(IsSelectionBold() ? wxFONTWEIGHT_NORMAL : wxFONTWEIGHT_BOLD);
if (HasSelection()) if (HasSelection())
return SetStyleEx(GetSelectionRange(), attr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY); return SetStyleEx(GetSelectionRange(), attr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY);
@@ -3102,7 +3102,7 @@ bool wxRichTextCtrl::ApplyItalicToSelection()
{ {
wxTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC); attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC);
attr.SetFontStyle(IsSelectionItalics() ? wxNORMAL : wxITALIC); attr.SetFontStyle(IsSelectionItalics() ? wxFONTSTYLE_NORMAL : wxFONTSTYLE_ITALIC);
if (HasSelection()) if (HasSelection())
return SetStyleEx(GetSelectionRange(), attr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY); return SetStyleEx(GetSelectionRange(), attr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY);

View File

@@ -314,11 +314,11 @@ bool wxRichTextFontPage::TransferDataFromWindow()
if (m_styleCtrl->GetSelection() != wxNOT_FOUND) if (m_styleCtrl->GetSelection() != wxNOT_FOUND)
{ {
int style; wxFontStyle style;
if (m_styleCtrl->GetStringSelection() == _("Italic")) if (m_styleCtrl->GetStringSelection() == _("Italic"))
style = wxITALIC; style = wxFONTSTYLE_ITALIC;
else else
style = wxNORMAL; style = wxFONTSTYLE_NORMAL;
attr->SetFontStyle(style); attr->SetFontStyle(style);
} }
@@ -327,11 +327,11 @@ bool wxRichTextFontPage::TransferDataFromWindow()
if (m_weightCtrl->GetSelection() != wxNOT_FOUND) if (m_weightCtrl->GetSelection() != wxNOT_FOUND)
{ {
int weight; wxFontWeight weight;
if (m_weightCtrl->GetStringSelection() == _("Bold")) if (m_weightCtrl->GetStringSelection() == _("Bold"))
weight = wxBOLD; weight = wxFONTWEIGHT_BOLD;
else else
weight = wxNORMAL; weight = wxFONTWEIGHT_NORMAL;
attr->SetFontWeight(weight); attr->SetFontWeight(weight);
} }

View File

@@ -1131,9 +1131,9 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttr& attr, wxXmlNode* node, bool isPa
{ {
wxString fontFacename; wxString fontFacename;
int fontSize = 12; int fontSize = 12;
int fontFamily = wxFONTFAMILY_DEFAULT; wxFontFamily fontFamily = wxFONTFAMILY_DEFAULT;
int fontWeight = wxNORMAL; wxFontWeight fontWeight = wxFONTWEIGHT_NORMAL;
int fontStyle = wxNORMAL; wxFontStyle fontStyle = wxFONTSTYLE_NORMAL;
bool fontUnderlined = false; bool fontUnderlined = false;
// int fontFlags = 0; // int fontFlags = 0;
@@ -1150,14 +1150,14 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttr& attr, wxXmlNode* node, bool isPa
value = node->GetAttribute(wxT("fontfamily"), wxEmptyString); value = node->GetAttribute(wxT("fontfamily"), wxEmptyString);
if (!value.empty()) if (!value.empty())
{ {
fontFamily = wxAtoi(value); fontFamily = (wxFontFamily)wxAtoi(value);
attr.SetFontFamily(fontFamily); attr.SetFontFamily(fontFamily);
} }
value = node->GetAttribute(wxT("fontstyle"), wxEmptyString); value = node->GetAttribute(wxT("fontstyle"), wxEmptyString);
if (!value.empty()) if (!value.empty())
{ {
fontStyle = wxAtoi(value); fontStyle = (wxFontStyle)wxAtoi(value);
attr.SetFontStyle(fontStyle); attr.SetFontStyle(fontStyle);
} }
@@ -1171,7 +1171,7 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttr& attr, wxXmlNode* node, bool isPa
value = node->GetAttribute(wxT("fontweight"), wxEmptyString); value = node->GetAttribute(wxT("fontweight"), wxEmptyString);
if (!value.empty()) if (!value.empty())
{ {
fontWeight = wxAtoi(value); fontWeight = (wxFontWeight)wxAtoi(value);
attr.SetFontWeight(fontWeight); attr.SetFontWeight(fontWeight);
} }