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,2005 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.23 2005/02/03 20:12:46 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 /** 00053 * The Frame widget provides borders around some contents. Borders may be raised, sunken, 00054 * thick, ridged or etched. They can also be turned off completely. 00055 * In addition, a certain amount of padding may be specified between the contents of 00056 * the widget and the borders. The contents may be justified inside the widget using the 00057 * justification options. 00058 * The Frame widget is sometimes used by itself as a place holder, but most often is used 00059 * as a convenient base class for simple controls. 00060 */ 00061 class FXAPI FXFrame : public FXWindow { 00062 FXDECLARE(FXFrame) 00063 protected: 00064 FXColor baseColor; // Base color 00065 FXColor hiliteColor; // Highlight color 00066 FXColor shadowColor; // Shadow color 00067 FXColor borderColor; // Border color 00068 FXint padtop; // Top padding 00069 FXint padbottom; // Bottom padding 00070 FXint padleft; // Left padding 00071 FXint padright; // right padding 00072 FXint border; // Border size 00073 protected: 00074 FXFrame(); 00075 void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00076 void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00077 void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00078 void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00079 void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00080 void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00081 void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00082 void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00083 private: 00084 FXFrame(const FXFrame&); 00085 FXFrame &operator=(const FXFrame&); 00086 public: 00087 long onPaint(FXObject*,FXSelector,void*); 00088 public: 00089 00090 /// Construct frame window 00091 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); 00092 00093 /// Return default width 00094 virtual FXint getDefaultWidth(); 00095 00096 /// Return default height 00097 virtual FXint getDefaultHeight(); 00098 00099 /// Change frame style 00100 void setFrameStyle(FXuint style); 00101 00102 /// Get current frame style 00103 FXuint getFrameStyle() const; 00104 00105 /// Get border width 00106 FXint getBorderWidth() const { return border; } 00107 00108 /// Change top padding 00109 void setPadTop(FXint pt); 00110 00111 /// Get top interior padding 00112 FXint getPadTop() const { return padtop; } 00113 00114 /// Change bottom padding 00115 void setPadBottom(FXint pb); 00116 00117 /// Get bottom interior padding 00118 FXint getPadBottom() const { return padbottom; } 00119 00120 /// Change left padding 00121 void setPadLeft(FXint pl); 00122 00123 /// Get left interior padding 00124 FXint getPadLeft() const { return padleft; } 00125 00126 /// Change right padding 00127 void setPadRight(FXint pr); 00128 00129 /// Get right interior padding 00130 FXint getPadRight() const { return padright; } 00131 00132 /// Change highlight color 00133 void setHiliteColor(FXColor clr); 00134 00135 /// Get highlight color 00136 FXColor getHiliteColor() const { return hiliteColor; } 00137 00138 /// Change shadow color 00139 void setShadowColor(FXColor clr); 00140 00141 /// Get shadow color 00142 FXColor getShadowColor() const { return shadowColor; } 00143 00144 /// Change border color 00145 void setBorderColor(FXColor clr); 00146 00147 /// Get border color 00148 FXColor getBorderColor() const { return borderColor; } 00149 00150 /// Change base gui color 00151 void setBaseColor(FXColor clr); 00152 00153 /// Get base gui color 00154 FXColor getBaseColor() const { return baseColor; } 00155 00156 /// Save to stream 00157 virtual void save(FXStream& store) const; 00158 00159 /// Load from stream 00160 virtual void load(FXStream& store); 00161 }; 00162 00163 } 00164 00165 #endif

Copyright © 1997-2005 Jeroen van der Zijp