![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * P a c k e r C o n t a i n e r 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: FXPacker.h,v 1.16 2002/03/12 07:11:30 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXPACKER_H 00025 #define FXPACKER_H 00026 00027 #ifndef FXCOMPOSITE_H 00028 #include "FXComposite.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 /// Default spacing 00035 const FXint DEFAULT_SPACING = 4; 00036 00037 00038 /** 00039 * Packer is a layout manager which automatically places child windows 00040 * inside its area against the left, right, top, or bottom side. 00041 * Each time a child is placed, the remaining space is decreased by the 00042 * amount of space taken by the child window. 00043 * The side against which a child is placed is determined by the LAYOUT_SIDE_TOP, 00044 * LAYOUT_SIDE_BOTTOM, LAYOUT_SIDE_LEFT, and LAYOUT_SIDE_RIGHT hints given by 00045 * the child window. Other layout hints from the child are observed as far as 00046 * sensible. So for example, a child placed against the right edge can still 00047 * have LAYOUT_FILL_Y or LAYOUT_TOP, and so on. 00048 * The last child may have both LAYOUT_FILL_X and LAYOUT_FILL_Y, in which 00049 * case it will be placed to take all remaining space. 00050 */ 00051 class FXAPI FXPacker : public FXComposite { 00052 FXDECLARE(FXPacker) 00053 protected: 00054 FXColor baseColor; // Base color 00055 FXColor hiliteColor; // Highlight color 00056 FXColor shadowColor; // Shadow color 00057 FXColor borderColor; // Border color 00058 FXint padtop; // Top margin 00059 FXint padbottom; // Bottom margin 00060 FXint padleft; // Left margin 00061 FXint padright; // Right margin 00062 FXint hspacing; // Horizontal child spacing 00063 FXint vspacing; // Vertical child spacing 00064 FXint border; // Border width 00065 protected: 00066 FXPacker(); 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 drawFocusRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00075 void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00076 virtual void layout(); 00077 private: 00078 FXPacker(const FXPacker&); 00079 FXPacker &operator=(const FXPacker&); 00080 public: 00081 long onPaint(FXObject*,FXSelector,void*); 00082 long onFocusUp(FXObject*,FXSelector,void*); 00083 long onFocusDown(FXObject*,FXSelector,void*); 00084 long onFocusLeft(FXObject*,FXSelector,void*); 00085 long onFocusRight(FXObject*,FXSelector,void*); 00086 public: 00087 00088 /// Construct packer layout manager 00089 FXPacker(FXComposite *p,FXuint opts=0,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); 00090 00091 /// Return default width 00092 virtual FXint getDefaultWidth(); 00093 00094 /// Return default height 00095 virtual FXint getDefaultHeight(); 00096 00097 /// Change frame style 00098 void setFrameStyle(FXuint style); 00099 00100 /// Get current frame style 00101 FXuint getFrameStyle() const; 00102 00103 /// Change packing hints 00104 void setPackingHints(FXuint ph); 00105 00106 /// Return packing hints 00107 FXuint getPackingHints() const; 00108 00109 /// Get border width 00110 FXint getBorderWidth() const { return border; } 00111 00112 /// Change top padding 00113 void setPadTop(FXint pt); 00114 00115 /// Get top interior padding 00116 FXint getPadTop() const { return padtop; } 00117 00118 /// Change bottom padding 00119 void setPadBottom(FXint pb); 00120 00121 /// Get bottom interior padding 00122 FXint getPadBottom() const { return padbottom; } 00123 00124 /// Change left padding 00125 void setPadLeft(FXint pl); 00126 00127 /// Get left interior padding 00128 FXint getPadLeft() const { return padleft; } 00129 00130 /// Change right padding 00131 void setPadRight(FXint pr); 00132 00133 /// Get right interior padding 00134 FXint getPadRight() const { return padright; } 00135 00136 /// Change highlight color 00137 void setHiliteColor(FXColor clr); 00138 00139 /// Get highlight color 00140 FXColor getHiliteColor() const { return hiliteColor; } 00141 00142 /// Change shadow color 00143 void setShadowColor(FXColor clr); 00144 00145 /// Get shadow color 00146 FXColor getShadowColor() const { return shadowColor; } 00147 00148 /// Change border color 00149 void setBorderColor(FXColor clr); 00150 00151 /// Get border color 00152 FXColor getBorderColor() const { return borderColor; } 00153 00154 /// Change base gui color 00155 void setBaseColor(FXColor clr); 00156 00157 /// Get base gui color 00158 FXColor getBaseColor() const { return baseColor; } 00159 00160 /// Change horizontal inter-child spacing 00161 void setHSpacing(FXint hs); 00162 00163 /// Return current horizontal inter-child spacing 00164 FXint getHSpacing() const { return hspacing; } 00165 00166 /// Change vertical inter-child spacing 00167 void setVSpacing(FXint vs); 00168 00169 /// Return current vertical inter-child spacing 00170 FXint getVSpacing() const { return vspacing; } 00171 00172 /// Save to stream 00173 virtual void save(FXStream& store) const; 00174 00175 /// Load from stream 00176 virtual void load(FXStream& store); 00177 }; 00178 00179 } 00180 00181 #endif