Fix containers Indent property.

[GB.GTK]
* BUG: Fix containers Indent property.

[GB.GTK3]
* BUG: Fix containers Indent property.

[GB.QT4]
* BUG: Fix containers Indent property.

[GB.QT5]
* BUG: Fix containers Indent property.
This commit is contained in:
gambas 2020-09-29 00:33:42 +02:00
parent ff3335e108
commit 66e1539a4f
5 changed files with 15 additions and 18 deletions

View file

@ -159,9 +159,9 @@ END_PROPERTY
BEGIN_PROPERTY(Container_Indent) BEGIN_PROPERTY(Container_Indent)
if (READ_PROPERTY) if (READ_PROPERTY)
GB.ReturnInteger(WIDGET->indent()); GB.ReturnBoolean(WIDGET->indent());
else else
WIDGET->setMargin(VPROP(GB_INTEGER)); WIDGET->setIndent(VPROP(GB_BOOLEAN));
END_PROPERTY END_PROPERTY
@ -536,10 +536,10 @@ END_PROPERTY
BEGIN_PROPERTY(UserContainer_Indent) BEGIN_PROPERTY(UserContainer_Indent)
if (READ_PROPERTY) if (READ_PROPERTY)
GB.ReturnInteger(WIDGET_CONT->indent()); GB.ReturnBoolean(WIDGET_CONT->indent());
else else
{ {
WIDGET_CONT->setIndent(VPROP(GB_INTEGER)); WIDGET_CONT->setIndent(VPROP(GB_BOOLEAN));
THIS_UC->save = WIDGET_CONT->fullArrangement(); THIS_UC->save = WIDGET_CONT->fullArrangement();
} }

View file

@ -348,11 +348,9 @@ void gContainer::setMargin(bool vl)
} }
} }
void gContainer::setIndent(int vl) void gContainer::setIndent(bool vl)
{ {
if (vl < 0) if (vl != arrangement.indent)
vl = 1;
if (vl >= 0 && vl <= 7 && vl != arrangement.indent)
{ {
arrangement.indent = vl; arrangement.indent = vl;
performArrange(); performArrange();

View file

@ -34,11 +34,11 @@ struct gContainerArrangement
unsigned margin : 1; unsigned margin : 1;
unsigned spacing : 1; unsigned spacing : 1;
unsigned padding : 8; unsigned padding : 8;
unsigned indent : 4; unsigned indent : 1;
unsigned dirty : 1; unsigned dirty : 1;
unsigned autoresize : 1; unsigned autoresize : 1;
unsigned invert : 1; unsigned invert : 1;
unsigned _reserved: 9; unsigned _reserved: 12;
}; };
class gContainer : public gControl class gContainer : public gControl
@ -54,7 +54,7 @@ public:
int padding() const { return arrangement.padding; } int padding() const { return arrangement.padding; }
bool spacing() const { return arrangement.spacing; } bool spacing() const { return arrangement.spacing; }
bool margin() const { return arrangement.margin; } bool margin() const { return arrangement.margin; }
int indent() const { return arrangement.indent; } bool indent() const { return arrangement.indent; }
bool invert() const { return arrangement.invert; } bool invert() const { return arrangement.invert; }
virtual int clientWidth(); virtual int clientWidth();
@ -72,7 +72,7 @@ public:
void setPadding(int vl); void setPadding(int vl);
void setSpacing(bool vl); void setSpacing(bool vl);
void setMargin(bool vl); void setMargin(bool vl);
void setIndent(int vl); void setIndent(bool vl);
void setInvert(bool vl); void setInvert(bool vl);
virtual int childCount() const; virtual int childCount() const;

View file

@ -1074,12 +1074,11 @@ END_PROPERTY
BEGIN_PROPERTY(Container_Indent) BEGIN_PROPERTY(Container_Indent)
if (READ_PROPERTY) if (READ_PROPERTY)
GB.ReturnInteger(THIS_ARRANGEMENT->indent); GB.ReturnBoolean(THIS_ARRANGEMENT->indent);
else else
{ {
int val = VPROP(GB_INTEGER); bool val = VPROP(GB_BOOLEAN);
if (val < 0) val = 1; if (val != THIS_ARRANGEMENT->indent)
if (val != THIS_ARRANGEMENT->indent && val >= 0 && val <= 7)
{ {
THIS_ARRANGEMENT->indent = val; THIS_ARRANGEMENT->indent = val;
arrange_now(CONTAINER); arrange_now(CONTAINER);

View file

@ -44,11 +44,11 @@ typedef
unsigned margin : 1; unsigned margin : 1;
unsigned spacing : 1; unsigned spacing : 1;
unsigned padding : 8; unsigned padding : 8;
unsigned indent : 4; unsigned indent : 1;
unsigned dirty : 1; unsigned dirty : 1;
unsigned autoresize : 1; unsigned autoresize : 1;
unsigned invert : 1; unsigned invert : 1;
unsigned _reserved: 8; unsigned _reserved: 12;
} }
CARRANGEMENT; CARRANGEMENT;