libyui-qt  2.43.5
/usr/src/RPM/BUILD/libyui-qt-2.43.5/src/YQPartitionSplitter.h
00001 /*
00002   Copyright (C) 2000-2012 Novell, Inc
00003   This library is free software; you can redistribute it and/or modify
00004   it under the terms of the GNU Lesser General Public License as
00005   published by the Free Software Foundation; either version 2.1 of the
00006   License, or (at your option) version 3.0 of the License. This library
00007   is distributed in the hope that it will be useful, but WITHOUT ANY
00008   WARRANTY; without even the implied warranty of MERCHANTABILITY or
00009   FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00010   License for more details. You should have received a copy of the GNU
00011   Lesser General Public License along with this library; if not, write
00012   to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
00013   Floor, Boston, MA 02110-1301 USA
00014 */
00015 
00016 
00017 /*-/
00018 
00019   File:       YQPartitionSplitter.h
00020 
00021   Author:     Stefan Hundhammer <sh@suse.de>
00022 
00023 /-*/
00024 
00025 
00026 #ifndef YQPartitionSplitter_h
00027 #define YQPartitionSplitter_h
00028 
00029 #include "qwidget.h"
00030 #include <yui/YPartitionSplitter.h>
00031 
00032 class YLayoutBox;
00033 class YQBarGraph;
00034 class YQIntField;
00035 class YQSlider;
00036 
00037 
00038 class YQPartitionSplitter : public QWidget, public YPartitionSplitter
00039 {
00040     Q_OBJECT
00041 
00042 public:
00043 
00044     /**
00045      * Constructor.
00046      **/
00047     YQPartitionSplitter( YWidget *      parent,
00048                          int            usedSize,
00049                          int            freeSize,
00050                          int            newPartSize,
00051                          int            minNewPartSize,
00052                          int            minFreeSize,
00053                          const std::string &    usedLabel,
00054                          const std::string &    freeLabel,
00055                          const std::string &    newPartLabel,
00056                          const std::string &    freeFieldLabel,
00057                          const std::string &    newPartFieldLabel );
00058 
00059     /**
00060      * Destructor.
00061      **/
00062     ~YQPartitionSplitter();
00063 
00064     /**
00065      * Return the value (the size of the new partition).
00066      *
00067      * Implemented from YPartitionSplitter.
00068      **/
00069     virtual int value();
00070 
00071     /**
00072      * Set the value (the size of the new partition).
00073      *
00074      * Implemented from YPartitionSplitter.
00075      **/
00076     virtual void setValue( int newValue );
00077 
00078     /**
00079      * Set enabled/disabled state.
00080      *
00081      * Reimplemented from YWidget.
00082      **/
00083     virtual void setEnabled( bool enabled );
00084 
00085     /**
00086      * Preferred width of the widget.
00087      *
00088      * Reimplemented from YWidget.
00089      **/
00090     virtual int preferredWidth();
00091 
00092     /**
00093      * Preferred height of the widget.
00094      *
00095      * Reimplemented from YWidget.
00096      **/
00097     virtual int preferredHeight();
00098 
00099     /**
00100      * Set the new size of the widget.
00101      *
00102      * Reimplemented from YWidget.
00103      **/
00104     virtual void setSize( int newWidth, int newHeight );
00105 
00106     /**
00107      * Accept the keyboard focus.
00108      **/
00109     virtual bool setKeyboardFocus();
00110 
00111 
00112 public slots:
00113     /**
00114      * Slot for setting the free size.
00115      **/
00116     void setFreeSizeSlot( int newFreeSize );
00117 
00118     /**
00119      * Slot for setting the new size.
00120      **/
00121     void setNewPartSizeSlot(  int newNewSize );
00122 
00123 
00124 protected:
00125 
00126     enum
00127     {
00128         usedSegment    = 0,
00129         freeSegment    = 1,
00130         newPartSegment = 2
00131     };
00132 
00133 
00134     //
00135     // Widgets
00136     //
00137 
00138     YLayoutBox *        _vbox;
00139     YQBarGraph *            _barGraph;
00140     YLayoutBox *            _hbox;
00141     YQSlider   *                _freeSizeSlider;
00142     YQIntField  *               _newPartField;
00143 
00144 };
00145 
00146 
00147 #endif // YQPartitionSplitter_h
 All Classes Functions Variables