From f899c3897d62bd4f3c2d3bcaaf1ac5447ca8d158 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Wed, 7 Apr 2010 23:17:33 +0000 Subject: Added new flags for label alignment: FL_LEFT_TOP, FL_RIGHT_TOP, FL_LEFT_BOTTOM, and FL_RIGHT_BOTTOM align outside labels first to the side, then to the top or botton, filling a gap in possible alignment. Also FL_ALIGN_TEXT_NEXT_TO_IMAGE and FL_ALIGN_IMAGE_NEXT_TO_TEXT which do just that, and finally FL_ALIGN_IMAGE_BACKDROP which renders the image in the background and draws the label on top. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7469 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Group.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/Fl_Group.cxx') diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx index a5ca1739b..8f02fcf46 100644 --- a/src/Fl_Group.cxx +++ b/src/Fl_Group.cxx @@ -745,7 +745,23 @@ void Fl_Group::draw_outside_label(const Fl_Widget& widget) const { int Y = widget.y(); int W = widget.w(); int H = widget.h(); - if (a & FL_ALIGN_TOP) { + if ( (a & 0x0f) == FL_ALIGN_LEFT_TOP ) { + a = (a &~0x0f ) | FL_ALIGN_TOP_RIGHT; + X = x(); + W = widget.x()-X-3; + } else if ( (a & 0x0f) == FL_ALIGN_LEFT_BOTTOM ) { + a = (a &~0x0f ) | FL_ALIGN_BOTTOM_RIGHT; + X = x(); + W = widget.x()-X-3; + } else if ( (a & 0x0f) == FL_ALIGN_RIGHT_TOP ) { + a = (a &~0x0f ) | FL_ALIGN_TOP_LEFT; + X = X+W+3; + W = x()+this->w()-X; + } else if ( (a & 0x0f) == FL_ALIGN_RIGHT_BOTTOM ) { + a = (a &~0x0f ) | FL_ALIGN_BOTTOM_LEFT; + X = X+W+3; + W = x()+this->w()-X; + } else if (a & FL_ALIGN_TOP) { a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP); Y = y(); H = widget.y()-Y; -- cgit v1.2.3