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