1 /******************************************************************************** 2 * * 3 * G r o u p B o x W i n d o w W i d g e t * 4 * * 5 ********************************************************************************* 6 * Copyright (C) 1997,2006 by Jeroen van der Zijp. All Rights Reserved. * 7 ********************************************************************************* 8 * This library is free software; you can redistribute it and/or * 9 * modify it under the terms of the GNU Lesser General Public * 10 * License as published by the Free Software Foundation; either * 11 * version 2.1 of the License, or (at your option) any later version. * 12 * * 13 * This library is distributed in the hope that it will be useful, * 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 16 * Lesser General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU Lesser General Public * 19 * License along with this library; if not, write to the Free Software * 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 21 ********************************************************************************* 22 * $Id: FXGroupBox.h 3297 2015-12-14 20:30:04Z arthurcnorman $ * 23 ********************************************************************************/ 24 #ifndef FXGROUPBOX_H 25 #define FXGROUPBOX_H 26 27 #ifndef FXPACKER_H 28 #include "FXPacker.h" 29 #endif 30 31 namespace FX { 32 33 34 // Group box options 35 enum { 36 GROUPBOX_TITLE_LEFT = 0, /// Title is left-justified 37 GROUPBOX_TITLE_CENTER = 0x00020000, /// Title is centered 38 GROUPBOX_TITLE_RIGHT = 0x00040000, /// Title is right-justified 39 GROUPBOX_NORMAL = GROUPBOX_TITLE_LEFT 40 }; 41 42 43 44 /** 45 * A group box widget provides a nice raised or sunken border 46 * around a group of widgets, providing a visual delineation. 47 * Typically, a title is placed over the border to provide some 48 * clarification. 49 */ 50 class FXAPI FXGroupBox : public FXPacker { 51 FXDECLARE(FXGroupBox) 52 protected: 53 FXString label; 54 FXFont *font; 55 FXColor textColor; 56 protected: 57 FXGroupBox(); 58 private: 59 FXGroupBox(const FXGroupBox&); 60 FXGroupBox &operator=(const FXGroupBox&); 61 public: 62 long onPaint(FXObject*,FXSelector,void*); 63 long onCmdSetValue(FXObject*,FXSelector,void*); 64 long onCmdSetStringValue(FXObject*,FXSelector,void*); 65 long onCmdGetStringValue(FXObject*,FXSelector,void*); 66 public: 67 68 /// Construct group box layout manager 69 FXGroupBox(FXComposite* p,const FXString& text,FXuint opts=GROUPBOX_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_SPACING,FXint pr=DEFAULT_SPACING,FXint pt=DEFAULT_SPACING,FXint pb=DEFAULT_SPACING,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING); 70 71 /// Create server-side resources 72 virtual void create(); 73 74 /// Detach server-side resources 75 virtual void detach(); 76 77 /// Perform layout 78 virtual void layout(); 79 80 /// Enable the window 81 virtual void enable(); 82 83 /// Disable the window 84 virtual void disable(); 85 86 /// Return default width 87 virtual FXint getDefaultWidth(); 88 89 /// Return default height 90 virtual FXint getDefaultHeight(); 91 92 /// Change group box title text 93 void setText(const FXString& text); 94 95 /// Return current groupbox title text getText()96 FXString getText() const { return label; } 97 98 /// Change group box style 99 void setGroupBoxStyle(FXuint style); 100 101 /// Return current group box style 102 FXuint getGroupBoxStyle() const; 103 104 /// Change title font 105 void setFont(FXFont* fnt); 106 107 /// Return title font getFont()108 FXFont* getFont() const { return font; } 109 110 /// Change title text color 111 void setTextColor(FXColor clr); 112 113 /// Return text color getTextColor()114 FXColor getTextColor() const { return textColor; } 115 116 /// Save to a stream 117 virtual void save(FXStream& store) const; 118 119 /// Load from a stream 120 virtual void load(FXStream& store); 121 }; 122 123 } 124 125 #endif 126