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

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,2004 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.26 2004/02/08 17:17:34 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 00034 /// Splitter options 00035 enum { 00036 SPLITTER_HORIZONTAL = 0, /// Split horizontally 00037 SPLITTER_VERTICAL = 0x00008000, /// Split vertically 00038 SPLITTER_REVERSED = 0x00010000, /// Reverse-anchored 00039 SPLITTER_TRACKING = 0x00020000, /// Track continuous during split 00040 SPLITTER_NORMAL = SPLITTER_HORIZONTAL 00041 }; 00042 00043 00044 00045 /** 00046 * Splitter window is used to interactively repartition 00047 * two or more subpanels. 00048 * Space may be subdivided horizontally or vertically. 00049 * When the splitter is itself resized, the right-most (bottom-most) 00050 * child window will be resized unless the splitter window is reversed; 00051 * if the splitter is reversed, the left-most (top-most) child window 00052 * will be resized instead. 00053 * The splitter widget sends a SEL_CHANGED to its target 00054 * during the resizing of the panels; at the end of the resize interaction, 00055 * it sends a SEL_COMMAND to signify that the resize operation is complete. 00056 * Normally, children are resizable from 0 upwards; however, if the child 00057 * in a horizontally oriented splitter has LAYOUT_FILL_X in combination with 00058 * LAYOUT_FIX_WIDTH, it will not be made smaller than its default width, 00059 * except when the child is the last visible widget (or first when the option 00060 * SPLITTER_REVERSED has been passed to the splitter). 00061 * In a vertically oriented splitter, children with LAYOUT_FILL_Y and 00062 * LAYOUT_FIX_HEIGHT behave analogously. 00063 */ 00064 class FXAPI FXSplitter : public FXComposite { 00065 FXDECLARE(FXSplitter) 00066 private: 00067 FXWindow *window; // Window being resized 00068 FXint split; // Split value 00069 FXint offset; // Mouse offset 00070 FXint barsize; // Size of the splitter bar 00071 protected: 00072 FXSplitter(); 00073 void adjustHLayout(); 00074 void adjustVLayout(); 00075 void moveHSplit(FXint amount); 00076 void moveVSplit(FXint amount); 00077 void drawHSplit(FXint pos); 00078 void drawVSplit(FXint pos); 00079 FXWindow* findHSplit(FXint pos); 00080 FXWindow* findVSplit(FXint pos); 00081 private: 00082 FXSplitter(const FXSplitter&); 00083 FXSplitter& operator=(const FXSplitter&); 00084 public: 00085 long onLeftBtnPress(FXObject*,FXSelector,void*); 00086 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00087 long onMotion(FXObject*,FXSelector,void*); 00088 long onFocusNext(FXObject*,FXSelector,void*); 00089 long onFocusPrev(FXObject*,FXSelector,void*); 00090 long onFocusUp(FXObject*,FXSelector,void*); 00091 long onFocusDown(FXObject*,FXSelector,void*); 00092 long onFocusLeft(FXObject*,FXSelector,void*); 00093 long onFocusRight(FXObject*,FXSelector,void*); 00094 public: 00095 00096 /// Construct new splitter widget 00097 FXSplitter(FXComposite* p,FXuint opts=SPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00098 00099 /// Construct new splitter widget, which will notify target about size changes 00100 FXSplitter(FXComposite* p,FXObject* tgt,FXSelector sel,FXuint opts=SPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00101 00102 /// Get default width 00103 virtual FXint getDefaultWidth(); 00104 00105 /// Get default height 00106 virtual FXint getDefaultHeight(); 00107 00108 /// Perform layout 00109 virtual void layout(); 00110 00111 /// Return size of the panel at index 00112 FXint getSplit(FXint index) const; 00113 00114 /// Change the size of panel at the given index 00115 void setSplit(FXint index,FXint size); 00116 00117 /// Change splitter style 00118 void setSplitterStyle(FXuint style); 00119 00120 /// Return current splitter style 00121 FXuint getSplitterStyle() const; 00122 00123 /// Change splitter bar size 00124 void setBarSize(FXint bs); 00125 00126 /// Return current bar size 00127 FXint getBarSize() const { return barsize; } 00128 00129 /// Save to stream 00130 virtual void save(FXStream& store) const; 00131 00132 /// Load from stream 00133 virtual void load(FXStream& store); 00134 00135 /// Destroy splitter 00136 virtual ~FXSplitter(); 00137 }; 00138 00139 } 00140 00141 #endif

Copyright © 1997-2004 Jeroen van der Zijp