FXSplitter.h

Go to the documentation of this file.
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,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: FXSplitter.h,v 1.29 2006/01/22 17:58:09 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXSPLITTER_H
00025 #define FXSPLITTER_H
00026 
00027 #ifndef FXCOMPOSITE_H
00028 #include "FXComposite.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00035 enum {
00036   SPLITTER_HORIZONTAL = 0,                  
00037   SPLITTER_VERTICAL   = 0x00008000,         
00038   SPLITTER_REVERSED   = 0x00010000,         
00039   SPLITTER_TRACKING   = 0x00020000,         
00040   SPLITTER_NORMAL     = SPLITTER_HORIZONTAL
00041   };
00042 
00043 
00044 
00065 class FXAPI FXSplitter : public FXComposite {
00066   FXDECLARE(FXSplitter)
00067 private:
00068   FXWindow *window;         // Window being resized
00069   FXint     split;          // Split value
00070   FXint     offset;         // Mouse offset
00071   FXint     barsize;        // Size of the splitter bar
00072 protected:
00073   FXSplitter();
00074   void adjustHLayout();
00075   void adjustVLayout();
00076   void moveHSplit(FXint amount);
00077   void moveVSplit(FXint amount);
00078   void drawHSplit(FXint pos);
00079   void drawVSplit(FXint pos);
00080   FXWindow* findHSplit(FXint pos);
00081   FXWindow* findVSplit(FXint pos);
00082 private:
00083   FXSplitter(const FXSplitter&);
00084   FXSplitter& operator=(const FXSplitter&);
00085 public:
00086   long onLeftBtnPress(FXObject*,FXSelector,void*);
00087   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00088   long onMotion(FXObject*,FXSelector,void*);
00089   long onFocusNext(FXObject*,FXSelector,void*);
00090   long onFocusPrev(FXObject*,FXSelector,void*);
00091   long onFocusUp(FXObject*,FXSelector,void*);
00092   long onFocusDown(FXObject*,FXSelector,void*);
00093   long onFocusLeft(FXObject*,FXSelector,void*);
00094   long onFocusRight(FXObject*,FXSelector,void*);
00095 public:
00096 
00098   FXSplitter(FXComposite* p,FXuint opts=SPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00099 
00101   FXSplitter(FXComposite* p,FXObject* tgt,FXSelector sel,FXuint opts=SPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00102 
00104   virtual FXint getDefaultWidth();
00105 
00107   virtual FXint getDefaultHeight();
00108 
00110   virtual void layout();
00111 
00113   FXint getSplit(FXint index) const;
00114 
00116   void setSplit(FXint index,FXint size);
00117 
00119   void setSplitterStyle(FXuint style);
00120 
00122   FXuint getSplitterStyle() const;
00123 
00125   void setBarSize(FXint bs);
00126 
00128   FXint getBarSize() const { return barsize; }
00129 
00131   virtual void save(FXStream& store) const;
00132 
00134   virtual void load(FXStream& store);
00135 
00137   virtual ~FXSplitter();
00138   };
00139 
00140 }
00141 
00142 #endif

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