Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

/home/jeroen/FOX/fox/fox-1.7.33/include/FX4Splitter.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                       F o u r - W a y   S p l i t t e r                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1999,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FX4SPLITTER_H
00022 #define FX4SPLITTER_H
00023 
00024 #ifndef FXCOMPOSITE_H
00025 #include "FXComposite.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 // Splitter options
00031 enum {
00032   FOURSPLITTER_TRACKING   = 0x00008000, // Track continuously during split
00033   FOURSPLITTER_VERTICAL   = 0x00010000, // Prefer vertial expansion of panels
00034   FOURSPLITTER_HORIZONTAL = 0,          // Prefer horizontal expansion of panels (default)
00035   FOURSPLITTER_NORMAL     = 0
00036   };
00037 
00038 
00039 
00064 class FXAPI FX4Splitter : public FXComposite {
00065   FXDECLARE(FX4Splitter)
00066 private:
00067   FXint     splitx;         // Current x split
00068   FXint     splity;         // Current y split
00069   FXint     barsize;        // Size of the splitter bar
00070   FXint     fhor;           // Horizontal split fraction
00071   FXint     fver;           // Vertical split fraction
00072   FXint     offx;
00073   FXint     offy;
00074   FXuchar   mode;
00075 protected:
00076   FX4Splitter();
00077   FXuchar getMode(FXint x,FXint y);
00078   void moveSplit(FXint x,FXint y);
00079   void drawSplit(FXint x,FXint y,FXuint m);
00080   void adjustLayout();
00081 private:
00082   FX4Splitter(const FX4Splitter&);
00083   FX4Splitter &operator=(const FX4Splitter&);
00084 public:
00085   long onLeftBtnPress(FXObject*,FXSelector,void*);
00086   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00087   long onMotion(FXObject*,FXSelector,void*);
00088   long onFocusUp(FXObject*,FXSelector,void*);
00089   long onFocusDown(FXObject*,FXSelector,void*);
00090   long onFocusLeft(FXObject*,FXSelector,void*);
00091   long onFocusRight(FXObject*,FXSelector,void*);
00092   long onCmdExpand(FXObject*,FXSelector,void*);
00093   long onUpdExpand(FXObject*,FXSelector,void*);
00094 public:
00095   enum {
00096     ExpandNone        = 0,                                  
00097     ExpandTopLeft     = 1,                                  
00098     ExpandTopRight    = 2,                                  
00099     ExpandBottomLeft  = 4,                                  
00100     ExpandBottomRight = 8,                                  
00101     ExpandTop         = ExpandTopLeft|ExpandTopRight,       
00102     ExpandBottom      = ExpandBottomLeft|ExpandBottomRight, 
00103     ExpandLeft        = ExpandTopLeft|ExpandBottomLeft,     
00104     ExpandRight       = ExpandTopRight|ExpandBottomRight,   
00105     ExpandCriss       = ExpandTopRight|ExpandBottomLeft,    
00106     ExpandCross       = ExpandTopLeft|ExpandBottomRight,    
00107     ExpandAll         = ExpandLeft|ExpandRight              
00108     };
00109 public:
00110   enum {
00111     ID_EXPAND_NONE=FXComposite::ID_LAST+ExpandNone,
00112     ID_EXPAND_TOP=ID_EXPAND_NONE+ExpandTop,
00113     ID_EXPAND_BOTTOM=ID_EXPAND_NONE+ExpandBottom,
00114     ID_EXPAND_LEFT=ID_EXPAND_NONE+ExpandLeft,
00115     ID_EXPAND_RIGHT=ID_EXPAND_NONE+ExpandRight,
00116     ID_EXPAND_TOPLEFT=ID_EXPAND_NONE+ExpandTopLeft,
00117     ID_EXPAND_TOPRIGHT=ID_EXPAND_NONE+ExpandTopRight,
00118     ID_EXPAND_BOTTOMLEFT=ID_EXPAND_NONE+ExpandBottomLeft,
00119     ID_EXPAND_BOTTOMRIGHT=ID_EXPAND_NONE+ExpandBottomRight,
00120     ID_EXPAND_ALL=ID_EXPAND_NONE+ExpandAll,
00121     ID_LAST
00122     };
00123 public:
00124 
00126   FX4Splitter(FXComposite* p,FXuint opts=FOURSPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00127 
00129   FX4Splitter(FXComposite* p,FXObject* tgt,FXSelector sel,FXuint opts=FOURSPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00130 
00132   FXWindow *getTopLeft() const;
00133 
00135   FXWindow *getTopRight() const;
00136 
00138   FXWindow *getBottomLeft() const;
00139 
00141   FXWindow *getBottomRight() const;
00142 
00144   FXint getHSplit() const { return fhor; }
00145 
00147   FXint getVSplit() const { return fver; }
00148 
00150   void setHSplit(FXint s);
00151 
00153   void setVSplit(FXint s);
00154 
00156   virtual void layout();
00157 
00159   virtual FXint getDefaultWidth();
00160 
00162   virtual FXint getDefaultHeight();
00163 
00165   FXuint getSplitterStyle() const;
00166 
00168   void setSplitterStyle(FXuint style);
00169 
00171   void setBarSize(FXint bs);
00172 
00174   FXint getBarSize() const { return barsize; }
00175 
00177   void setExpanded(FXuint set=FX4Splitter::ExpandAll);
00178 
00180   FXuint getExpanded() const;
00181 
00183   virtual void save(FXStream& store) const;
00184 
00186   virtual void load(FXStream& store);
00187   };
00188 
00189 }
00190 
00191 #endif

Copyright © 1997-2011 Jeroen van der Zijp