• 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 
15 TextField::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 
26 TextField::~TextField()
27 {
28 }
29 
30 TextField::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 
43 TextField& 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 
61 void TextField::setColor(TQColor clr)
62 {
63  color = clr;
64 }
65 
66 TQColor TextField::getColor() const
67 {
68  return color;
69 }
70 
71 void TextField::setBGColor(TQColor clr)
72 {
73  bgColor = clr;
74 }
75 
76 TQColor TextField::getBGColor() const
77 {
78  return bgColor;
79 }
80 
81 
82 void TextField::setFont(const TQString &f)
83 {
84  font.setFamily(f);
85  lineHeight = TQFontMetrics(font).height();
86 }
87 
88 
89 TQString TextField::getFont() const
90 {
91  return font.family();
92 }
93 
94 void TextField::setFontSize(int size)
95 {
96  font.setPointSize(size);
97  lineHeight = TQFontMetrics(font).height();
98 }
99 
100 int TextField::getFontSize() const
101 {
102  return font.pointSize();
103 }
104 
105 void 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 
116 void TextField::setAlignment( int af )
117 {
118  alignment = af;
119 }
120 
121 int TextField::getAlignment() const
122 {
123  return alignment;
124 }
125 
126 TQString 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 
136 void TextField::setFixedPitch( bool fp)
137 {
138  font.setFixedPitch( fp );
139 }
140 
141 bool TextField::getFixedPitch() const
142 {
143  return font.fixedPitch();
144 }
145 
146 void TextField::setShadow ( int s )
147 {
148  shadow = s;
149 }
150 
151 int TextField::getShadow() const
152 {
153  return shadow;
154 }
155 
156 int TextField::getLineHeight() const
157 {
158  return lineHeight;
159 }
TextField
Ralph M.
Definition: textfield.h:21

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.8.13
This website is maintained by Timothy Pearson.