Added <vector> and <string>
[pwlib.git] / include / pwlib / stattext.h
blob72c7f4123edd3de896657572f3834eb71ce3e1ac
1 /*
2 * stattext.h
4 * Static text control.
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
29 * $Log$
30 * Revision 1.19 2001/05/22 12:49:33 robertj
31 * Did some seriously wierd rewrite of platform headers to eliminate the
32 * stupid GNU compiler warning about braces not matching.
34 * Revision 1.18 1999/03/10 03:49:53 robertj
35 * More documentation adjustments.
37 * Revision 1.17 1999/03/09 08:01:50 robertj
38 * Changed comments for doc++ support (more to come).
40 * Revision 1.16 1999/02/16 08:08:46 robertj
41 * MSVC 6.0 compatibility changes.
43 * Revision 1.15 1998/09/23 06:29:22 robertj
44 * Added open source copyright license.
46 * Revision 1.14 1995/06/17 11:13:28 robertj
47 * Documentation update.
49 * Revision 1.13 1995/03/14 12:42:43 robertj
50 * Updated documentation to use HTML codes.
52 * Revision 1.12 1995/01/27 11:16:57 robertj
53 * Changed alignment mask from enum to int.
55 * Revision 1.11 1995/01/16 09:42:11 robertj
56 * Documentation.
58 * Revision 1.10 1994/10/30 11:47:22 robertj
59 * Changed mechanism for doing notification callback functions.
61 * Revision 1.9 1994/08/23 11:32:52 robertj
62 * Oops
64 * Revision 1.8 1994/08/22 00:46:48 robertj
65 * Added pragma fro GNU C++ compiler.
67 * Revision 1.7 1994/03/07 07:38:19 robertj
68 * Major enhancementsacross the board.
70 * Revision 1.6 1994/01/03 04:42:23 robertj
71 * Mass changes to common container classes and interactors etc etc etc.
73 * Revision 1.5 1993/09/27 16:35:25 robertj
74 * Removed special constructor for dialog resource loading.
76 * Revision 1.4 1993/08/21 01:50:33 robertj
77 * Made Clone() function optional, default will assert if called.
79 * Revision 1.3 1993/07/14 12:49:16 robertj
80 * Fixed RCS keywords.
85 #define _PSTATICTEXT
87 #ifdef __GNUC__
88 #pragma interface
89 #endif
92 class PStaticText : public PNamedControl
94 PCLASSINFO(PStaticText, PNamedControl)
95 /* A simple control to display some text. This draws the text without any
96 borders in the specified alignment and in the current foreground and
97 background colours for the interactor.
99 This control is display only and normally does not permit any further
100 interaction.
103 public:
104 /**Create a static text control containing the specified string and
105 using the specified alignment options.
107 PStaticText(
108 PInteractor * parent, /// Interactor into which the control is placed.
109 int align = PCanvas::LeftAlign
110 /**Alignment for the text in the control. This is an or combination of
111 values from the \Ref{PCanvas::DrawStringOptions enum}.
114 PStaticText(
115 PInteractor * parent, /// Interactor into which the control is placed.
116 const PString & name, /// Text string contents of the static control.
117 int align = PCanvas::LeftAlign
118 /**Alignment for the text in the control. This is an or combination of
119 value from the \Ref{Pcanvas::DrawStringOptions enum}.
123 /** Create control from interactor layout with the specified control ID. */
124 PStaticText(
125 PInteractorLayout * parent, /// Interactor into which the box is placed.
126 PRESOURCE_ID ctlID, /// Identifier for the control in the layout.
127 const PNotifier & notify, /// Function to call when changes state.
128 void * valuePtr /// Unused value pointer for static control.
131 /** Destroy the static text control. */
132 virtual ~PStaticText();
135 /**@name Overrides from class PInteractor */
136 /**This function is called by the system whenever the control requires
137 redrawing.
139 The bahaviour here is to draw the name of the control with the
140 alignment specified. It uses the \Ref{PCanvas::DrawString()} function.
142 virtual void OnRedraw(
143 PCanvas & canvas /// Canvas used for to draw the static text.
147 /**@name New functions for class */
148 /**Set the default (minimum) dimensions for the control. This is
149 determined by the current font of the control and the text being
150 displayed.
152 void DefaultDimensions();
154 /**Set the current alignment for the static text control. This is an or
155 combination of values from the \Ref{PCanvas::DrawStringOptions enum}.
157 void SetAlignment(
158 int newAlign /// New text alignment options.
161 /**Get the current alignment for the static text control.
163 @return
164 alignment of the text in the control.
166 int GetAlignment() const;
169 protected:
170 /** The current alignment used by the control. */
171 int alignment;
174 // Include platform dependent part of class
175 #include <pwlib/stattext.h>
179 // End Of File ///////////////////////////////////////////////////////////////