libyui
2.42.5
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Enumerations
Friends
YAlignment.h
1
/*
2
Copyright (C) 2000-2012 Novell, Inc
3
This library is free software; you can redistribute it and/or modify
4
it under the terms of the GNU Lesser General Public License as
5
published by the Free Software Foundation; either version 2.1 of the
6
License, or (at your option) version 3.0 of the License. This library
7
is distributed in the hope that it will be useful, but WITHOUT ANY
8
WARRANTY; without even the implied warranty of MERCHANTABILITY or
9
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
License for more details. You should have received a copy of the GNU
11
Lesser General Public License along with this library; if not, write
12
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13
Floor, Boston, MA 02110-1301 USA
14
*/
15
16
17
/*-/
18
19
File: YAlignment.h
20
21
Author: Stefan Hundhammer <sh@suse.de>
22
23
/-*/
24
25
#ifndef YAlignment_h
26
#define YAlignment_h
27
28
#include "YSingleChildContainerWidget.h"
29
30
31
class
YAlignmentPrivate
;
32
33
/**
34
* Implementation of all the alignment widgets:
35
*
36
* - Left, Right, HCenter,
37
* - Top, Bottom, VCenter,
38
* - HVCenter
39
* - MinSize, MinWidth, MinHeight
40
**/
41
class
YAlignment
:
public
YSingleChildContainerWidget
42
{
43
protected
:
44
/**
45
* Constructor.
46
**/
47
YAlignment
(
YWidget
*
parent
,
48
YAlignmentType horAlign,
49
YAlignmentType vertAlign );
50
51
public
:
52
/**
53
* Destructor.
54
**/
55
virtual
~YAlignment
();
56
57
/**
58
* Return a descriptive name of this widget class for logging,
59
* debugging etc.
60
**/
61
virtual
const
char
*
widgetClass
()
const
;
62
63
/**
64
* Return the alignment in the specified dimension.
65
**/
66
YAlignmentType
alignment
( YUIDimension dim )
const
;
67
68
/**
69
* Return the left margin in pixels, the distance between the left edge of
70
* this alignment and the left edge of the child widget.
71
**/
72
int
leftMargin
()
const
;
73
74
/**
75
* Return the right margin in pixels, the distance between the right edge
76
* of this alignment and the right edge of the child widget.
77
**/
78
int
rightMargin
()
const
;
79
80
/**
81
* Return the top margin in pixels, the distance between the top edge of
82
* this alignment and the top edge of the child widget.
83
**/
84
int
topMargin
()
const
;
85
86
/**
87
* Return the bottom margin in pixels, the distance between the bottom
88
* edge of this alignment and the bottom edge of the child widget.
89
**/
90
int
bottomMargin
()
const
;
91
92
/**
93
* Return the sum of all margins in the specified dimension.
94
**/
95
int
totalMargins
( YUIDimension dim )
const
;
96
97
/**
98
* Set the left margin in pixels.
99
**/
100
void
setLeftMargin
(
int
margin );
101
102
/**
103
* Set the right margin in pixels.
104
**/
105
void
setRightMargin
(
int
margin );
106
107
/**
108
* Set the top margin in pixels.
109
**/
110
void
setTopMargin
(
int
margin );
111
112
/**
113
* Set the bottom margin in pixels.
114
**/
115
void
setBottomMargin
(
int
margin );
116
117
/**
118
* Return the minimum width of this alignment or 0 if none is set.
119
* preferredWidth() will never return less than this value.
120
**/
121
int
minWidth
()
const
;
122
123
/**
124
* Return the minimum height of this alignment or 0 if none is set.
125
* preferredHeight() will never return less than this value.
126
**/
127
int
minHeight
()
const
;
128
129
/**
130
* Set the minimum width to return for preferredWidth().
131
**/
132
void
setMinWidth
(
int
width );
133
134
/**
135
* Set the minimum height to return for preferredHeight().
136
**/
137
void
setMinHeight
(
int
height );
138
139
/**
140
* Set a background pixmap.
141
*
142
* Derived classes may want to overwrite this.
143
*
144
* This parent method should be called first in the overwritten method to
145
* ensure path expansion is done as specified (prepend the theme path
146
* ("/usr/share/libyui/theme/") if the path doesn't start with "/"
147
* or ".").
148
**/
149
virtual
void
setBackgroundPixmap
(
const
std::string & pixmapFileName );
150
151
/**
152
* Return the name of the background pixmap or an empty string, if there
153
* is none.
154
**/
155
std::string
backgroundPixmap
()
const
;
156
157
/**
158
* Add a child widget.
159
*
160
* Reimplemented from YSingleChildContainerWidget to propagate
161
* stretchability down to the single child.
162
**/
163
virtual
void
addChild
(
YWidget
* child );
164
165
/**
166
* Move a child widget to a new position.
167
**/
168
virtual
void
moveChild
(
YWidget
*child,
int
newx,
int
newy ) = 0;
169
170
/**
171
* Return this widget's stretchability.
172
* Reimplemented from YWidget.
173
*
174
* In an aligned dimension the widget is always stretchable.
175
* In an unchanged dimension the widget is stretchable if the
176
* child is stretchable.
177
**/
178
virtual
bool
stretchable
( YUIDimension dim )
const
;
179
180
/**
181
* Preferred width of the widget.
182
*
183
* Reimplemented from YWidget.
184
**/
185
virtual
int
preferredWidth
();
186
187
/**
188
* Preferred height of the widget.
189
*
190
* Reimplemented from YWidget.
191
**/
192
virtual
int
preferredHeight
();
193
194
/**
195
* Set the current size and move the child widget according to its
196
* alignment.
197
*
198
* Derived classes should reimplement this, but call this base class
199
* function in their own implementation.
200
**/
201
virtual
void
setSize
(
int
newWidth,
int
newHeight );
202
203
204
protected
:
205
206
ImplPtr<YAlignmentPrivate>
priv;
207
};
208
209
210
#endif // YAlignment_h
src
YAlignment.h
Generated by
1.8.3