UserControl: Call the UserControl_Resize() public method on resize.

[GB.GTK]
* NEW: UserControl: Call the UserControl_Resize() public method on resize.

[GB.GTK3]
* NEW: UserControl: Call the UserControl_Resize() public method on resize.

[GB.QT4]
* NEW: UserControl: Call the UserControl_Resize() public method on resize.

[GB.QT5]
* NEW: UserControl: Call the UserControl_Resize() public method on resize.
This commit is contained in:
Benoît Minisini 2022-12-20 21:45:29 +01:00
parent 2123d65926
commit af8f28e0e4
7 changed files with 24 additions and 45 deletions

View File

@ -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);

View File

@ -95,6 +95,7 @@ typedef
ushort paint_func;
ushort font_func;
ushort change_func;
ushort resize_func;
}
CUSERCONTROL;

View File

@ -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;
}

View File

@ -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
{

View File

@ -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);

View File

@ -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);

View File

@ -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