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

FXGroupBox.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                G r o u p  B o x   W i n d o w   W i d g e t                   *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2002 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: FXGroupBox.h,v 1.16 2002/03/12 07:11:30 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXGROUPBOX_H
00025 #define FXGROUPBOX_H
00026 
00027 #ifndef FXPACKER_H
00028 #include "FXPacker.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 // Group box options
00035 enum {
00036   GROUPBOX_TITLE_LEFT   = 0,          /// Title is left-justified
00037   GROUPBOX_TITLE_CENTER = 0x00020000, /// Title is centered
00038   GROUPBOX_TITLE_RIGHT  = 0x00040000, /// Title is right-justified
00039   GROUPBOX_NORMAL       = GROUPBOX_TITLE_LEFT
00040   };
00041 
00042 
00043 
00044 /**
00045 * A group box widget provides a nice raised or sunken border
00046 * around a group of widgets, providing a visual delineation.
00047 * Typically, a title is placed over the border to provide some
00048 * clarification.
00049 * Radio buttons placed inside a group box automatically assume
00050 * mutually exclusive behaviour, i.e. at most one radio button will
00051 * be checked at any one time.
00052 */
00053 class FXAPI FXGroupBox : public FXPacker {
00054   FXDECLARE(FXGroupBox)
00055 protected:
00056   FXString  label;
00057   FXFont   *font;
00058   FXColor   textColor;
00059 protected:
00060   FXGroupBox();
00061   virtual void layout();
00062 private:
00063   FXGroupBox(const FXGroupBox&);
00064   FXGroupBox &operator=(const FXGroupBox&);
00065 public:
00066   long onPaint(FXObject*,FXSelector,void*);
00067   long onUncheckOther(FXObject*,FXSelector,void*);
00068 public:
00069 
00070   /// Construct group box layout manager
00071   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);
00072 
00073   /// Create server-side resources
00074   virtual void create();
00075 
00076   /// Detach server-side resources
00077   virtual void detach();
00078 
00079   /// Enable the window
00080   virtual void enable();
00081 
00082   /// Disable the window
00083   virtual void disable();
00084 
00085   /// Return default width
00086   virtual FXint getDefaultWidth();
00087 
00088   /// Return default height
00089   virtual FXint getDefaultHeight();
00090 
00091   /// Change group box title text
00092   void setText(const FXString& text);
00093 
00094   /// Return current groupbox title text
00095   FXString getText() const { return label; }
00096 
00097   /// Change group box style
00098   void setGroupBoxStyle(FXuint style);
00099 
00100   /// Return current group box style
00101   FXuint getGroupBoxStyle() const;
00102 
00103   /// Change title font
00104   void setFont(FXFont* fnt);
00105 
00106   /// Return title font
00107   FXFont* getFont() const { return font; }
00108 
00109   /// Change title text color
00110   void setTextColor(FXColor clr);
00111 
00112   /// Return text color
00113   FXColor getTextColor() const { return textColor; }
00114 
00115   /// Save to a stream
00116   virtual void save(FXStream& store) const;
00117 
00118   /// Load from a stream
00119   virtual void load(FXStream& store);
00120   };
00121 
00122 }
00123 
00124 #endif