• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • superkaramba
 

superkaramba

  • superkaramba
  • src
textfield.cpp
1/***************************************************************************
2 * Copyright (C) 2003 by Ralph M. Churchill *
3 * mrchucho@yahoo.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
10
11#include "textfield.h"
12#include <tqfontmetrics.h>
13#include <kdebug.h>
14
15TextField::TextField( )
16{
17 setFontSize(12);
18 setColor(TQColor(192, 192, 192));
19 setBGColor(TQColor(0, 0, 0));
20 setFont("Helvetica");
21 setAlignment(TQt::AlignLeft);
22 setFixedPitch(false);
23 setShadow(0);
24}
25
26TextField::~TextField()
27{
28}
29
30TextField::TextField( const TextField& def )
31{
32 setFontSize( def.getFontSize() );
33
34 setColor(def.getColor());
35 setBGColor(def.getBGColor());
36
37 setFont( def.getFont() );
38 setAlignment( def.getAlignment() );
39 setFixedPitch( def.getFixedPitch() );
40 setShadow( def.getShadow() );
41}
42
43TextField& TextField::operator=(const TextField& rhs)
44{
45 if( this == &rhs)
46 return *this;
47
48 setFontSize( rhs.getFontSize() );
49
50 setColor(rhs.getColor());
51 setBGColor(rhs.getBGColor());
52
53 setFont( rhs.getFont() );
54 setAlignment( rhs.getAlignment() );
55 setFixedPitch( rhs.getFixedPitch() );
56 setShadow( rhs.getShadow() );
57
58 return *this;
59}
60
61void TextField::setColor(TQColor clr)
62{
63 color = clr;
64}
65
66TQColor TextField::getColor() const
67{
68 return color;
69}
70
71void TextField::setBGColor(TQColor clr)
72{
73 bgColor = clr;
74}
75
76TQColor TextField::getBGColor() const
77{
78 return bgColor;
79}
80
81
82void TextField::setFont(const TQString &f)
83{
84 font.setFamily(f);
85 lineHeight = TQFontMetrics(font).height();
86}
87
88
89TQString TextField::getFont() const
90{
91 return font.family();
92}
93
94void TextField::setFontSize(int size)
95{
96 font.setPointSize(size);
97 lineHeight = TQFontMetrics(font).height();
98}
99
100int TextField::getFontSize() const
101{
102 return font.pointSize();
103}
104
105void TextField::setAlignment( const TQString &align )
106{
107 TQString a = align.upper();
108 if( a == "LEFT" || a.isEmpty() )
109 alignment = TQt::AlignLeft;
110 if( a == "RIGHT" )
111 alignment = TQt::AlignRight;
112 if( a == "CENTER" )
113 alignment = TQt::AlignHCenter;
114}
115
116void TextField::setAlignment( int af )
117{
118 alignment = af;
119}
120
121int TextField::getAlignment() const
122{
123 return alignment;
124}
125
126TQString TextField::getAlignmentAsString() const
127{
128 if( alignment == TQt::AlignHCenter )
129 return "CENTER";
130 else if( alignment == TQt::AlignRight )
131 return "RIGHT";
132 else
133 return "LEFT";
134}
135
136void TextField::setFixedPitch( bool fp)
137{
138 font.setFixedPitch( fp );
139}
140
141bool TextField::getFixedPitch() const
142{
143 return font.fixedPitch();
144}
145
146void TextField::setShadow ( int s )
147{
148 shadow = s;
149}
150
151int TextField::getShadow() const
152{
153 return shadow;
154}
155
156int TextField::getLineHeight() const
157{
158 return lineHeight;
159}
TextField
Ralph M.
Definition: textfield.h:22

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

superkaramba

Skip menu "superkaramba"
  • kcalc
  •   knumber
  • superkaramba
Generated for superkaramba by doxygen 1.9.4
This website is maintained by Timothy Pearson.