libyui-qt  2.46.1
 All Classes Functions Variables
YQPartitionSplitter.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YQPartitionSplitter.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 
26 #ifndef YQPartitionSplitter_h
27 #define YQPartitionSplitter_h
28 
29 #include "qwidget.h"
30 #include <yui/YPartitionSplitter.h>
31 
32 class YLayoutBox;
33 class YQBarGraph;
34 class YQIntField;
35 class YQSlider;
36 
37 
38 class YQPartitionSplitter : public QWidget, public YPartitionSplitter
39 {
40  Q_OBJECT
41 
42 public:
43 
44  /**
45  * Constructor.
46  **/
47  YQPartitionSplitter( YWidget * parent,
48  int usedSize,
49  int freeSize,
50  int newPartSize,
51  int minNewPartSize,
52  int minFreeSize,
53  const std::string & usedLabel,
54  const std::string & freeLabel,
55  const std::string & newPartLabel,
56  const std::string & freeFieldLabel,
57  const std::string & newPartFieldLabel );
58 
59  /**
60  * Destructor.
61  **/
63 
64  /**
65  * Return the value (the size of the new partition).
66  *
67  * Implemented from YPartitionSplitter.
68  **/
69  virtual int value();
70 
71  /**
72  * Set the value (the size of the new partition).
73  *
74  * Implemented from YPartitionSplitter.
75  **/
76  virtual void setValue( int newValue );
77 
78  /**
79  * Set enabled/disabled state.
80  *
81  * Reimplemented from YWidget.
82  **/
83  virtual void setEnabled( bool enabled );
84 
85  /**
86  * Preferred width of the widget.
87  *
88  * Reimplemented from YWidget.
89  **/
90  virtual int preferredWidth();
91 
92  /**
93  * Preferred height of the widget.
94  *
95  * Reimplemented from YWidget.
96  **/
97  virtual int preferredHeight();
98 
99  /**
100  * Set the new size of the widget.
101  *
102  * Reimplemented from YWidget.
103  **/
104  virtual void setSize( int newWidth, int newHeight );
105 
106  /**
107  * Accept the keyboard focus.
108  **/
109  virtual bool setKeyboardFocus();
110 
111 
112 public slots:
113  /**
114  * Slot for setting the free size.
115  **/
116  void setFreeSizeSlot( int newFreeSize );
117 
118  /**
119  * Slot for setting the new size.
120  **/
121  void setNewPartSizeSlot( int newNewSize );
122 
123 
124 protected:
125 
126  enum
127  {
128  usedSegment = 0,
129  freeSegment = 1,
130  newPartSegment = 2
131  };
132 
133 
134  //
135  // Widgets
136  //
137 
138  YLayoutBox * _vbox;
139  YQBarGraph * _barGraph;
140  YLayoutBox * _hbox;
141  YQSlider * _freeSizeSlider;
142  YQIntField * _newPartField;
143 
144 };
145 
146 
147 #endif // YQPartitionSplitter_h