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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXSplitter.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                S p l i t t e r   W i n d o w   W i d g e t                    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,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 FXSPLITTER_H
00022 #define FXSPLITTER_H
00023 
00024 #ifndef FXCOMPOSITE_H
00025 #include "FXComposite.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00032 enum {
00033   SPLITTER_HORIZONTAL = 0,                  
00034   SPLITTER_VERTICAL   = 0x00008000,         
00035   SPLITTER_REVERSED   = 0x00010000,         
00036   SPLITTER_TRACKING   = 0x00020000,         
00037   SPLITTER_NORMAL     = SPLITTER_HORIZONTAL
00038   };
00039 
00040 
00041 
00062 class FXAPI FXSplitter : public FXComposite {
00063   FXDECLARE(FXSplitter)
00064 private:
00065   FXWindow *window;         // Window being resized
00066   FXint     split;          // Split value
00067   FXint     offset;         // Mouse offset
00068   FXint     barsize;        // Size of the splitter bar
00069 protected:
00070   FXSplitter();
00071   void adjustHLayout();
00072   void adjustVLayout();
00073   void moveHSplit(FXint amount);
00074   void moveVSplit(FXint amount);
00075   void drawHSplit(FXint pos);
00076   void drawVSplit(FXint pos);
00077   FXWindow* findHSplit(FXint pos);
00078   FXWindow* findVSplit(FXint pos);
00079 private:
00080   FXSplitter(const FXSplitter&);
00081   FXSplitter& operator=(const FXSplitter&);
00082 public:
00083   long onLeftBtnPress(FXObject*,FXSelector,void*);
00084   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00085   long onMotion(FXObject*,FXSelector,void*);
00086   long onFocusNext(FXObject*,FXSelector,void*);
00087   long onFocusPrev(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 public:
00093 
00095   FXSplitter(FXComposite* p,FXuint opts=SPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00096 
00098   FXSplitter(FXComposite* p,FXObject* tgt,FXSelector sel,FXuint opts=SPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00099 
00101   virtual FXint getDefaultWidth();
00102 
00104   virtual FXint getDefaultHeight();
00105 
00107   virtual void layout();
00108 
00110   FXint getSplit(FXint index) const;
00111 
00113   void setSplit(FXint index,FXint size);
00114 
00116   void setSplitterStyle(FXuint style);
00117 
00119   FXuint getSplitterStyle() const;
00120 
00122   void setBarSize(FXint bs);
00123 
00125   FXint getBarSize() const { return barsize; }
00126 
00128   virtual void save(FXStream& store) const;
00129 
00131   virtual void load(FXStream& store);
00132 
00134   virtual ~FXSplitter();
00135   };
00136 
00137 }
00138 
00139 #endif

Copyright © 1997-2011 Jeroen van der Zijp