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,2009 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 * $Id: FXFrame.h,v 1.28 2009/01/06 13:07:24 fox Exp $                           *
00022 ********************************************************************************/
00023 #ifndef FXFRAME_H
00024 #define FXFRAME_H
00025 
00026 #ifndef FXWINDOW_H
00027 #include "FXWindow.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 /// Justification modes used by certain subclasses
00034 enum {
00035   JUSTIFY_NORMAL       = 0,           /// Default justification is centered text
00036   JUSTIFY_CENTER_X     = 0,           /// Contents centered horizontally
00037   JUSTIFY_LEFT         = 0x00008000,          /// Contents left-justified
00038   JUSTIFY_RIGHT        = 0x00010000,          /// Contents right-justified
00039   JUSTIFY_HZ_APART     = JUSTIFY_LEFT|JUSTIFY_RIGHT,  /// Combination of JUSTIFY_LEFT & JUSTIFY_RIGHT
00040   JUSTIFY_CENTER_Y     = 0,           /// Contents centered vertically
00041   JUSTIFY_TOP          = 0x00020000,          /// Contents aligned with label top
00042   JUSTIFY_BOTTOM       = 0x00040000,          /// Contents aligned with label bottom
00043   JUSTIFY_VT_APART     = JUSTIFY_TOP|JUSTIFY_BOTTOM   /// Combination of JUSTIFY_TOP & JUSTIFY_BOTTOM
00044   };
00045 
00046 
00047 /// Default padding
00048 enum { DEFAULT_PAD = 2 };
00049 
00050 
00051 /**
00052 * The Frame widget provides borders around some contents. Borders may be raised, sunken,
00053 * thick, ridged or etched.  They can also be turned off completely.
00054 * In addition, a certain amount of padding may be specified between the contents of
00055 * the widget and the borders.  The contents may be justified inside the widget using the
00056 * justification options.
00057 * The Frame widget is sometimes used by itself as a place holder, but most often is used
00058 * as a convenient base class for simple controls.
00059 */
00060 class FXAPI FXFrame : public FXWindow {
00061   FXDECLARE(FXFrame)
00062 protected:
00063   FXColor baseColor;    // Base color
00064   FXColor hiliteColor;  // Highlight color
00065   FXColor shadowColor;  // Shadow color
00066   FXColor borderColor;  // Border color
00067   FXint   padtop;       // Top padding
00068   FXint   padbottom;    // Bottom padding
00069   FXint   padleft;      // Left padding
00070   FXint   padright;     // right padding
00071   FXint   border;       // Border size
00072 protected:
00073   FXFrame();
00074   void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00075   void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00076   void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00077   void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00078   void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00079   void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00080   void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00081   void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00082 private:
00083   FXFrame(const FXFrame&);
00084   FXFrame &operator=(const FXFrame&);
00085 public:
00086   long onPaint(FXObject*,FXSelector,void*);
00087 public:
00088 
00089   /// Construct frame window
00090   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);
00091 
00092   /// Return default width
00093   virtual FXint getDefaultWidth();
00094 
00095   /// Return default height
00096   virtual FXint getDefaultHeight();
00097 
00098   /// Change frame style
00099   void setFrameStyle(FXuint style);
00100 
00101   /// Get current frame style
00102   FXuint getFrameStyle() const;
00103 
00104   /// Get border width
00105   FXint getBorderWidth() const { return border; }
00106 
00107   /// Change top padding
00108   void setPadTop(FXint pt);
00109 
00110   /// Get top interior padding
00111   FXint getPadTop() const { return padtop; }
00112 
00113   /// Change bottom padding
00114   void setPadBottom(FXint pb);
00115 
00116   /// Get bottom interior padding
00117   FXint getPadBottom() const { return padbottom; }
00118 
00119   /// Change left padding
00120   void setPadLeft(FXint pl);
00121 
00122   /// Get left interior padding
00123   FXint getPadLeft() const { return padleft; }
00124 
00125   /// Change right padding
00126   void setPadRight(FXint pr);
00127 
00128   /// Get right interior padding
00129   FXint getPadRight() const { return padright; }
00130 
00131   /// Change highlight color
00132   void setHiliteColor(FXColor clr);
00133 
00134   /// Get highlight color
00135   FXColor getHiliteColor() const { return hiliteColor; }
00136 
00137   /// Change shadow color
00138   void setShadowColor(FXColor clr);
00139 
00140   /// Get shadow color
00141   FXColor getShadowColor() const { return shadowColor; }
00142 
00143   /// Change border color
00144   void setBorderColor(FXColor clr);
00145 
00146   /// Get border color
00147   FXColor getBorderColor() const { return borderColor; }
00148 
00149   /// Change base gui color
00150   void setBaseColor(FXColor clr);
00151 
00152   /// Get base gui color
00153   FXColor getBaseColor() const { return baseColor; }
00154 
00155   /// Save to stream
00156   virtual void save(FXStream& store) const;
00157 
00158   /// Load from stream
00159   virtual void load(FXStream& store);
00160   };
00161 
00162 }
00163 
00164 #endif

Copyright © 1997-2009 Jeroen van der Zijp