libyui
YPartitionSplitter.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: YPartitionSplitter.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 #ifndef YPartitionSplitter_h
26 #define YPartitionSplitter_h
27 
28 #include "YWidget.h"
29 
30 
32 
33 
64 {
65 protected:
91  int usedSize,
92  int totalFreeSize,
93  int newPartSize,
94  int minNewPartSize,
95  int minFreeSize,
96  const std::string & usedLabel,
97  const std::string & freeLabel,
98  const std::string & newPartLabel,
99  const std::string & freeFieldLabel,
100  const std::string & newPartFieldLabel );
101 
102 public:
103 
107  virtual ~YPartitionSplitter();
108 
113  virtual const char * widgetClass() const { return "YPartitionSplitter"; }
114 
120  virtual int value() = 0;
121 
127  virtual void setValue( int newValue ) = 0;
128 
129 
130  // Access methods
131 
132  int usedSize() const;
133  int totalFreeSize() const;
134  int minFreeSize() const;
135  int maxFreeSize() const { return totalFreeSize() - minNewPartSize(); }
136  int freeSize() { return totalFreeSize() - newPartSize(); }
137  int newPartSize() { return value(); }
138  int minNewPartSize() const;
139  int maxNewPartSize() const { return totalFreeSize() - minFreeSize(); }
140 
141  std::string usedLabel() const;
142  std::string freeLabel() const;
143  std::string newPartLabel() const;
144  std::string freeFieldLabel() const;
145  std::string newPartFieldLabel() const;
146 
157  virtual bool setProperty( const std::string & propertyName,
158  const YPropertyValue & val );
159 
166  virtual YPropertyValue getProperty( const std::string & propertyName );
167 
174  virtual const YPropertySet & propertySet();
175 
176 
181  const char * userInputProperty() { return YUIProperty_Value; }
182 
183 
184 private:
185 
187 };
188 
189 
190 #endif // YPartitionSplitter_h
Definition: YProperty.h:104
virtual YPropertyValue getProperty(const std::string &propertyName)
Definition: YPartitionSplitter.cc:195
Definition: YPartitionSplitter.h:63
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Definition: YPartitionSplitter.cc:180
Definition: YProperty.h:197
YWidget * parent() const
Definition: YWidget.cc:271
const char * userInputProperty()
Definition: YPartitionSplitter.h:181
YPartitionSplitter(YWidget *parent, int usedSize, int totalFreeSize, int newPartSize, int minNewPartSize, int minFreeSize, const std::string &usedLabel, const std::string &freeLabel, const std::string &newPartLabel, const std::string &freeFieldLabel, const std::string &newPartFieldLabel)
Definition: YPartitionSplitter.cc:71
virtual const char * widgetClass() const
Definition: YPartitionSplitter.h:113
virtual const YPropertySet & propertySet()
Definition: YPartitionSplitter.cc:162
Definition: YPartitionSplitter.cc:35
virtual void setValue(int newValue)=0
virtual int value()=0
Definition: YWidget.h:54
virtual ~YPartitionSplitter()
Definition: YPartitionSplitter.cc:101