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

FXFrame.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                       F r a m e   W i n d o w   W i d g e t                   *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2010 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXFRAME_H
00022 #define FXFRAME_H
00023 
00024 #ifndef FXWINDOW_H
00025 #include "FXWindow.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00031 /// Justification modes used by certain subclasses
00032 enum {
00033   JUSTIFY_NORMAL       = 0,           /// Default justification is centered text
00034   JUSTIFY_CENTER_X     = 0,           /// Contents centered horizontally
00035   JUSTIFY_LEFT         = 0x00008000,          /// Contents left-justified
00036   JUSTIFY_RIGHT        = 0x00010000,          /// Contents right-justified
00037   JUSTIFY_HZ_APART     = JUSTIFY_LEFT|JUSTIFY_RIGHT,  /// Combination of JUSTIFY_LEFT & JUSTIFY_RIGHT
00038   JUSTIFY_CENTER_Y     = 0,           /// Contents centered vertically
00039   JUSTIFY_TOP          = 0x00020000,          /// Contents aligned with label top
00040   JUSTIFY_BOTTOM       = 0x00040000,          /// Contents aligned with label bottom
00041   JUSTIFY_VT_APART     = JUSTIFY_TOP|JUSTIFY_BOTTOM   /// Combination of JUSTIFY_TOP & JUSTIFY_BOTTOM
00042   };
00043 
00044 
00045 /// Default padding
00046 enum { DEFAULT_PAD = 2 };
00047 
00048 
00049 /**
00050 * The Frame widget provides borders around some contents. Borders may be raised, sunken,
00051 * thick, ridged or etched.  They can also be turned off completely.
00052 * In addition, a certain amount of padding may be specified between the contents of
00053 * the widget and the borders.  The contents may be justified inside the widget using the
00054 * justification options.
00055 * The Frame widget is sometimes used by itself as a place holder, but most often is used
00056 * as a convenient base class for simple controls.
00057 */
00058 class FXAPI FXFrame : public FXWindow {
00059   FXDECLARE(FXFrame)
00060 protected:
00061   FXColor baseColor;    // Base color
00062   FXColor hiliteColor;  // Highlight color
00063   FXColor shadowColor;  // Shadow color
00064   FXColor borderColor;  // Border color
00065   FXint   padtop;       // Top padding
00066   FXint   padbottom;    // Bottom padding
00067   FXint   padleft;      // Left padding
00068   FXint   padright;     // right padding
00069   FXint   border;       // Border size
00070 protected:
00071   FXFrame();
00072   void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00073   void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00074   void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00075   void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00076   void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00077   void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00078   void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00079   void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00080 private:
00081   FXFrame(const FXFrame&);
00082   FXFrame &operator=(const FXFrame&);
00083 public:
00084   long onPaint(FXObject*,FXSelector,void*);
00085 public:
00086 
00087   /// Construct frame window
00088   FXFrame(FXComposite* p,FXuint opts=FRAME_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
00089 
00090   /// Return default width
00091   virtual FXint getDefaultWidth();
00092 
00093   /// Return default height
00094   virtual FXint getDefaultHeight();
00095 
00096   /// Change frame style
00097   void setFrameStyle(FXuint style);
00098 
00099   /// Get current frame style
00100   FXuint getFrameStyle() const;
00101 
00102   /// Get border width
00103   FXint getBorderWidth() const { return border; }
00104 
00105   /// Change top padding
00106   void setPadTop(FXint pt);
00107 
00108   /// Get top interior padding
00109   FXint getPadTop() const { return padtop; }
00110 
00111   /// Change bottom padding
00112   void setPadBottom(FXint pb);
00113 
00114   /// Get bottom interior padding
00115   FXint getPadBottom() const { return padbottom; }
00116 
00117   /// Change left padding
00118   void setPadLeft(FXint pl);
00119 
00120   /// Get left interior padding
00121   FXint getPadLeft() const { return padleft; }
00122 
00123   /// Change right padding
00124   void setPadRight(FXint pr);
00125 
00126   /// Get right interior padding
00127   FXint getPadRight() const { return padright; }
00128 
00129   /// Change highlight color
00130   void setHiliteColor(FXColor clr);
00131 
00132   /// Get highlight color
00133   FXColor getHiliteColor() const { return hiliteColor; }
00134 
00135   /// Change shadow color
00136   void setShadowColor(FXColor clr);
00137 
00138   /// Get shadow color
00139   FXColor getShadowColor() const { return shadowColor; }
00140 
00141   /// Change border color
00142   void setBorderColor(FXColor clr);
00143 
00144   /// Get border color
00145   FXColor getBorderColor() const { return borderColor; }
00146 
00147   /// Change base gui color
00148   void setBaseColor(FXColor clr);
00149 
00150   /// Get base gui color
00151   FXColor getBaseColor() const { return baseColor; }
00152 
00153   /// Save to stream
00154   virtual void save(FXStream& store) const;
00155 
00156   /// Load from stream
00157   virtual void load(FXStream& store);
00158   };
00159 
00160 }
00161 
00162 #endif

Copyright © 1997-2010 Jeroen van der Zijp