summaryrefslogtreecommitdiff
path: root/src/Fl_Group.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2017-02-27 17:00:41 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2017-02-27 17:00:41 +0000
commita60f99d4a1a94bd19125dce89555983f2fa4841c (patch)
treee726a8933bfb3e6c901aff3fb2d19835f09b4034 /src/Fl_Group.cxx
parent2d18660f5cf06acff7446dd9983e3f76b97cb420 (diff)
Improve label alignment docs and border case implementations.
Make clear that some alignment bit combinations are "illegal" and yield undefined behavior that can be changed without notice. Fix label alignment in some border cases where illegal bit combinations like FL_ALIGN_LEFT and FL_ALIGN_RIGHT or FL_ALIGN_TOP and FL_ALIGN_BOTTOM are both set, respectively. Todo: There appears to be inconsistent handling WRT these "illegal" cases, for instance with inside labels as opposed to outside labels, such that the behavior seems to be unpredictable. See test/label.cxx. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12181 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Group.cxx')
-rw-r--r--src/Fl_Group.cxx28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx
index 7b10dc9f3..b4ef6d91c 100644
--- a/src/Fl_Group.cxx
+++ b/src/Fl_Group.cxx
@@ -793,36 +793,40 @@ void Fl_Group::draw_outside_label(const Fl_Widget& widget) const {
} else {
wx = x(); wy = y();
}
- if ( (a & 0x0f) == FL_ALIGN_LEFT_TOP ) {
- a = (a &~0x0f ) | FL_ALIGN_TOP_RIGHT;
+ if ( (a & FL_ALIGN_POSITION_MASK) == FL_ALIGN_LEFT_TOP ) {
+ a = (a &(~FL_ALIGN_POSITION_MASK) ) | FL_ALIGN_TOP_RIGHT;
X = wx;
W = widget.x()-X-3;
- } else if ( (a & 0x0f) == FL_ALIGN_LEFT_BOTTOM ) {
- a = (a &~0x0f ) | FL_ALIGN_BOTTOM_RIGHT;
+ } else if ( (a & FL_ALIGN_POSITION_MASK) == FL_ALIGN_LEFT_BOTTOM ) {
+ a = (a &(~FL_ALIGN_POSITION_MASK) ) | FL_ALIGN_BOTTOM_RIGHT;
X = wx;
W = widget.x()-X-3;
- } else if ( (a & 0x0f) == FL_ALIGN_RIGHT_TOP ) {
- a = (a &~0x0f ) | FL_ALIGN_TOP_LEFT;
+ } else if ( (a & FL_ALIGN_POSITION_MASK) == FL_ALIGN_RIGHT_TOP ) {
+ a = (a &(~FL_ALIGN_POSITION_MASK) ) | FL_ALIGN_TOP_LEFT;
X = X+W+3;
W = wx+this->w()-X;
- } else if ( (a & 0x0f) == FL_ALIGN_RIGHT_BOTTOM ) {
- a = (a &~0x0f ) | FL_ALIGN_BOTTOM_LEFT;
+ } else if ( (a & FL_ALIGN_POSITION_MASK) == FL_ALIGN_RIGHT_BOTTOM ) {
+ a = (a &(~FL_ALIGN_POSITION_MASK) ) | FL_ALIGN_BOTTOM_LEFT;
X = X+W+3;
W = wx+this->w()-X;
} else if (a & FL_ALIGN_TOP) {
- a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP);
+ a ^= FL_ALIGN_TOP;
+ a |= FL_ALIGN_BOTTOM;
Y = wy;
H = widget.y()-Y;
} else if (a & FL_ALIGN_BOTTOM) {
- a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP);
+ a ^= FL_ALIGN_BOTTOM;
+ a |= FL_ALIGN_TOP;
Y = Y+H;
H = wy+h()-Y;
} else if (a & FL_ALIGN_LEFT) {
- a ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT);
+ a ^= FL_ALIGN_LEFT;
+ a |= FL_ALIGN_RIGHT;
X = wx;
W = widget.x()-X-3;
} else if (a & FL_ALIGN_RIGHT) {
- a ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT);
+ a ^= FL_ALIGN_RIGHT;
+ a |= FL_ALIGN_LEFT;
X = X+W+3;
W = wx+this->w()-X;
}