檢視原始碼 wxTextAttr (wx v2.4.3)
wxTextAttr
代表 wxTextCtrl
或 wxRichTextCtrl
(在 wx 中未實作)中某範圍文字的字元和段落屬性或樣式。
在設定 wxTextAttr
物件時,請將位元清單遮罩傳遞給 setFlags/2
,以指示應變更哪些樣式元素。為了方便起見,當您呼叫諸如 SetFont 的設定器時,相關的位元將會被設定。
請參閱:wxTextCtrl
wxWidgets 文件:wxTextAttr
摘要
函式
銷毀物件
傳回對齊標誌。
傳回背景顏色。
傳回指示哪些屬性適用的標誌。
建立並傳回 wxTextAttr
物件中字型屬性指定的字型。
傳回字型編碼。
傳回字型名稱。
傳回字型大小(以點為單位)。
傳回字型樣式。
如果字型有底線,則傳回 true。
傳回字型粗細。
傳回左邊縮排(以十分之一毫米為單位)。
傳回左邊次縮排(以十分之一毫米為單位)。
傳回右邊縮排(以十分之一毫米為單位)。
傳回跳格停駐點的陣列,每個停駐點都以十分之一毫米為單位表示。
傳回文字前景顏色。
如果屬性物件指定了背景顏色,則傳回 true。
如果屬性物件指定了任何字型屬性,則傳回 true。
如果屬性物件指定了文字前景顏色,則傳回 true。
如果我們設定了任何屬性,則傳回 false,否則傳回 true。
建構子。
設定段落對齊方式。
設定決定要指定哪些樣式的標誌。
設定指定字型的屬性。
設定字型編碼。
設定字型名稱。
設定字型系列。
設定字型大小(以像素為單位)。
設定字型大小(以點為單位)。
設定字型大小(以點為單位)。
設定字型樣式(正常、斜體或傾斜)。
設定字型底線(實線,文字顏色)。
設定字型粗細。
設定左邊縮排和左邊次縮排(以十分之一毫米為單位)。
設定右邊縮排(以十分之一毫米為單位)。
設定跳格停駐點,以十分之一毫米為單位表示。
設定文字前景顏色。
類型
-type wxTextAttr() :: wx:wx_object().
函式
-spec destroy(This :: wxTextAttr()) -> ok.
銷毀物件
-spec getAlignment(This) -> wx:wx_enum() when This :: wxTextAttr().
傳回對齊標誌。
請參閱 ?wxTextAttrAlignment 以取得可用樣式的列表。
-spec getBackgroundColour(This) -> wx:wx_colour4() when This :: wxTextAttr().
傳回背景顏色。
-spec getFlags(This) -> integer() when This :: wxTextAttr().
傳回指示哪些屬性適用的標誌。
請參閱 setFlags/2
以取得可用標誌的列表。
-spec getFont(This) -> wxFont:wxFont() when This :: wxTextAttr().
建立並傳回 wxTextAttr
物件中字型屬性指定的字型。
請注意,wxTextAttr
不會儲存 wxFont
物件,因此這只是一個暫時的字型。
為了更高的效率,請直接存取字型屬性。
-spec getFontEncoding(This) -> wx:wx_enum() when This :: wxTextAttr().
傳回字型編碼。
-spec getFontFaceName(This) -> unicode:charlist() when This :: wxTextAttr().
傳回字型名稱。
-spec getFontSize(This) -> integer() when This :: wxTextAttr().
傳回字型大小(以點為單位)。
-spec getFontStyle(This) -> wx:wx_enum() when This :: wxTextAttr().
傳回字型樣式。
-spec getFontUnderlined(This) -> boolean() when This :: wxTextAttr().
如果字型有底線,則傳回 true。
-spec getFontWeight(This) -> wx:wx_enum() when This :: wxTextAttr().
傳回字型粗細。
-spec getLeftIndent(This) -> integer() when This :: wxTextAttr().
傳回左邊縮排(以十分之一毫米為單位)。
-spec getLeftSubIndent(This) -> integer() when This :: wxTextAttr().
傳回左邊次縮排(以十分之一毫米為單位)。
-spec getRightIndent(This) -> integer() when This :: wxTextAttr().
傳回右邊縮排(以十分之一毫米為單位)。
-spec getTabs(This) -> [integer()] when This :: wxTextAttr().
傳回跳格停駐點的陣列,每個停駐點都以十分之一毫米為單位表示。
每個停駐點都是從左邊界開始測量的,因此每個值都必須大於前一個值。
-spec getTextColour(This) -> wx:wx_colour4() when This :: wxTextAttr().
傳回文字前景顏色。
-spec hasBackgroundColour(This) -> boolean() when This :: wxTextAttr().
如果屬性物件指定了背景顏色,則傳回 true。
-spec hasFont(This) -> boolean() when This :: wxTextAttr().
如果屬性物件指定了任何字型屬性,則傳回 true。
-spec hasTextColour(This) -> boolean() when This :: wxTextAttr().
如果屬性物件指定了文字前景顏色,則傳回 true。
-spec isDefault(This) -> boolean() when This :: wxTextAttr().
如果我們設定了任何屬性,則傳回 false,否則傳回 true。
-spec new() -> wxTextAttr().
建構子。
-spec new(ColText) -> wxTextAttr() when ColText :: wx:wx_colour(); (Attr) -> wxTextAttr() when Attr :: wxTextAttr().
-spec new(ColText, [Option]) -> wxTextAttr() when ColText :: wx:wx_colour(), Option :: {colBack, wx:wx_colour()} | {font, wxFont:wxFont()} | {alignment, wx:wx_enum()}.
-spec setAlignment(This, Alignment) -> ok when This :: wxTextAttr(), Alignment :: wx:wx_enum().
設定段落對齊方式。
請參閱 ?wxTextAttrAlignment 列舉值。
其中,wxTEXT_ALIGNMENT_JUSTIFIED 未實作。在未來,對齊方式可能僅在列印或預覽時才支援。
-spec setBackgroundColour(This, ColBack) -> ok when This :: wxTextAttr(), ColBack :: wx:wx_colour().
設定背景顏色。
-spec setFlags(This, Flags) -> ok when This :: wxTextAttr(), Flags :: integer().
設定決定要指定哪些樣式的標誌。
?wxTextAttrFlags 值可以在位元清單中傳遞。
-spec setFont(This, Font) -> ok when This :: wxTextAttr(), Font :: wxFont:wxFont().
-spec setFont(This, Font, [Option]) -> ok when This :: wxTextAttr(), Font :: wxFont:wxFont(), Option :: {flags, integer()}.
設定指定字型的屬性。
請注意,wxTextAttr
不會儲存實際的 wxFont
物件。
-spec setFontEncoding(This, Encoding) -> ok when This :: wxTextAttr(), Encoding :: wx:wx_enum().
設定字型編碼。
-spec setFontFaceName(This, FaceName) -> ok when This :: wxTextAttr(), FaceName :: unicode:chardata().
設定字型名稱。
-spec setFontFamily(This, Family) -> ok when This :: wxTextAttr(), Family :: wx:wx_enum().
設定字型系列。
-spec setFontPixelSize(This, PixelSize) -> ok when This :: wxTextAttr(), PixelSize :: integer().
設定字型大小(以像素為單位)。
-spec setFontPointSize(This, PointSize) -> ok when This :: wxTextAttr(), PointSize :: integer().
設定字型大小(以點為單位)。
-spec setFontSize(This, PointSize) -> ok when This :: wxTextAttr(), PointSize :: integer().
設定字型大小(以點為單位)。
-spec setFontStyle(This, FontStyle) -> ok when This :: wxTextAttr(), FontStyle :: wx:wx_enum().
設定字型樣式(正常、斜體或傾斜)。
-spec setFontUnderlined(This, Underlined) -> ok when This :: wxTextAttr(), Underlined :: boolean().
設定字型底線(實線,文字顏色)。
-spec setFontWeight(This, FontWeight) -> ok when This :: wxTextAttr(), FontWeight :: wx:wx_enum().
設定字型粗細。
-spec setLeftIndent(This, Indent) -> ok when This :: wxTextAttr(), Indent :: integer().
-spec setLeftIndent(This, Indent, [Option]) -> ok when This :: wxTextAttr(), Indent :: integer(), Option :: {subIndent, integer()}.
設定左邊縮排和左邊次縮排(以十分之一毫米為單位)。
次縮排是段落左側的偏移量,用於段落中除了第一行之外的所有行。
正值會使第一行顯示在後續行的左側,而負值會使第一行相對於後續行縮排。
wxRichTextBuffer
(在 wx 中未實作)使用縮排來呈現項目符號。左邊縮排是邊界和項目符號之間的距離。段落的內容(包括第一行)從左邊界 + 左邊次縮排開始。因此,項目符號左邊緣和實際段落左側之間的距離是左邊次縮排。
-spec setRightIndent(This, Indent) -> ok when This :: wxTextAttr(), Indent :: integer().
設定右邊縮排(以十分之一毫米為單位)。
-spec setTabs(This, Tabs) -> ok when This :: wxTextAttr(), Tabs :: [integer()].
設定跳格停駐點,以十分之一毫米為單位表示。
每個停駐點都是從左邊界開始測量的,因此每個值都必須大於前一個值。
-spec setTextColour(This, ColText) -> ok when This :: wxTextAttr(), ColText :: wx:wx_colour().
設定文字前景顏色。