]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/YQPartitionSplitter.h
picking up branches/tmp/sh/qt4-port/, merging it with trunk
[duncan/yast2-qt4.git] / src / YQPartitionSplitter.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQPartitionSplitter.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQPartitionSplitter_h
21 #define YQPartitionSplitter_h
22
23 #include "qwidget.h"
24 #include "YPartitionSplitter.h"
25
26 class YLayoutBox;
27 class YQBarGraph;
28 class YQIntField;
29 class YQSlider;
30
31
32 class YQPartitionSplitter : public QWidget, public YPartitionSplitter
33 {
34     Q_OBJECT
35
36 public:
37
38     /**
39      * Constructor.
40      **/
41     YQPartitionSplitter( YWidget *      parent,
42                          int            usedSize,
43                          int            freeSize,
44                          int            newPartSize,
45                          int            minNewPartSize,
46                          int            minFreeSize,
47                          const string & usedLabel,
48                          const string & freeLabel,
49                          const string & newPartLabel,
50                          const string & freeFieldLabel,
51                          const string & newPartFieldLabel );
52
53     /**
54      * Destructor.
55      **/
56     ~YQPartitionSplitter();
57
58     /**
59      * Return the value (the size of the new partition).
60      *
61      * Implemented from YPartitionSplitter.
62      **/
63     virtual int value();
64     
65     /**
66      * Set the value (the size of the new partition).
67      *
68      * Implemented from YPartitionSplitter.
69      **/
70     virtual void setValue( int newValue );
71     
72     /**
73      * Set enabled/disabled state.
74      *
75      * Reimplemented from YWidget.
76      **/
77     virtual void setEnabled( bool enabled );
78     
79     /**
80      * Preferred width of the widget.
81      *
82      * Reimplemented from YWidget.
83      **/
84     virtual int preferredWidth();
85
86     /**
87      * Preferred height of the widget.
88      *
89      * Reimplemented from YWidget.
90      **/
91     virtual int preferredHeight();
92
93     /**
94      * Set the new size of the widget.
95      *
96      * Reimplemented from YWidget.
97      **/
98     virtual void setSize( int newWidth, int newHeight );
99
100     /**
101      * Accept the keyboard focus.
102      **/
103     virtual bool setKeyboardFocus();
104
105
106 public slots:
107     /**
108      * Slot for setting the free size.
109      **/
110     void setFreeSizeSlot( int newFreeSize );
111
112     /**
113      * Slot for setting the new size.
114      **/
115     void setNewPartSizeSlot(  int newNewSize );
116
117
118 protected:
119
120     enum
121     {
122         usedSegment    = 0,
123         freeSegment    = 1,
124         newPartSegment = 2
125     };
126
127     
128     //
129     // Widgets
130     //
131
132     YLayoutBox *        _vbox;
133     YQBarGraph *            _barGraph;
134     YLayoutBox *            _hbox;
135     YQSlider   *                _freeSizeSlider;
136     YQIntField  *               _newPartField;
137
138 };
139
140
141 #endif // YQPartitionSplitter_h