Added a list style editor page to the formatting dialog.
[wxWidgets.git] / include / wx / richtext / richtextstyles.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextstyles.h
3 // Purpose: Style management for wxRichTextCtrl
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2005-09-30
7 // RCS-ID:
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_RICHTEXTSTYLES_H_
13 #define _WX_RICHTEXTSTYLES_H_
14
15 /*!
16 * Includes
17 */
18
19 #include "wx/defs.h"
20
21 #if wxUSE_RICHTEXT
22
23 #include "wx/richtext/richtextbuffer.h"
24
25 #if wxUSE_HTML
26 #include "wx/htmllbox.h"
27 #endif
28
29 #if wxUSE_COMBOCTRL
30 #include "wx/combo.h"
31 #endif
32
33 #include "wx/choice.h"
34
35 /*!
36 * Forward declarations
37 */
38
39 class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl;
40 class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer;
41
42 /*!
43 * wxRichTextStyleDefinition class declaration
44 * A base class for paragraph and character styles.
45 */
46
47 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleDefinition: public wxObject
48 {
49 DECLARE_CLASS(wxRichTextStyleDefinition)
50 public:
51
52 /// Copy constructors
53 wxRichTextStyleDefinition(const wxRichTextStyleDefinition& def)
54 : wxObject()
55 {
56 Init();
57 Copy(def);
58 }
59
60 /// Default constructor
61 wxRichTextStyleDefinition(const wxString& name = wxEmptyString) { Init(); m_name = name; }
62
63 /// Destructor
64 virtual ~wxRichTextStyleDefinition() {}
65
66 /// Initialises members
67 void Init() {}
68
69 /// Copies from def
70 void Copy(const wxRichTextStyleDefinition& def);
71
72 /// Equality test
73 bool Eq(const wxRichTextStyleDefinition& def) const;
74
75 /// Assignment operator
76 void operator =(const wxRichTextStyleDefinition& def) { Copy(def); }
77
78 /// Equality operator
79 bool operator ==(const wxRichTextStyleDefinition& def) const { return Eq(def); }
80
81 /// Override to clone the object
82 virtual wxRichTextStyleDefinition* Clone() const = 0;
83
84 /// Sets and gets the name of the style
85 void SetName(const wxString& name) { m_name = name; }
86 const wxString& GetName() const { return m_name; }
87
88 /// Sets and gets the name of the style that this style is based on
89 void SetBaseStyle(const wxString& name) { m_baseStyle = name; }
90 const wxString& GetBaseStyle() const { return m_baseStyle; }
91
92 /// Sets the style
93 void SetStyle(const wxRichTextAttr& style) { m_style = style; }
94 const wxRichTextAttr& GetStyle() const { return m_style; }
95 wxRichTextAttr& GetStyle() { return m_style; }
96
97 protected:
98 wxString m_name;
99 wxString m_baseStyle;
100 wxRichTextAttr m_style;
101 };
102
103 /*!
104 * wxRichTextCharacterStyleDefinition class declaration
105 */
106
107 class WXDLLIMPEXP_RICHTEXT wxRichTextCharacterStyleDefinition: public wxRichTextStyleDefinition
108 {
109 DECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition)
110 public:
111
112 /// Copy constructor
113 wxRichTextCharacterStyleDefinition(const wxRichTextCharacterStyleDefinition& def): wxRichTextStyleDefinition(def) {}
114
115 /// Default constructor
116 wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString):
117 wxRichTextStyleDefinition(name) {}
118
119 /// Destructor
120 virtual ~wxRichTextCharacterStyleDefinition() {}
121
122 /// Clones the object
123 virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextCharacterStyleDefinition(*this); }
124
125 protected:
126 };
127
128 /*!
129 * wxRichTextParagraphStyleDefinition class declaration
130 */
131
132 class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphStyleDefinition: public wxRichTextStyleDefinition
133 {
134 DECLARE_DYNAMIC_CLASS(wxRichTextParagraphStyleDefinition)
135 public:
136
137 /// Copy constructor
138 wxRichTextParagraphStyleDefinition(const wxRichTextParagraphStyleDefinition& def): wxRichTextStyleDefinition(def) { m_nextStyle = def.m_nextStyle; }
139
140 /// Default constructor
141 wxRichTextParagraphStyleDefinition(const wxString& name = wxEmptyString):
142 wxRichTextStyleDefinition(name) {}
143
144 // Destructor
145 virtual ~wxRichTextParagraphStyleDefinition() {}
146
147 /// Sets and gets the next style
148 void SetNextStyle(const wxString& name) { m_nextStyle = name; }
149 const wxString& GetNextStyle() const { return m_nextStyle; }
150
151 /// Copies from def
152 void Copy(const wxRichTextParagraphStyleDefinition& def);
153
154 /// Assignment operator
155 void operator =(const wxRichTextParagraphStyleDefinition& def) { Copy(def); }
156
157 /// Equality operator
158 bool operator ==(const wxRichTextParagraphStyleDefinition& def) const;
159
160 /// Clones the object
161 virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextParagraphStyleDefinition(*this); }
162
163 protected:
164
165 /// The next style to use when adding a paragraph after this style.
166 wxString m_nextStyle;
167 };
168
169 /*!
170 * wxRichTextListStyleDefinition class declaration
171 */
172
173 class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition: public wxRichTextParagraphStyleDefinition
174 {
175 DECLARE_DYNAMIC_CLASS(wxRichTextListStyleDefinition)
176 public:
177
178 /// Copy constructor
179 wxRichTextListStyleDefinition(const wxRichTextListStyleDefinition& def): wxRichTextParagraphStyleDefinition(def) { Init(); Copy(def); }
180
181 /// Default constructor
182 wxRichTextListStyleDefinition(const wxString& name = wxEmptyString):
183 wxRichTextParagraphStyleDefinition(name) { Init(); }
184
185 /// Destructor
186 virtual ~wxRichTextListStyleDefinition() {}
187
188 /// Copies from def
189 void Copy(const wxRichTextListStyleDefinition& def);
190
191 /// Assignment operator
192 void operator =(const wxRichTextListStyleDefinition& def) { Copy(def); }
193
194 /// Equality operator
195 bool operator ==(const wxRichTextListStyleDefinition& def) const;
196
197 /// Clones the object
198 virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextListStyleDefinition(*this); }
199
200 /// Sets/gets the attributes for the given level
201 void SetLevelAttributes(int i, const wxTextAttrEx& attr);
202 wxTextAttrEx* GetLevelAttributes(int i);
203 const wxTextAttrEx* GetLevelAttributes(int i) const;
204
205 /// Convenience function for setting the major attributes for a list level specification
206 void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString);
207
208 /// Finds the level corresponding to the given indentation
209 int FindLevelForIndent(int indent) const;
210
211 /// Combine the base and list style with a paragraph style, using the given indent (from which
212 /// an appropriate level is found)
213 wxTextAttrEx CombineWithParagraphStyle(int indent, const wxTextAttrEx& paraStyle);
214
215 /// Combine the base and list style, using the given indent (from which
216 /// an appropriate level is found)
217 wxTextAttrEx GetCombinedStyle(int indent);
218
219 /// Combine the base and list style, using the given level from which
220 /// an appropriate level is found)
221 wxTextAttrEx GetCombinedStyleForLevel(int level);
222
223 /// Gets the number of available levels
224 int GetLevelCount() const { return 10; }
225
226 /// Is this a numbered list?
227 bool IsNumbered(int i) const;
228
229 protected:
230
231 /// The styles for each level (up to 10)
232 wxTextAttrEx m_levelStyles[10];
233 };
234
235 /*!
236 * The style sheet
237 */
238
239 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleSheet: public wxObject
240 {
241 DECLARE_CLASS( wxRichTextStyleSheet )
242
243 public:
244 /// Constructors
245 wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet)
246 : wxObject()
247 {
248 Copy(sheet);
249 }
250 wxRichTextStyleSheet() { Init(); }
251 virtual ~wxRichTextStyleSheet();
252
253 /// Initialisation
254 void Init();
255
256 /// Copy
257 void Copy(const wxRichTextStyleSheet& sheet);
258
259 /// Assignment
260 void operator=(const wxRichTextStyleSheet& sheet) { Copy(sheet); }
261
262 /// Equality
263 bool operator==(const wxRichTextStyleSheet& sheet) const;
264
265 /// Add a definition to the character style list
266 bool AddCharacterStyle(wxRichTextCharacterStyleDefinition* def);
267
268 /// Add a definition to the paragraph style list
269 bool AddParagraphStyle(wxRichTextParagraphStyleDefinition* def);
270
271 /// Add a definition to the list style list
272 bool AddListStyle(wxRichTextListStyleDefinition* def);
273
274 /// Remove a character style
275 bool RemoveCharacterStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_characterStyleDefinitions, def, deleteStyle); }
276
277 /// Remove a paragraph style
278 bool RemoveParagraphStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_paragraphStyleDefinitions, def, deleteStyle); }
279
280 /// Remove a list style
281 bool RemoveListStyle(wxRichTextStyleDefinition* def, bool deleteStyle = false) { return RemoveStyle(m_listStyleDefinitions, def, deleteStyle); }
282
283 /// Find a character definition by name
284 wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name, bool recurse = true) const { return (wxRichTextCharacterStyleDefinition*) FindStyle(m_characterStyleDefinitions, name, recurse); }
285
286 /// Find a paragraph definition by name
287 wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name, bool recurse = true) const { return (wxRichTextParagraphStyleDefinition*) FindStyle(m_paragraphStyleDefinitions, name, recurse); }
288
289 /// Find a list definition by name
290 wxRichTextListStyleDefinition* FindListStyle(const wxString& name, bool recurse = true) const { return (wxRichTextListStyleDefinition*) FindStyle(m_listStyleDefinitions, name, recurse); }
291
292 /// Return the number of character styles
293 size_t GetCharacterStyleCount() const { return m_characterStyleDefinitions.GetCount(); }
294
295 /// Return the number of paragraph styles
296 size_t GetParagraphStyleCount() const { return m_paragraphStyleDefinitions.GetCount(); }
297
298 /// Return the number of list styles
299 size_t GetListStyleCount() const { return m_listStyleDefinitions.GetCount(); }
300
301 /// Return the nth character style
302 wxRichTextCharacterStyleDefinition* GetCharacterStyle(size_t n) const { return (wxRichTextCharacterStyleDefinition*) m_characterStyleDefinitions.Item(n)->GetData(); }
303
304 /// Return the nth paragraph style
305 wxRichTextParagraphStyleDefinition* GetParagraphStyle(size_t n) const { return (wxRichTextParagraphStyleDefinition*) m_paragraphStyleDefinitions.Item(n)->GetData(); }
306
307 /// Return the nth list style
308 wxRichTextListStyleDefinition* GetListStyle(size_t n) const { return (wxRichTextListStyleDefinition*) m_listStyleDefinitions.Item(n)->GetData(); }
309
310 /// Delete all styles
311 void DeleteStyles();
312
313 /// Insert into list of style sheets
314 bool InsertSheet(wxRichTextStyleSheet* before);
315
316 /// Append to list of style sheets
317 bool AppendSheet(wxRichTextStyleSheet* after);
318
319 /// Unlink from the list of style sheets
320 void Unlink();
321
322 /// Get/set next sheet
323 wxRichTextStyleSheet* GetNextSheet() const { return m_nextSheet; }
324 void SetNextSheet(wxRichTextStyleSheet* sheet) { m_nextSheet = sheet; }
325
326 /// Get/set previous sheet
327 wxRichTextStyleSheet* GetPreviousSheet() const { return m_previousSheet; }
328 void SetPreviousSheet(wxRichTextStyleSheet* sheet) { m_previousSheet = sheet; }
329
330 /// Implementation
331
332 /// Add a definition to one of the style lists
333 bool AddStyle(wxList& list, wxRichTextStyleDefinition* def);
334
335 /// Remove a style
336 bool RemoveStyle(wxList& list, wxRichTextStyleDefinition* def, bool deleteStyle);
337
338 /// Find a definition by name
339 wxRichTextStyleDefinition* FindStyle(const wxList& list, const wxString& name, bool recurse = true) const;
340
341 protected:
342
343 wxList m_characterStyleDefinitions;
344 wxList m_paragraphStyleDefinitions;
345 wxList m_listStyleDefinitions;
346
347 wxRichTextStyleSheet* m_previousSheet;
348 wxRichTextStyleSheet* m_nextSheet;
349 };
350
351 #if wxUSE_HTML
352 /*!
353 * wxRichTextStyleListBox class declaration
354 * A listbox to display styles.
355 */
356
357 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListBox: public wxHtmlListBox
358 {
359 DECLARE_CLASS(wxRichTextStyleListBox)
360 DECLARE_EVENT_TABLE()
361
362 public:
363 /// Which type of style definition is currently showing?
364 enum wxRichTextStyleType
365 {
366 wxRICHTEXT_STYLE_ALL,
367 wxRICHTEXT_STYLE_PARAGRAPH,
368 wxRICHTEXT_STYLE_CHARACTER,
369 wxRICHTEXT_STYLE_LIST
370 };
371
372 wxRichTextStyleListBox()
373 {
374 Init();
375 }
376 wxRichTextStyleListBox(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
377 const wxSize& size = wxDefaultSize, long style = 0);
378 virtual ~wxRichTextStyleListBox();
379
380 void Init()
381 {
382 m_styleSheet = NULL;
383 m_richTextCtrl = NULL;
384 m_applyOnSelection = false;
385 m_styleType = wxRICHTEXT_STYLE_PARAGRAPH;
386 m_autoSetSelection = true;
387 }
388
389 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
390 const wxSize& size = wxDefaultSize, long style = 0);
391
392 /// Creates a suitable HTML fragment for a definition
393 wxString CreateHTML(wxRichTextStyleDefinition* def) const;
394
395 /// Associates the control with a style manager
396 void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_styleSheet = styleSheet; }
397 wxRichTextStyleSheet* GetStyleSheet() const { return m_styleSheet; }
398
399 /// Associates the control with a wxRichTextCtrl
400 void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; }
401 wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; }
402
403 /// Get style for index
404 wxRichTextStyleDefinition* GetStyle(size_t i) const ;
405
406 /// Get index for style name
407 int GetIndexForStyle(const wxString& name) const ;
408
409 /// Set selection for string, returning the index.
410 int SetStyleSelection(const wxString& name);
411
412 /// Updates the list
413 void UpdateStyles();
414
415 /// Apply the style
416 void ApplyStyle(int i);
417
418 /// Left click
419 void OnLeftDown(wxMouseEvent& event);
420
421 /// Left double-click
422 void OnLeftDoubleClick(wxMouseEvent& event);
423
424 /// Auto-select from style under caret in idle time
425 void OnIdle(wxIdleEvent& event);
426
427 /// Convert units in tends of a millimetre to device units
428 int ConvertTenthsMMToPixels(wxDC& dc, int units) const;
429
430 /// Can we set the selection based on the editor caret position?
431 /// Need to override this if being used in a combobox popup
432 virtual bool CanAutoSetSelection() { return m_autoSetSelection; }
433 virtual void SetAutoSetSelection(bool autoSet) { m_autoSetSelection = autoSet; }
434
435 /// Set whether the style should be applied as soon as the item is selected (the default)
436 void SetApplyOnSelection(bool applyOnSel) { m_applyOnSelection = applyOnSel; }
437 bool GetApplyOnSelection() const { return m_applyOnSelection; }
438
439 /// Set the style type to display
440 void SetStyleType(wxRichTextStyleType styleType) { m_styleType = styleType; UpdateStyles(); }
441 wxRichTextStyleType GetStyleType() const { return m_styleType; }
442
443 /// Helper for listbox and combo control
444 static wxString GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl, wxRichTextStyleType styleType);
445
446 protected:
447 /// Returns the HTML for this item
448 virtual wxString OnGetItem(size_t n) const;
449
450 private:
451
452 wxRichTextStyleSheet* m_styleSheet;
453 wxRichTextCtrl* m_richTextCtrl;
454 bool m_applyOnSelection; // if true, applies style on selection
455 wxRichTextStyleType m_styleType; // style type to display
456 bool m_autoSetSelection;
457 };
458
459 /*!
460 * wxRichTextStyleListCtrl class declaration
461 * This is a container for the list control plus a combobox to switch between
462 * style types.
463 */
464
465 #define wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR 0x1000
466
467 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleListCtrl: public wxControl
468 {
469 DECLARE_CLASS(wxRichTextStyleListCtrl)
470 DECLARE_EVENT_TABLE()
471
472 public:
473
474 /// Constructors
475 wxRichTextStyleListCtrl()
476 {
477 Init();
478 }
479
480 wxRichTextStyleListCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
481 const wxSize& size = wxDefaultSize, long style = 0);
482
483 /// Constructors
484 virtual ~wxRichTextStyleListCtrl();
485
486 /// Member initialisation
487 void Init()
488 {
489 m_styleListBox = NULL;
490 m_styleChoice = NULL;
491 m_dontUpdate = false;
492 }
493
494 /// Creates the windows
495 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
496 const wxSize& size = wxDefaultSize, long style = 0);
497
498 /// Updates the style list box
499 void UpdateStyles();
500
501 /// Associates the control with a style manager
502 void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
503 wxRichTextStyleSheet* GetStyleSheet() const;
504
505 /// Associates the control with a wxRichTextCtrl
506 void SetRichTextCtrl(wxRichTextCtrl* ctrl);
507 wxRichTextCtrl* GetRichTextCtrl() const;
508
509 /// Set/get the style type to display
510 void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
511 wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const;
512
513 /// Get the choice index for style type
514 int StyleTypeToIndex(wxRichTextStyleListBox::wxRichTextStyleType styleType);
515
516 /// Get the style type for choice index
517 wxRichTextStyleListBox::wxRichTextStyleType StyleIndexToType(int i);
518
519 /// Get the listbox
520 wxRichTextStyleListBox* GetStyleListBox() const { return m_styleListBox; }
521
522 /// Get the choice
523 wxChoice* GetStyleChoice() const { return m_styleChoice; }
524
525 /// React to style type choice
526 void OnChooseType(wxCommandEvent& event);
527
528 /// Lay out the controls
529 void OnSize(wxSizeEvent& event);
530
531 private:
532
533 wxRichTextStyleListBox* m_styleListBox;
534 wxChoice* m_styleChoice;
535 bool m_dontUpdate;
536 };
537
538 #if wxUSE_COMBOCTRL
539
540 /*!
541 * Style drop-down for a wxComboCtrl
542 */
543
544 class wxRichTextStyleComboPopup : public wxRichTextStyleListBox, public wxComboPopup
545 {
546 public:
547 virtual void Init()
548 {
549 m_itemHere = -1; // hot item in list
550 m_value = -1;
551 }
552
553 virtual bool Create( wxWindow* parent )
554 {
555 return wxRichTextStyleListBox::Create(parent, wxID_ANY,
556 wxPoint(0,0), wxDefaultSize,
557 wxSIMPLE_BORDER);
558 }
559
560 virtual wxWindow *GetControl() { return this; }
561
562 virtual void SetStringValue( const wxString& s );
563
564 virtual wxString GetStringValue() const;
565
566 /// Can we set the selection based on the editor caret position?
567 // virtual bool CanAutoSetSelection() { return ((m_combo == NULL) || !m_combo->IsPopupShown()); }
568 virtual bool CanAutoSetSelection() { return false; }
569
570 //
571 // Popup event handlers
572 //
573
574 // Mouse hot-tracking
575 void OnMouseMove(wxMouseEvent& event);
576
577 // On mouse left, set the value and close the popup
578 void OnMouseClick(wxMouseEvent& WXUNUSED(event));
579
580 protected:
581
582 int m_itemHere; // hot item in popup
583 int m_value;
584
585 private:
586 DECLARE_EVENT_TABLE()
587 };
588
589 /*!
590 * wxRichTextStyleComboCtrl
591 * A combo for applying styles.
592 */
593
594 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleComboCtrl: public wxComboCtrl
595 {
596 DECLARE_CLASS(wxRichTextStyleComboCtrl)
597 DECLARE_EVENT_TABLE()
598
599 public:
600 wxRichTextStyleComboCtrl()
601 {
602 Init();
603 }
604
605 wxRichTextStyleComboCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
606 const wxSize& size = wxDefaultSize, long style = wxCB_READONLY)
607 {
608 Init();
609 Create(parent, id, pos, size, style);
610 }
611
612 virtual ~wxRichTextStyleComboCtrl() {}
613
614 void Init()
615 {
616 m_stylePopup = NULL;
617 }
618
619 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
620 const wxSize& size = wxDefaultSize, long style = 0);
621
622 /// Updates the list
623 void UpdateStyles() { m_stylePopup->UpdateStyles(); }
624
625 /// Associates the control with a style manager
626 void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { m_stylePopup->SetStyleSheet(styleSheet); }
627 wxRichTextStyleSheet* GetStyleSheet() const { return m_stylePopup->GetStyleSheet(); }
628
629 /// Associates the control with a wxRichTextCtrl
630 void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_stylePopup->SetRichTextCtrl(ctrl); }
631 wxRichTextCtrl* GetRichTextCtrl() const { return m_stylePopup->GetRichTextCtrl(); }
632
633 /// Gets the style popup
634 wxRichTextStyleComboPopup* GetStylePopup() const { return m_stylePopup; }
635
636 /// Auto-select from style under caret in idle time
637 void OnIdle(wxIdleEvent& event);
638
639 protected:
640 wxRichTextStyleComboPopup* m_stylePopup;
641 };
642
643 #endif
644 // wxUSE_COMBOCTRL
645
646 #endif
647 // wxUSE_HTML
648
649 #endif
650 // wxUSE_RICHTEXT
651
652 #endif
653 // _WX_RICHTEXTSTYLES_H_