diff --git a/gb.gtk/src/CContainer.cpp b/gb.gtk/src/CContainer.cpp index 4df3772c5..af43d2a5d 100644 --- a/gb.gtk/src/CContainer.cpp +++ b/gb.gtk/src/CContainer.cpp @@ -169,6 +169,13 @@ static void get_client_area(gContainer *cont, int *x, int *y, int *w, int *h) } } +void CUSERCONTROL_cb_resize(gContainer *sender) +{ + CWIDGET *_object = GetObject(sender); + CALL_FUNCTION(THIS_USERCONTROL, resize_func); +} + +//------------------------------------------------------------------------- BEGIN_PROPERTY(Container_ClientX) @@ -494,6 +501,8 @@ BEGIN_METHOD(UserControl_new, GB_OBJECT parent) THIS_USERCONTROL->font_func = func.index; if (!GB.GetFunction(&func, THIS, "UserControl_Change", NULL, NULL)) THIS_USERCONTROL->change_func = func.index; + if (!GB.GetFunction(&func, THIS, "UserControl_Resize", NULL, NULL)) + THIS_USERCONTROL->resize_func = func.index; } GB.Error(NULL); diff --git a/gb.gtk/src/CContainer.h b/gb.gtk/src/CContainer.h index 8dce0c5b6..47f8994ec 100644 --- a/gb.gtk/src/CContainer.h +++ b/gb.gtk/src/CContainer.h @@ -95,6 +95,7 @@ typedef ushort paint_func; ushort font_func; ushort change_func; + ushort resize_func; } CUSERCONTROL; diff --git a/gb.gtk/src/gcontainer.cpp b/gb.gtk/src/gcontainer.cpp index 1ee777106..f83c8d23e 100644 --- a/gb.gtk/src/gcontainer.cpp +++ b/gb.gtk/src/gcontainer.cpp @@ -781,6 +781,9 @@ bool gContainer::resize(int w, int h, bool no_decide) _client_w = 0; _client_h = 0; + if (arrangement.paint) + CUSERCONTROL_cb_resize(this); + performArrange(); return false; } diff --git a/gb.gtk/src/gcontainer.h b/gb.gtk/src/gcontainer.h index 553d85406..0990805da 100644 --- a/gb.gtk/src/gcontainer.h +++ b/gb.gtk/src/gcontainer.h @@ -32,6 +32,7 @@ void CUSERCONTROL_cb_draw(gContainer *sender, cairo_t *cr); void CUSERCONTROL_cb_draw(gContainer *sender, GdkRegion *region, int dx, int dy); #endif void CUSERCONTROL_cb_font(gContainer *sender); +void CUSERCONTROL_cb_resize(gContainer *sender); struct gContainerArrangement { diff --git a/gb.gtk/src/gtools.cpp b/gb.gtk/src/gtools.cpp index 5ceac3631..adf9e50f0 100644 --- a/gb.gtk/src/gtools.cpp +++ b/gb.gtk/src/gtools.cpp @@ -2119,7 +2119,7 @@ const char *gt_get_style_class(GType type) GtkStyleContext *gt_get_style(GType type, const char *node, const char *more_klass) { - int index; + int index = 0; GtkStyleContext *style; if (!node && !more_klass) @@ -2150,7 +2150,7 @@ GtkStyleContext *gt_get_style(GType type, const char *node, const char *more_kla gtk_widget_path_append_type(path, type); gtk_widget_path_iter_set_object_name(path, 1, node); } -#endif + #endif gtk_style_context_set_path(style, path); diff --git a/gb.qt4/src/CContainer.cpp b/gb.qt4/src/CContainer.cpp index 945654136..c6f0cdbe2 100644 --- a/gb.qt4/src/CContainer.cpp +++ b/gb.qt4/src/CContainer.cpp @@ -915,50 +915,11 @@ void MyContainer::changeEvent(QEvent *e) } } - -/*void MyContainer::childEvent(QChildEvent *e) +void MyContainer::resizeEvent(QResizeEvent *e) { - //void *_object = CWidget::get(this); - void *child; - //qDebug("MyContainer::childEvent %p", CWidget::get(this)); - - QFrame::childEvent(e); - - if (!e->child()->isWidgetType()) - return; - - child = CWidget::get((QWidget *)e->child()); - - if (e->added()) - { - //e->child()->installEventFilter(this); - //qApp->sendEvent(WIDGET, new QEvent(EVENT_INSERT)); - //if (THIS_ARRANGEMENT->user) - // GB.Raise(THIS, EVENT_Insert, 1, GB_T_OBJECT, child); - } - else if (e->removed()) - { - //e->child()->removeEventFilter(this); - //if (THIS_ARRANGEMENT->user) - // GB.Raise(THIS, EVENT_Remove, 1, GB_T_OBJECT, child); - } - - arrange_later(this); -}*/ - -/*bool MyContainer::eventFilter(QObject *o, QEvent *e) -{ - int type = e->type(); - - if (type == QEvent::Move || type == QEvent::Resize || type == QEvent::Show || type == QEvent::Hide || type == EVENT_EXPAND) - { - CWIDGET *ob = CWidget::getReal(o); - if (ob && (type == EVENT_EXPAND || !ob->flag.ignore)) - arrange_now(this); - } - - return QObject::eventFilter(o, e); -}*/ + void *_object = CWidget::get(this); + CALL_FUNCTION(THIS_USERCONTROL, resize_func); +} /*************************************************************************** @@ -1295,6 +1256,8 @@ BEGIN_METHOD(UserControl_new, GB_OBJECT parent) THIS_USERCONTROL->font_func = func.index; if (!GB.GetFunction(&func, THIS, "UserControl_Change", NULL, NULL)) THIS_USERCONTROL->change_func = func.index; + if (!GB.GetFunction(&func, THIS, "UserControl_Resize", NULL, NULL)) + THIS_USERCONTROL->resize_func = func.index; } GB.Error(NULL); diff --git a/gb.qt4/src/CContainer.h b/gb.qt4/src/CContainer.h index 8167516b4..54fec5451 100644 --- a/gb.qt4/src/CContainer.h +++ b/gb.qt4/src/CContainer.h @@ -83,6 +83,7 @@ typedef ushort paint_func; ushort font_func; ushort change_func; + ushort resize_func; } CUSERCONTROL; @@ -188,6 +189,7 @@ protected: virtual void hideEvent(QHideEvent *); virtual void paintEvent(QPaintEvent *); virtual void changeEvent(QEvent *); + virtual void resizeEvent(QResizeEvent *); }; #endif