Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
00001 /******************************************************************************** 00002 * * 00003 * F o u r - W a y S p l i t t e r * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1999,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: FX4Splitter.h,v 1.25 2004/02/08 17:17:33 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 00041 /** 00042 * The four-way splitter is a layout manager which manages 00043 * four children like four panes in a window. 00044 * You can use a four-way splitter for example in a CAD program 00045 * where you may want to maintain three orthographic views, and 00046 * one oblique view of a model. 00047 * The four-way splitter allows interactive repartitioning of the 00048 * panes by means of moving the central splitter bars. 00049 * When the four-way splitter is itself resized, each child is 00050 * proportionally resized, maintaining the same split-percentage. 00051 * The four-way splitter widget sends a SEL_CHANGED to its target 00052 * during the resizing of the panes; at the end of the resize interaction, 00053 * it sends a SEL_COMMAND to signify that the resize operation is complete. 00054 */ 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 expanded; // Panes which are expanded 00061 FXint barsize; // Size of the splitter bar 00062 FXint fhor; // Horizontal split fraction 00063 FXint fver; // Vertical split fraction 00064 FXint offx; 00065 FXint offy; 00066 FXuchar mode; 00067 protected: 00068 FX4Splitter(); 00069 FXuchar getMode(FXint x,FXint y); 00070 void moveSplit(FXint x,FXint y); 00071 void drawSplit(FXint x,FXint y); 00072 void adjustLayout(); 00073 private: 00074 FX4Splitter(const FX4Splitter&); 00075 FX4Splitter &operator=(const FX4Splitter&); 00076 public: 00077 long onLeftBtnPress(FXObject*,FXSelector,void*); 00078 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00079 long onMotion(FXObject*,FXSelector,void*); 00080 long onFocusUp(FXObject*,FXSelector,void*); 00081 long onFocusDown(FXObject*,FXSelector,void*); 00082 long onFocusLeft(FXObject*,FXSelector,void*); 00083 long onFocusRight(FXObject*,FXSelector,void*); 00084 long onCmdExpand(FXObject*,FXSelector,void*); 00085 long onUpdExpand(FXObject*,FXSelector,void*); 00086 public: 00087 enum { 00088 ID_EXPAND_ALL=FXComposite::ID_LAST, 00089 ID_EXPAND_TOPLEFT, 00090 ID_EXPAND_TOPRIGHT, 00091 ID_EXPAND_BOTTOMLEFT, 00092 ID_EXPAND_BOTTOMRIGHT, 00093 ID_LAST 00094 }; 00095 public: 00096 00097 /// Create 4-way splitter, initially shown as four unexpanded panes 00098 FX4Splitter(FXComposite* p,FXuint opts=FOURSPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00099 00100 /// Create 4-way splitter, initially shown as four unexpanded panes; notifies target about size changes 00101 FX4Splitter(FXComposite* p,FXObject* tgt,FXSelector sel,FXuint opts=FOURSPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00102 00103 /// Get top left child, if any 00104 FXWindow *getTopLeft() const; 00105 00106 /// Get top right child, if any 00107 FXWindow *getTopRight() const; 00108 00109 /// Get bottom left child, if any 00110 FXWindow *getBottomLeft() const; 00111 00112 /// Get bottom right child, if any 00113 FXWindow *getBottomRight() const; 00114 00115 /// Get horizontal split fraction 00116 FXint getHSplit() const { return fhor; } 00117 00118 /// Get vertical split fraction 00119 FXint getVSplit() const { return fver; } 00120 00121 /// Change horizontal split fraction 00122 void setHSplit(FXint s); 00123 00124 /// Change vertical split fraction 00125 void setVSplit(FXint s); 00126 00127 /// Perform layout 00128 virtual void layout(); 00129 00130 /// Get default width 00131 virtual FXint getDefaultWidth(); 00132 00133 /// Get default height 00134 virtual FXint getDefaultHeight(); 00135 00136 /// Return current splitter style 00137 FXuint getSplitterStyle() const; 00138 00139 /// Change splitter style 00140 void setSplitterStyle(FXuint style); 00141 00142 /// Change splitter bar width 00143 void setBarSize(FXint bs); 00144 00145 /// Get splitter bar width 00146 FXint getBarSize() const { return barsize; } 00147 00148 /// Expand child (ex=0..3), or restore to 4-way split (ex=-1) 00149 void setExpanded(FXint ex); 00150 00151 /// Get expanded child, or -1 if not expanded 00152 FXint getExpanded() const { return expanded; } 00153 00154 /// Save to stream 00155 virtual void save(FXStream& store) const; 00156 00157 /// Load from stream 00158 virtual void load(FXStream& store); 00159 }; 00160 00161 } 00162 00163 #endif
Copyright © 1997-2004 Jeroen van der Zijp |