diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2010-04-07 23:17:33 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2010-04-07 23:17:33 +0000 |
| commit | f899c3897d62bd4f3c2d3bcaaf1ac5447ca8d158 (patch) | |
| tree | 98d2c3bbfabae8ba92f3f31c825b4de700b391a1 /src/fl_boxtype.cxx | |
| parent | 0fe65e94c98cee0baf9df8d60bef0137f42fdb92 (diff) | |
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
Diffstat (limited to 'src/fl_boxtype.cxx')
| -rw-r--r-- | src/fl_boxtype.cxx | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/fl_boxtype.cxx b/src/fl_boxtype.cxx index f4ae05941..c8a824e5c 100644 --- a/src/fl_boxtype.cxx +++ b/src/fl_boxtype.cxx @@ -399,14 +399,19 @@ void fl_draw_box(Fl_Boxtype t, int x, int y, int w, int h, Fl_Color c) { //extern Fl_Widget *fl_boxcheat; // hack set by Fl_Window.cxx /** Draws the widget box according its box style */ void Fl_Widget::draw_box() const { - int t = box_; - if (!t) return; -// if (this == fl_boxcheat) { -// fl_boxcheat = 0; -// if (t == FL_FLAT_BOX) return; -// t += 2; // convert box to frame -// } - draw_box((Fl_Boxtype)t, x_, y_, w_, h_, color_); + if (box_) draw_box((Fl_Boxtype)box_, x_, y_, w_, h_, color_); + draw_backdrop(); +} +/** If FL_ALIGN_IMAGE_BACKDROP is set, the image or deimage will be drawn */ +void Fl_Widget::draw_backdrop() const { + if (align() & FL_ALIGN_IMAGE_BACKDROP) { + const Fl_Image *img = image(); + // if there is no image, we will not draw the deimage either + if (img && deimage() && !active_r()) + img = deimage(); + if (img) + ((Fl_Image*)img)->draw(x_+(w_-img->w())/2, y_+(h_-img->h())/2); + } } /** Draws a box of type t, of color c at the widget's position and size. */ void Fl_Widget::draw_box(Fl_Boxtype t, Fl_Color c) const { |
