From 177f45fe98e4c7575f7817a61e91be98162d29d2 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 16 Jan 2010 15:56:41 +0000 Subject: Extended Fl_Widget::align_ flag from 8 bits to full (unsigned) size for later extensions (currently all 8 bits are used). Moved the align_ flag to the internal Fl_Label struct (where it should be). There are no API changes, though. I also reordered a few other variables for better alignment, so that there is no size change of Fl_Widget on 32-bit platforms (currently 84 bytes on Windows/32-bit and probably all 32-bit platforms). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7013 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Widget.H | 13 +++++++------ src/Fl_Widget.cxx | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H index efa2296b6..94591107e 100644 --- a/FL/Fl_Widget.H +++ b/FL/Fl_Widget.H @@ -47,7 +47,6 @@ typedef void (Fl_Callback0)(Fl_Widget*); /** Callback type definition passing the widget and a long data value */ typedef void (Fl_Callback1)(Fl_Widget*, long); - /** This struct stores all information for a text or mixed graphics label. \todo For FLTK 1.3, the Fl_Label type will become a widget by itself. That way @@ -62,14 +61,17 @@ struct FL_EXPORT Fl_Label { Fl_Image* image; /** optional image for a deactivated label */ Fl_Image* deimage; - /** type of label. \see Fl_Labeltype */ - uchar type; /** label font used in text */ Fl_Font font; /** size of label font */ Fl_Fontsize size; /** text color */ Fl_Color color; + /** alignment of label */ + Fl_Align align_; + /** type of label. \see Fl_Labeltype */ + uchar type; + /** Draws the label aligned to the given box */ void draw(int,int,int,int, Fl_Align) const ; void measure(int &w, int &h) const ; @@ -102,7 +104,6 @@ class FL_EXPORT Fl_Widget { uchar type_; uchar damage_; uchar box_; - Fl_Align align_:8; uchar when_; const char *tooltip_; @@ -329,7 +330,7 @@ public: Fl_Align is (typedef'd to be) "unsigned" (int), but Fl_Widget's "align_" member variable is a bit field of 8 bits only ! */ - Fl_Align align() const {return align_;} + Fl_Align align() const {return label_.align_;} /** Sets the label alignment. This controls how the label is displayed next to or inside the widget. @@ -338,7 +339,7 @@ public: \param[in] alignment new label alignment \see align(), Fl_Align */ - void align(Fl_Align alignment) {align_ = alignment;} + void align(Fl_Align alignment) {label_.align_ = alignment;} /** Gets the box type of the widget. \return the current box type diff --git a/src/Fl_Widget.cxx b/src/Fl_Widget.cxx index 31d8818aa..ff631fd49 100644 --- a/src/Fl_Widget.cxx +++ b/src/Fl_Widget.cxx @@ -121,6 +121,7 @@ Fl_Widget::Fl_Widget(int X, int Y, int W, int H, const char* L) { label_.font = FL_HELVETICA; label_.size = FL_NORMAL_SIZE; label_.color = FL_FOREGROUND_COLOR; + label_.align_ = FL_ALIGN_CENTER; tooltip_ = 0; callback_ = default_callback; user_data_ = 0; @@ -130,7 +131,6 @@ Fl_Widget::Fl_Widget(int X, int Y, int W, int H, const char* L) { box_ = FL_NO_BOX; color_ = FL_GRAY; color2_ = FL_GRAY; - align_ = FL_ALIGN_CENTER; when_ = FL_WHEN_RELEASE; parent_ = 0; -- cgit v1.2.3