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

FXFrame.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * F r a m e W i n d o w W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXFrame.h,v 1.24 2006/01/22 17:58:02 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXFRAME_H
25 #define FXFRAME_H
26 
27 #ifndef FXWINDOW_H
28 #include "FXWindow.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// Justification modes used by certain subclasses
35 enum {
36  JUSTIFY_NORMAL = 0, /// Default justification is centered text
37  JUSTIFY_CENTER_X = 0, /// Contents centered horizontally
38  JUSTIFY_LEFT = 0x00008000, /// Contents left-justified
39  JUSTIFY_RIGHT = 0x00010000, /// Contents right-justified
40  JUSTIFY_HZ_APART = JUSTIFY_LEFT|JUSTIFY_RIGHT, /// Combination of JUSTIFY_LEFT & JUSTIFY_RIGHT
41  JUSTIFY_CENTER_Y = 0, /// Contents centered vertically
42  JUSTIFY_TOP = 0x00020000, /// Contents aligned with label top
43  JUSTIFY_BOTTOM = 0x00040000, /// Contents aligned with label bottom
44  JUSTIFY_VT_APART = JUSTIFY_TOP|JUSTIFY_BOTTOM /// Combination of JUSTIFY_TOP & JUSTIFY_BOTTOM
45  };
46 
47 
48 /// Default padding
49 enum { DEFAULT_PAD = 2 };
50 
51 
52 /**
53 * The Frame widget provides borders around some contents. Borders may be raised, sunken,
54 * thick, ridged or etched. They can also be turned off completely.
55 * In addition, a certain amount of padding may be specified between the contents of
56 * the widget and the borders. The contents may be justified inside the widget using the
57 * justification options.
58 * The Frame widget is sometimes used by itself as a place holder, but most often is used
59 * as a convenient base class for simple controls.
60 */
61 class FXAPI FXFrame : public FXWindow {
63 protected:
64  FXColor baseColor; // Base color
65  FXColor hiliteColor; // Highlight color
66  FXColor shadowColor; // Shadow color
67  FXColor borderColor; // Border color
68  FXint padtop; // Top padding
69  FXint padbottom; // Bottom padding
70  FXint padleft; // Left padding
71  FXint padright; // right padding
72  FXint border; // Border size
73 protected:
74  FXFrame();
75  void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
76  void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
77  void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
78  void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
79  void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
80  void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
81  void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
82  void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
83 private:
84  FXFrame(const FXFrame&);
85  FXFrame &operator=(const FXFrame&);
86 public:
87  long onPaint(FXObject*,FXSelector,void*);
88 public:
89 
90  /// Construct frame window
92 
93  /// Return default width
94  virtual FXint getDefaultWidth();
95 
96  /// Return default height
97  virtual FXint getDefaultHeight();
98 
99  /// Change frame style
100  void setFrameStyle(FXuint style);
102  /// Get current frame style
103  FXuint getFrameStyle() const;
104 
105  /// Get border width
106  FXint getBorderWidth() const { return border; }
108  /// Change top padding
109  void setPadTop(FXint pt);
110 
111  /// Get top interior padding
112  FXint getPadTop() const { return padtop; }
114  /// Change bottom padding
115  void setPadBottom(FXint pb);
116 
117  /// Get bottom interior padding
118  FXint getPadBottom() const { return padbottom; }
120  /// Change left padding
121  void setPadLeft(FXint pl);
122 
123  /// Get left interior padding
124  FXint getPadLeft() const { return padleft; }
126  /// Change right padding
127  void setPadRight(FXint pr);
128 
129  /// Get right interior padding
130  FXint getPadRight() const { return padright; }
132  /// Change highlight color
133  void setHiliteColor(FXColor clr);
134 
135  /// Get highlight color
136  FXColor getHiliteColor() const { return hiliteColor; }
138  /// Change shadow color
139  void setShadowColor(FXColor clr);
140 
141  /// Get shadow color
142  FXColor getShadowColor() const { return shadowColor; }
144  /// Change border color
145  void setBorderColor(FXColor clr);
146 
147  /// Get border color
148  FXColor getBorderColor() const { return borderColor; }
149 
150  /// Change base gui color
151  void setBaseColor(FXColor clr);
152 
153  /// Get base gui color
154  FXColor getBaseColor() const { return baseColor; }
155 
156  /// Save to stream
157  virtual void save(FXStream& store) const;
158 
159  /// Load from stream
160  virtual void load(FXStream& store);
161  };
162 
163 }
164 
165 #endif
Contents centered horizontally.
Definition: FXFrame.h:40
Base class for all windows.
Definition: FXWindow.h:115
The Frame widget provides borders around some contents.
Definition: FXFrame.h:73
unsigned int FXuint
Definition: fxdefs.h:389
Definition: FXFrame.h:56
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
Contents right-justified.
Definition: FXFrame.h:42
Base composite.
Definition: FXComposite.h:35
FXuint FXColor
Definition: fxdefs.h:447
Combination of JUSTIFY_TOP & JUSTIFY_BOTTOM.
Definition: FXFrame.h:47
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
Contents left-justified.
Definition: FXFrame.h:41
Contents aligned with label bottom.
Definition: FXFrame.h:46
Regular raised/thick border.
Definition: FXWindow.h:82
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Window Device Context.
Definition: FXDCWindow.h:52
Combination of JUSTIFY_LEFT & JUSTIFY_RIGHT.
Definition: FXFrame.h:43
Default justification is centered text.
Definition: FXFrame.h:39
Contents aligned with label top.
Definition: FXFrame.h:45
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
Contents centered vertically.
Definition: FXFrame.h:44

Copyright © 1997-2005 Jeroen van der Zijp