File: guideuicodeformat.cpp

package info (click to toggle)
gambc 4.2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 54,404 kB
  • ctags: 10,660
  • sloc: ansic: 661,388; lisp: 143,554; sh: 3,531; makefile: 3,320; cpp: 2,143; perl: 1,730; sed: 498; java: 265
file content (125 lines) | stat: -rw-r--r-- 2,447 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/* File: "guideuicodeformat.cpp", Time-stamp: <2005-04-12 14:32:53 feeley> */

/* Copyright (C) 1994-2005 by Marc Feeley, All Rights Reserved. */

/*---------------------------------------------------------------------------*/

#include "guideuicodeformat.h"

/*---------------------------------------------------------------------------*/

GuideUiElementFormat::GuideUiElementFormat (QString title)
  : title (title)
{
}

GuideUiElementFormat::GuideUiElementFormat ()
  : title ("None")
{
}

QString GuideUiElementFormat::getTitle ()
{
  return title;
}

void GuideUiElementFormat::setColor (QColor color)
{
  this->color = color;
}

QColor GuideUiElementFormat::getColor ()
{
  return color;
}

QFont GuideUiElementFormat::getFont (QFont font)
{
  font.setBold(bold);
  font.setItalic(italic);
  font.setUnderline(underline);
  return font;
}

void GuideUiElementFormat::setBold (bool bold)
{
  this->bold = bold;
}

bool GuideUiElementFormat::getBold ()
{
  return bold;
}

void GuideUiElementFormat::setItalic (bool italic)
{
  this->italic = italic;
}

bool GuideUiElementFormat::getItalic ()
{
  return italic;
}

void GuideUiElementFormat::setUnderline (bool underline)
{
  this->underline = underline;
}

bool GuideUiElementFormat::getUnderline ()
{
  return underline;
}

GuideUiCodeFormat::GuideUiCodeFormat ()
{
}

GuideUiCodeFormat::~GuideUiCodeFormat ()
{
  removeAllElements ();
}

void GuideUiCodeFormat::addElement (const QColor color,
                                    const QString title,
                                    bool bold,
                                    bool italic,
                                    bool underline)
{
  GuideUiElementFormat *ef = new GuideUiElementFormat (title);
  ef->setColor (color);
  ef->setBold (bold);
  ef->setItalic (italic);
  ef->setUnderline (underline);
  addElement (ef);
}

void GuideUiCodeFormat::addElement (GuideUiElementFormat *ef)
{
  elementList.append (ef);
}

void GuideUiCodeFormat::removeAllElements ()
{
  for (uint i=0; i<elementList.size (); i++)
    delete elementList[i];
  elementList.clear();
}

int GuideUiCodeFormat::getNbElements ()
{
  return elementList.size ();
}

GuideUiElementFormat* GuideUiCodeFormat::getElement (int no)
{
  if (no >= 0 && no < (int)elementList.size ())
    return elementList[no];
  return 0;
}

/*---------------------------------------------------------------------------*/

/* Local Variables: */
/* mode: C++ */
/* End: */