DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
I have attached a patch file that adds a margin property to PackedGroup.
It creates a constant spacing AROUND all the child Widgets in distinction
to the spacing BETWEEN the child widgets.
It gives a methods either to control left,right,top,button margins
separately, or all at once.
The patch is against fltk-2.0.x-r5777, but should apply to any recent
version.
Thanks,
Davy Durham
Link: http://www.fltk.org/str.php?L1666
Version: 2.0-feature
diff -aur fltk-2.0.x-r5777.orig/fltk/PackedGroup.h
fltk-2.0.x-r5777/fltk/PackedGroup.h
--- fltk-2.0.x-r5777.orig/fltk/PackedGroup.h 2007-01-02 11:31:40.000000000
-0600
+++ fltk-2.0.x-r5777/fltk/PackedGroup.h 2007-04-30 23:38:45.000000000 -0500
@@ -35,6 +35,10 @@
class FL_API PackedGroup : public Group {
int spacing_;
+ int margin_left_;
+ int margin_right_;
+ int margin_top_;
+ int margin_bottom_;;
public:
enum { // values for type(int), for back-compatability
NORMAL = GROUP_TYPE,
@@ -44,6 +48,17 @@
PackedGroup(int x, int y, int w, int h, const char *l = 0, bool begin=false);
int spacing() const {return spacing_;}
void spacing(int i) {spacing_ = i;}
+
+ int margin_left() const {return margin_left_;}
+ void margin_left(int m) {margin_left_ = m;}
+ int margin_right() const {return margin_right_;}
+ void margin_right(int m) {margin_right_ = m;}
+ int margin_top() const {return margin_top_;}
+ void margin_top(int m) {margin_top_ = m;}
+ int margin_bottom() const {return margin_bottom_;}
+ void margin_bottom(int m) {margin_bottom_ = m;}
+
+ void margin(int m) {margin_left_ = margin_right_ = margin_top_ =
margin_bottom_ = m;}
};
}
diff -aur fltk-2.0.x-r5777.orig/src/PackedGroup.cxx
fltk-2.0.x-r5777/src/PackedGroup.cxx
--- fltk-2.0.x-r5777.orig/src/PackedGroup.cxx 2007-01-02 11:31:40.000000000
-0600
+++ fltk-2.0.x-r5777/src/PackedGroup.cxx 2007-04-30 23:39:42.000000000
-0500
@@ -67,6 +67,7 @@
: Group(x, y, w, h, l, begin) {
resizable(0);
spacing_ = 0;
+ margin(0);
}
void PackedGroup::layout() {
@@ -87,6 +88,12 @@
Rectangle r(w(),h());
box()->inset(r);
+ // Apply margins
+ r.set_x(r.x()+margin_left_);
+ r.set_r(r.r()-margin_right_);
+ r.set_y(r.y()+margin_top_);
+ r.set_b(r.b()-margin_bottom_);
+
bool saw_horizontal = false;
bool saw_vertical = false;
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev