1 /* File: "guideuicodeformat.cpp", Time-stamp: <2005-04-12 14:32:53 feeley> */
2 
3 /* Copyright (C) 1994-2005 by Marc Feeley, All Rights Reserved. */
4 
5 /*---------------------------------------------------------------------------*/
6 
7 #include "guideuicodeformat.h"
8 
9 /*---------------------------------------------------------------------------*/
10 
GuideUiElementFormat(QString title)11 GuideUiElementFormat::GuideUiElementFormat (QString title)
12   : title (title)
13 {
14 }
15 
GuideUiElementFormat()16 GuideUiElementFormat::GuideUiElementFormat ()
17   : title ("None")
18 {
19 }
20 
getTitle()21 QString GuideUiElementFormat::getTitle ()
22 {
23   return title;
24 }
25 
setColor(QColor color)26 void GuideUiElementFormat::setColor (QColor color)
27 {
28   this->color = color;
29 }
30 
getColor()31 QColor GuideUiElementFormat::getColor ()
32 {
33   return color;
34 }
35 
getFont(QFont font)36 QFont GuideUiElementFormat::getFont (QFont font)
37 {
38   font.setBold(bold);
39   font.setItalic(italic);
40   font.setUnderline(underline);
41   return font;
42 }
43 
setBold(bool bold)44 void GuideUiElementFormat::setBold (bool bold)
45 {
46   this->bold = bold;
47 }
48 
getBold()49 bool GuideUiElementFormat::getBold ()
50 {
51   return bold;
52 }
53 
setItalic(bool italic)54 void GuideUiElementFormat::setItalic (bool italic)
55 {
56   this->italic = italic;
57 }
58 
getItalic()59 bool GuideUiElementFormat::getItalic ()
60 {
61   return italic;
62 }
63 
setUnderline(bool underline)64 void GuideUiElementFormat::setUnderline (bool underline)
65 {
66   this->underline = underline;
67 }
68 
getUnderline()69 bool GuideUiElementFormat::getUnderline ()
70 {
71   return underline;
72 }
73 
GuideUiCodeFormat()74 GuideUiCodeFormat::GuideUiCodeFormat ()
75 {
76 }
77 
~GuideUiCodeFormat()78 GuideUiCodeFormat::~GuideUiCodeFormat ()
79 {
80   removeAllElements ();
81 }
82 
addElement(const QColor color,const QString title,bool bold,bool italic,bool underline)83 void GuideUiCodeFormat::addElement (const QColor color,
84                                     const QString title,
85                                     bool bold,
86                                     bool italic,
87                                     bool underline)
88 {
89   GuideUiElementFormat *ef = new GuideUiElementFormat (title);
90   ef->setColor (color);
91   ef->setBold (bold);
92   ef->setItalic (italic);
93   ef->setUnderline (underline);
94   addElement (ef);
95 }
96 
addElement(GuideUiElementFormat * ef)97 void GuideUiCodeFormat::addElement (GuideUiElementFormat *ef)
98 {
99   elementList.append (ef);
100 }
101 
removeAllElements()102 void GuideUiCodeFormat::removeAllElements ()
103 {
104   for (uint i=0; i<elementList.size (); i++)
105     delete elementList[i];
106   elementList.clear();
107 }
108 
getNbElements()109 int GuideUiCodeFormat::getNbElements ()
110 {
111   return elementList.size ();
112 }
113 
getElement(int no)114 GuideUiElementFormat* GuideUiCodeFormat::getElement (int no)
115 {
116   if (no >= 0 && no < (int)elementList.size ())
117     return elementList[no];
118   return 0;
119 }
120 
121 /*---------------------------------------------------------------------------*/
122 
123 /* Local Variables: */
124 /* mode: C++ */
125 /* End: */
126