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

tderandr

  • tderandr
randr.h
1 /*
2  * Copyright (c) 2002,2003 Hamish Rodda <rodda@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef __RANDR_H__
20 #define __RANDR_H__
21 
22 #include <tqobject.h>
23 #include <tqstringlist.h>
24 #include <tqptrlist.h>
25 
26 #include <tdecmodule.h>
27 #include <tdeconfig.h>
28 
29 #define ROTATION_0_DEGREES_INDEX 0
30 #define ROTATION_90_DEGREES_INDEX 1
31 #define ROTATION_180_DEGREES_INDEX 2
32 #define ROTATION_270_DEGREES_INDEX 3
33 
34 class KTimerDialog;
35 class RandRScreenPrivate;
36 
37 class TDERANDR_EXPORT HotPlugRule {
38  public:
39  enum states {
40  AnyState = 0,
41  Connected = 1,
42  Disconnected = 2
43  };
44 
45  public:
46  HotPlugRule();
47  virtual ~HotPlugRule();
48 
49  public:
50  TQStringList outputs;
51  TQValueList< int > states;
52  TQString profileName;
53 };
54 
55 typedef TQValueList< HotPlugRule > HotPlugRulesList;
56 
57 class TDERANDR_EXPORT SingleScreenData {
58  public:
59  SingleScreenData();
60  virtual ~SingleScreenData();
61 
62  public:
63  TQString screenUniqueName;
64  TQString screenFriendlyName;
65  bool generic_screen_detected;
66  bool screen_connected;
67 
68  TQStringList resolutions;
69  TQStringList refresh_rates;
70  TQStringList color_depths;
71  TQStringList rotations;
72 
73  int current_resolution_index;
74  int current_refresh_rate_index;
75  int current_color_depth_index;
76 
77  float gamma_red;
78  float gamma_green;
79  float gamma_blue;
80 
81  int current_rotation_index;
82  int current_orientation_mask;
83  bool has_x_flip;
84  bool has_y_flip;
85  bool supports_transformations;
86 
87  bool is_primary;
88  bool is_extended;
89  int absolute_x_position;
90  int absolute_y_position;
91  int current_x_pixel_count;
92  int current_y_pixel_count;
93 
94  bool has_dpms;
95  bool enable_dpms;
96  unsigned int dpms_standby_delay;
97  unsigned int dpms_suspend_delay;
98  unsigned int dpms_off_delay;
99 };
100 
101 class RandRScreen : public TQObject
102 {
103  Q_OBJECT
104 
105 public:
106  enum orientations {
107  Rotate0 = 0x1,
108  Rotate90 = 0x2,
109  Rotate180 = 0x4,
110  Rotate270 = 0x8,
111  RotateMask = 15,
112  RotationCount = 4,
113  ReflectX = 0x10,
114  ReflectY = 0x20,
115  ReflectMask = 48,
116  OrientationMask = 63,
117  OrientationCount = 6
118  };
119 
120  RandRScreen(int screenIndex);
121  ~RandRScreen();
122 
123  void loadSettings();
124  void setOriginal();
125 
126  bool applyProposed();
127 
131  bool applyProposedAndConfirm();
132 
133 public slots:
134  bool confirm();
135  bool showTestConfigurationDialog();
136 
137 public:
138  TQString changedMessage() const;
139 
140  bool changedFromOriginal() const;
141  void proposeOriginal();
142 
143  bool proposedChanged() const;
144 
145  static TQString rotationName(int rotation, bool pastTense = false, bool capitalised = true);
146  TQPixmap rotationIcon(int rotation) const;
147  TQString currentRotationDescription() const;
148 
149  int rotationIndexToDegree(int rotation) const;
150  int rotationDegreeToIndex(int degree) const;
151 
155  TQStringList refreshRates(int size) const;
156 
157  TQString refreshRateDirectDescription(int rate) const;
158  TQString refreshRateIndirectDescription(int size, int index) const;
159  TQString refreshRateDescription(int size, int index) const;
160 
161  int currentRefreshRate() const;
162  TQString currentRefreshRateDescription() const;
163 
164  // Refresh rate hz <==> index conversion
165  int refreshRateHzToIndex(int size, int hz) const;
166  int refreshRateIndexToHz(int size, int index) const;
167 
171  int numSizes() const;
172  const TQSize& pixelSize(int index) const;
173  const TQSize& mmSize(int index) const;
174  int pixelCount(int index) const;
175 
182  int sizeIndex(TQSize pixelSize) const;
183 
184  int rotations() const;
185 
189  int currentPixelWidth() const;
190  int currentPixelHeight() const;
191  int currentMMWidth() const;
192  int currentMMHeight() const;
193 
194  int currentRotation() const;
195  int currentSize() const;
196 
200  int proposedSize() const;
201  bool proposeSize(int newSize);
202 
203  int proposedRotation() const;
204  void proposeRotation(int newRotation);
205 
206  int proposedRefreshRate() const;
214  bool proposeRefreshRate(int index);
215 
219  void load(TDEConfig& config);
220  void save(TDEConfig& config) const;
221 
222 private:
223  RandRScreenPrivate* d;
224 
225  int m_screen;
226 
227  TQValueList<TQSize> m_pixelSizes;
228  TQValueList<TQSize> m_mmSizes;
229  int m_rotations;
230 
231  int m_originalRotation;
232  int m_originalSize;
233  int m_originalRefreshRate;
234 
235  int m_currentRotation;
236  int m_currentSize;
237  int m_currentRefreshRate;
238 
239  int m_proposedRotation;
240  int m_proposedSize;
241  int m_proposedRefreshRate;
242 
243  KTimerDialog* m_shownDialog;
244 
245 private slots:
246  void desktopResized();
247  void shownDialogDestroyed();
248 };
249 
250 typedef TQPtrList<RandRScreen> ScreenList;
251 
252 class RandRDisplay
253 {
254 public:
255  RandRDisplay();
256 
257  bool isValid() const;
258  const TQString& errorCode() const;
259  const TQString& version() const;
260 
261  int eventBase() const;
262  int screenChangeNotifyEvent() const;
263  int errorBase() const;
264 
265  int screenIndexOfWidget(TQWidget* widget);
266 
267  int numScreens() const;
268  RandRScreen* screen(int index);
269 
270  void setCurrentScreen(int index);
271  int currentScreenIndex() const;
272  RandRScreen* currentScreen();
273 
274  void refresh();
275 
283  bool loadDisplay(TDEConfig& config, bool loadScreens = true);
284  void saveDisplay(TDEConfig& config, bool applyOnStartup, bool syncTrayApp);
285 
286  static bool applyOnStartup(TDEConfig& config);
287  static bool syncTrayApp(TDEConfig& config);
288 
289  void applyProposed(bool confirm = true);
290 
291  bool showTestConfigurationDialog();
292 
293 private:
294  int m_numScreens;
295  int m_currentScreenIndex;
296  RandRScreen* m_currentScreen;
297  ScreenList m_screens;
298 
299  bool m_valid;
300  QString m_errorCode;
301  QString m_version;
302 
303  int m_eventBase;
304  int m_errorBase;
305 };
306 
307 #endif
TDEConfig
TDEStdAccel::save
const TDEShortcut & save()
KDE::version
unsigned int version()
KTimerDialog
Provides a dialog that is only available for a specified amount of time, and reports the time remaini...
Definition: ktimerdialog.h:45

tderandr

Skip menu "tderandr"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tderandr

Skip menu "tderandr"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tderandr by doxygen 1.8.8
This website is maintained by Timothy Pearson.