FX4Splitter.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                       F o u r - W a y   S p l i t t e r                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1999,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FX4Splitter.h,v 1.30 2006/02/20 03:32:12 fox Exp $                       *
00023 ********************************************************************************/
00024 #ifndef FX4SPLITTER_H
00025 #define FX4SPLITTER_H
00026 
00027 #ifndef FXCOMPOSITE_H
00028 #include "FXComposite.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 // Splitter options
00034 enum {
00035   FOURSPLITTER_TRACKING = 0x00008000,   // Track continuously during split
00036   FOURSPLITTER_NORMAL   = 0
00037   };
00038 
00039 
00040 
00055 class FXAPI FX4Splitter : public FXComposite {
00056   FXDECLARE(FX4Splitter)
00057 private:
00058   FXint     splitx;         // Current x split
00059   FXint     splity;         // Current y split
00060   FXint     barsize;        // Size of the splitter bar
00061   FXint     fhor;           // Horizontal split fraction
00062   FXint     fver;           // Vertical split fraction
00063   FXint     offx;
00064   FXint     offy;
00065   FXuchar   mode;
00066 protected:
00067   FX4Splitter();
00068   FXuchar getMode(FXint x,FXint y);
00069   void moveSplit(FXint x,FXint y);
00070   void drawSplit(FXint x,FXint y,FXuint m);
00071   void adjustLayout();
00072 private:
00073   FX4Splitter(const FX4Splitter&);
00074   FX4Splitter &operator=(const FX4Splitter&);
00075 public:
00076   long onLeftBtnPress(FXObject*,FXSelector,void*);
00077   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00078   long onMotion(FXObject*,FXSelector,void*);
00079   long onFocusUp(FXObject*,FXSelector,void*);
00080   long onFocusDown(FXObject*,FXSelector,void*);
00081   long onFocusLeft(FXObject*,FXSelector,void*);
00082   long onFocusRight(FXObject*,FXSelector,void*);
00083   long onCmdExpand(FXObject*,FXSelector,void*);
00084   long onUpdExpand(FXObject*,FXSelector,void*);
00085 public:
00086   enum {
00087     ExpandNone        = 0,                                  
00088     ExpandTopLeft     = 1,                                  
00089     ExpandTopRight    = 2,                                  
00090     ExpandBottomLeft  = 4,                                  
00091     ExpandBottomRight = 8,                                  
00092     ExpandTop         = ExpandTopLeft|ExpandTopRight,       
00093     ExpandBottom      = ExpandBottomLeft|ExpandBottomRight, 
00094     ExpandLeft        = ExpandTopLeft|ExpandBottomLeft,     
00095     ExpandRight       = ExpandTopRight|ExpandBottomRight,   
00096     ExpandAll         = ExpandLeft|ExpandRight              
00097     };
00098 public:
00099   enum {
00100     ID_EXPAND_NONE=FXComposite::ID_LAST+ExpandNone,
00101     ID_EXPAND_TOP=ID_EXPAND_NONE+ExpandTop,
00102     ID_EXPAND_BOTTOM=ID_EXPAND_NONE+ExpandBottom,
00103     ID_EXPAND_LEFT=ID_EXPAND_NONE+ExpandLeft,
00104     ID_EXPAND_RIGHT=ID_EXPAND_NONE+ExpandRight,
00105     ID_EXPAND_TOPLEFT=ID_EXPAND_NONE+ExpandTopLeft,
00106     ID_EXPAND_TOPRIGHT=ID_EXPAND_NONE+ExpandTopRight,
00107     ID_EXPAND_BOTTOMLEFT=ID_EXPAND_NONE+ExpandBottomLeft,
00108     ID_EXPAND_BOTTOMRIGHT=ID_EXPAND_NONE+ExpandBottomRight,
00109     ID_EXPAND_ALL=ID_EXPAND_NONE+ExpandAll,
00110     ID_LAST
00111     };
00112 public:
00113 
00115   FX4Splitter(FXComposite* p,FXuint opts=FOURSPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00116 
00118   FX4Splitter(FXComposite* p,FXObject* tgt,FXSelector sel,FXuint opts=FOURSPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00119 
00121   FXWindow *getTopLeft() const;
00122 
00124   FXWindow *getTopRight() const;
00125 
00127   FXWindow *getBottomLeft() const;
00128 
00130   FXWindow *getBottomRight() const;
00131 
00133   FXint getHSplit() const { return fhor; }
00134 
00136   FXint getVSplit() const { return fver; }
00137 
00139   void setHSplit(FXint s);
00140 
00142   void setVSplit(FXint s);
00143 
00145   virtual void layout();
00146 
00148   virtual FXint getDefaultWidth();
00149 
00151   virtual FXint getDefaultHeight();
00152 
00154   FXuint getSplitterStyle() const;
00155 
00157   void setSplitterStyle(FXuint style);
00158 
00160   void setBarSize(FXint bs);
00161 
00163   FXint getBarSize() const { return barsize; }
00164 
00166   void setExpanded(FXuint set=FX4Splitter::ExpandAll);
00167 
00169   FXuint getExpanded() const;
00170 
00172   virtual void save(FXStream& store) const;
00173 
00175   virtual void load(FXStream& store);
00176   };
00177 
00178 }
00179 
00180 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:19 2009 for TnFOX by doxygen v1.4.7