* OPT: Don't arrange the parent if a move & resize operation actually 
  changes nothing.
* OPT: When showing or hiding a control, check that we actually change the
  visibility of the widget and do nothing if we don't.


git-svn-id: svn://localhost/gambas/trunk@5164 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-09-13 00:45:52 +00:00
parent 93445a0bce
commit 167a8fa4a6
5 changed files with 36 additions and 10 deletions

View file

@ -9,7 +9,7 @@ Component=gb.gui
Component=gb.form
Component=gb.settings
Authors="Benoît Minisini"
Environment="GB_GUI=gb.qt4"
Environment="GB_GUI=gb.gtk"
TabSize=2
Translate=1
Language=en

View file

@ -58,6 +58,8 @@ Private $iShadowS As Integer
Private $iShadowW As Integer
Private $iShadowE As Integer
Static Private $iArrangeCount As Integer
Private Sub LoadFades()
Dim hImage As Image
@ -119,6 +121,9 @@ Public Sub ScrollArea_Arrange()
' Dim hChild As Control
' Dim iMargin As Integer
'Inc $iArrangeCount
'Print Format($iArrangeCount, "###0");; System.Backtrace.Join(" ")
'Debug "ScrollArea:";; Me.W;; Me.H
'Debug "DrawingArea:";; $hDrawingArea.W;; $hDrawingArea.H

View file

@ -137,9 +137,15 @@ int gContainer::_arrangement_level = 0;
void gContainer::performArrange()
{
if (_no_arrangement) return;
if (_no_arrangement)
{
_did_arrangement = true;
return;
}
if (!gApplication::allEvents()) return;
_did_arrangement = false;
//if (!CAN_ARRANGE(this))
// return;
@ -673,3 +679,18 @@ void gContainer::setFullArrangement(gContainerArrangement *arr)
arrangement.locked = locked;
performArrange();
}
void gContainer::disableArrangement()
{
if (_no_arrangement == 0)
_did_arrangement = false;
_no_arrangement++;
}
void gContainer::enableArrangement()
{
_no_arrangement--;
if (_no_arrangement == 0 && _did_arrangement)
performArrange();
}

View file

@ -101,8 +101,8 @@ public:
gContainer *proxyContainer() { return _proxyContainer ? _proxyContainer : this; }
void setProxyContainer(gContainer *proxy) { if (_proxyContainer != this) _proxyContainer = proxy; else _proxyContainer = 0; }
void disableArrangement() { _no_arrangement++; }
void enableArrangement() { _no_arrangement--; }
void disableArrangement();
void enableArrangement();
//"Signals"
void (*onArrange)(gContainer *sender);
@ -122,13 +122,13 @@ public:
void updateFocusChain();
static int _arrangement_level;
private:
void initialize();
gContainerArrangement arrangement;
gContainer *_proxyContainer;
char _no_arrangement;
unsigned _did_arrangement : 1;
unsigned _no_arrangement : 7;
};
#endif

View file

@ -345,11 +345,14 @@ bool gControl::isReallyVisible()
void gControl::setEnabled(bool vl)
{
gtk_widget_set_sensitive (border, vl);
gtk_widget_set_sensitive(border, vl);
}
void gControl::setVisible(bool vl)
{
if (vl == visible)
return;
visible = vl;
if (vl)
@ -551,10 +554,7 @@ void gControl::moveResize(int x, int y, int w, int h)
move(x, y);
if (pr)
{
pr->enableArrangement();
pr->performArrange();
}
}
void gControl::updateGeometry()