1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
/********************************************************************************
* *
* S p l i t t e r W i n d o w W i d g e t *
* *
*********************************************************************************
* Copyright (C) 1997,2002 by Jeroen van der Zijp. All Rights Reserved. *
*********************************************************************************
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*********************************************************************************
* $Id: FXSplitter.h,v 1.19 2002/01/18 22:42:54 jeroen Exp $ *
********************************************************************************/
#ifndef FXSPLITTER_H
#define FXSPLITTER_H
#ifndef FXCOMPOSITE_H
#include "FXComposite.h"
#endif
/// Splitter options
enum {
SPLITTER_HORIZONTAL = 0, /// Split horizontally
SPLITTER_VERTICAL = 0x00008000, /// Split vertically
SPLITTER_REVERSED = 0x00010000, /// Reverse-anchored
SPLITTER_TRACKING = 0x00020000, /// Track continuous during split
SPLITTER_NORMAL = SPLITTER_HORIZONTAL
};
/**
* Splitter window is used to interactively repartition
* two or more subpanes.
* Space may be subdivided horizontally or vertically.
* When the splitter is itself resized, the right-most (bottom-most)
* child window will be resized unless the splitter window is reversed;
* if the splitter is reversed, the left-most (top-most) child window
* will be resized instead.
* The splitter widget sends a SEL_CHANGED to its target
* during the resizing of the panes; at the end of the resize interaction,
* it sends a SEL_COMMAND to signify that the resize operation is complete.
* Normally, children are resizable from 0 upwards; however, if the child
* in a horizontally oriented splitter has LAYOUT_FILL_X in combination with
* LAYOUT_FIX_WIDTH, it will not be made smaller than its default width,
* except when the child is the last visible widget (or first when the option
* SPLITTER_REVERSED has been passed to the splitter).
* In a vertically oriented splitter, children with LAYOUT_FILL_Y and
* LAYOUT_FIX_HEIGHT behave analogously.
* These options only affect interactive resizing.
*/
class FXAPI FXSplitter : public FXComposite {
FXDECLARE(FXSplitter)
private:
FXWindow *window; // Window being resized
FXint split; // Split value
FXint offset; // Mouse offset
FXint barsize; // Size of the splitter bar
protected:
FXSplitter();
virtual void layout();
void adjustHLayout();
void adjustVLayout();
void moveHSplit(FXint amount);
void moveVSplit(FXint amount);
void drawHSplit(FXint pos);
void drawVSplit(FXint pos);
FXWindow* findHSplit(FXint pos);
FXWindow* findVSplit(FXint pos);
private:
FXSplitter(const FXSplitter&);
FXSplitter& operator=(const FXSplitter&);
public:
long onLeftBtnPress(FXObject*,FXSelector,void*);
long onLeftBtnRelease(FXObject*,FXSelector,void*);
long onMotion(FXObject*,FXSelector,void*);
long onFocusNext(FXObject*,FXSelector,void*);
long onFocusPrev(FXObject*,FXSelector,void*);
long onFocusUp(FXObject*,FXSelector,void*);
long onFocusDown(FXObject*,FXSelector,void*);
long onFocusLeft(FXObject*,FXSelector,void*);
long onFocusRight(FXObject*,FXSelector,void*);
public:
/// Construct new splitter widget
FXSplitter(FXComposite* p,FXuint opts=SPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
/// Construct new splitter widget, which will notify target about size changes
FXSplitter(FXComposite* p,FXObject* tgt,FXSelector sel,FXuint opts=SPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
/// Get default width
virtual FXint getDefaultWidth();
/// Get default height
virtual FXint getDefaultHeight();
/// Change splitter style
void setSplitterStyle(FXuint style);
/// Return current splitter style
FXuint getSplitterStyle() const;
/// Change splitter bar size
void setBarSize(FXint bs);
/// Return current bar size
FXint getBarSize() const { return barsize; }
/// Save to stream
virtual void save(FXStream& store) const;
/// Load from stream
virtual void load(FXStream& store);
/// Destroy splitter
virtual ~FXSplitter();
};
#endif
|