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

FXFrame.h

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

Copyright © 1997-2004 Jeroen van der Zijp