[GB.GTK]
* BUG: Embedded windows can now be reparented to NULL to become top-level again. * BUG: Showing a top-level window now raises it automatically. git-svn-id: svn://localhost/gambas/trunk@6280 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
ff0b3750dc
commit
9f5c1f4bd6
5 changed files with 31 additions and 12 deletions
|
@ -137,12 +137,12 @@ static void cb_hide(gMenu *sender)
|
||||||
GB.Raise(THIS, EVENT_Hide, 0);
|
GB.Raise(THIS, EVENT_Hide, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_METHOD_VOID(CMENU_init)
|
/*BEGIN_METHOD_VOID(CMENU_init)
|
||||||
|
|
||||||
CLASS_Menu = GB.FindClass("Menu");
|
CLASS_Menu = GB.FindClass("Menu");
|
||||||
CLASS_Window = GB.FindClass("Window");
|
CLASS_Window = GB.FindClass("Window");
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD*/
|
||||||
|
|
||||||
|
|
||||||
BEGIN_METHOD(CMENU_new, GB_OBJECT parent; GB_BOOLEAN hidden)
|
BEGIN_METHOD(CMENU_new, GB_OBJECT parent; GB_BOOLEAN hidden)
|
||||||
|
@ -463,7 +463,7 @@ GB_DESC CMenuDesc[] =
|
||||||
GB_DECLARE("Menu", sizeof(CMENU)),
|
GB_DECLARE("Menu", sizeof(CMENU)),
|
||||||
GB_HOOK_CHECK(CMENU_check),
|
GB_HOOK_CHECK(CMENU_check),
|
||||||
|
|
||||||
GB_STATIC_METHOD("_init", 0, CMENU_init, 0),
|
//GB_STATIC_METHOD("_init", 0, CMENU_init, 0),
|
||||||
GB_METHOD("_new", 0, CMENU_new, "(Parent)o[(Hidden)b]"),
|
GB_METHOD("_new", 0, CMENU_new, "(Parent)o[(Hidden)b]"),
|
||||||
GB_METHOD("_free", 0, CMENU_free, 0),
|
GB_METHOD("_free", 0, CMENU_free, 0),
|
||||||
|
|
||||||
|
|
|
@ -622,11 +622,14 @@ END_METHOD
|
||||||
|
|
||||||
BEGIN_METHOD(CWIDGET_reparent, GB_OBJECT parent; GB_INTEGER x; GB_INTEGER y)
|
BEGIN_METHOD(CWIDGET_reparent, GB_OBJECT parent; GB_INTEGER x; GB_INTEGER y)
|
||||||
|
|
||||||
CCONTAINER *parent=(CCONTAINER*)VARG(parent);
|
CCONTAINER *parent = (CCONTAINER*)VARG(parent);
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (GB.CheckObject(parent))
|
if (parent || !GB.Is(THIS, CLASS_Window))
|
||||||
return;
|
{
|
||||||
|
if (GB.CheckObject(parent))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
x = CONTROL->x();
|
x = CONTROL->x();
|
||||||
y = CONTROL->y();
|
y = CONTROL->y();
|
||||||
|
@ -637,7 +640,7 @@ BEGIN_METHOD(CWIDGET_reparent, GB_OBJECT parent; GB_INTEGER x; GB_INTEGER y)
|
||||||
y = VARG(y);
|
y = VARG(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
CONTROL->reparent((gContainer*)parent->ob.widget, x, y);
|
CONTROL->reparent(parent ? (gContainer*)parent->ob.widget : NULL, x, y);
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,7 @@ END_METHOD
|
||||||
|
|
||||||
BEGIN_METHOD_VOID(CWINDOW_show)
|
BEGIN_METHOD_VOID(CWINDOW_show)
|
||||||
|
|
||||||
WINDOW->show();
|
WINDOW->showActivate();
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
|
|
@ -787,6 +787,15 @@ void gMainWindow::showPopup(int x, int y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gMainWindow::showActivate()
|
||||||
|
{
|
||||||
|
bool v = isTopLevel() && isVisible();
|
||||||
|
|
||||||
|
show();
|
||||||
|
if (v)
|
||||||
|
gtk_window_present(GTK_WINDOW(border));
|
||||||
|
}
|
||||||
|
|
||||||
void gMainWindow::showPopup()
|
void gMainWindow::showPopup()
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
@ -1163,6 +1172,7 @@ void gMainWindow::reparent(gContainer *newpr, int x, int y)
|
||||||
w = width();
|
w = width();
|
||||||
h = height();
|
h = height();
|
||||||
bufW = bufH = -1;
|
bufW = bufH = -1;
|
||||||
|
gtk_widget_set_size_request(border, 1, 1);
|
||||||
resize(w, h);
|
resize(w, h);
|
||||||
|
|
||||||
hideHiddenChildren();
|
hideHiddenChildren();
|
||||||
|
@ -1307,9 +1317,9 @@ void gMainWindow::setActiveWindow(gControl *control)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GDK_WINDOWING_X11
|
#ifdef GDK_WINDOWING_X11
|
||||||
bool gMainWindow::isUtility()
|
bool gMainWindow::isUtility() const
|
||||||
{
|
{
|
||||||
return gtk_window_get_type_hint(GTK_WINDOW(border)) == GDK_WINDOW_TYPE_HINT_UTILITY;
|
return _utility;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gMainWindow::setUtility(bool v)
|
void gMainWindow::setUtility(bool v)
|
||||||
|
@ -1317,16 +1327,20 @@ void gMainWindow::setUtility(bool v)
|
||||||
if (!isTopLevel())
|
if (!isTopLevel())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// TODO: works only if the window is not mapped!
|
||||||
|
|
||||||
|
_utility = v;
|
||||||
gtk_window_set_type_hint(GTK_WINDOW(border), v ? GDK_WINDOW_TYPE_HINT_UTILITY : GDK_WINDOW_TYPE_HINT_NORMAL);
|
gtk_window_set_type_hint(GTK_WINDOW(border), v ? GDK_WINDOW_TYPE_HINT_UTILITY : GDK_WINDOW_TYPE_HINT_NORMAL);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
bool gMainWindow::isUtility()
|
bool gMainWindow::isUtility()
|
||||||
{
|
{
|
||||||
return false;
|
return _utility;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gMainWindow::setUtility(bool v)
|
void gMainWindow::setUtility(bool v)
|
||||||
{
|
{
|
||||||
|
_utility = v;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
//"Properties"
|
//"Properties"
|
||||||
bool hasBorder();
|
bool hasBorder();
|
||||||
bool isResizable();
|
bool isResizable();
|
||||||
bool isUtility();
|
bool isUtility() const;
|
||||||
gPicture *icon() { return _icon; }
|
gPicture *icon() { return _icon; }
|
||||||
gPicture *picture() { return _picture; }
|
gPicture *picture() { return _picture; }
|
||||||
bool mask() { return _mask; }
|
bool mask() { return _mask; }
|
||||||
|
@ -100,6 +100,7 @@ public:
|
||||||
|
|
||||||
//"Methods"
|
//"Methods"
|
||||||
void center();
|
void center();
|
||||||
|
void showActivate();
|
||||||
void showModal();
|
void showModal();
|
||||||
void showPopup();
|
void showPopup();
|
||||||
void showPopup(int x, int y);
|
void showPopup(int x, int y);
|
||||||
|
@ -182,6 +183,7 @@ public:
|
||||||
unsigned _maximized : 1;
|
unsigned _maximized : 1;
|
||||||
unsigned _minimized : 1;
|
unsigned _minimized : 1;
|
||||||
unsigned _fullscreen : 1;
|
unsigned _fullscreen : 1;
|
||||||
|
unsigned _utility : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue