#include "gtkmain.h"
#include "gtkmarshalers.h"
+#include "gtksizerequest.h"
#include "gtkwin32embedwidget.h"
#include "gtkintl.h"
#include "gtkprivate.h"
+#include "gtkwindowprivate.h"
static void gtk_win32_embed_widget_realize (GtkWidget *widget);
window = GTK_WINDOW (embed_widget);
- window->type = GTK_WINDOW_TOPLEVEL;
-
_gtk_widget_set_is_toplevel (GTK_WIDGET (embed_widget), TRUE);
gtk_container_set_resize_mode (GTK_CONTAINER (embed_widget), GTK_RESIZE_QUEUE);
}
GtkWidget*
-_gtk_win32_embed_widget_new (GdkNativeWindow parent_id)
+_gtk_win32_embed_widget_new (HWND parent)
{
GtkWin32EmbedWidget *embed_widget;
embed_widget = g_object_new (GTK_TYPE_WIN32_EMBED_WIDGET, NULL);
embed_widget->parent_window =
- gdk_window_lookup_for_display (gdk_display_get_default (),
- parent_id);
+ gdk_win32_window_lookup_for_display (gdk_display_get_default (),
+ parent);
if (!embed_widget->parent_window)
embed_widget->parent_window =
- gdk_window_foreign_new_for_display (gdk_display_get_default (),
- parent_id);
+ gdk_win32_window_foreign_new_for_display (gdk_display_get_default (),
+ parent);
return GTK_WIDGET (embed_widget);
}
GtkWin32EmbedWidget *embed_widget;
gpointer user_data;
- window = gdk_window_lookup ((GdkNativeWindow)hwnd);
+ window = gdk_win32_window_lookup_for_display (gdk_display_get_default (), hwnd);
if (window == NULL) {
g_warning ("No such window!");
return 0;
GtkRequisition requisition;
GtkAllocation allocation = { 0, 0, 200, 200 };
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (requisition.width || requisition.height)
{
/* non-empty window */
gtk_widget_get_allocation (widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD;
- attributes.title = window->title;
- attributes.wmclass_name = window->wmclass_name;
- attributes.wmclass_class = window->wmclass_class;
+ attributes.title = gtk_window_get_title (window);
+ _gtk_window_get_wmclass (window, &attributes.wmclass_name, &attributes.wmclass_class);
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
/* this isn't right - we should match our parent's visual/colormap.
* though that will require handling "foreign" colormaps */
attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= (GDK_EXPOSURE_MASK |
GDK_KEY_PRESS_MASK |
GDK_STRUCTURE_MASK |
GDK_FOCUS_CHANGE_MASK);
- attributes_mask = GDK_WA_VISUAL | GDK_WA_COLORMAP;
- attributes_mask |= (window->title ? GDK_WA_TITLE : 0);
- attributes_mask |= (window->wmclass_name ? GDK_WA_WMCLASS : 0);
+ attributes_mask = GDK_WA_VISUAL;
+ attributes_mask |= (gtk_window_get_title (window) ? GDK_WA_TITLE : 0);
+ attributes_mask |= (attributes.wmclass_name ? GDK_WA_WMCLASS : 0);
gdk_window = gdk_window_new (embed_widget->parent_window,
&attributes, attributes_mask);
styles = GetWindowLongPtr(GDK_WINDOW_HWND (gdk_window), GWL_STYLE);
SetWindowLongPtrW(GDK_WINDOW_HWND (gdk_window), GWL_STYLE, styles | WS_TABSTOP);
- gtk_widget_style_attach (widget);
- gtk_style_set_background (gtk_widget_get_style (widget), gdk_window, GTK_STATE_NORMAL);
+ gtk_style_context_set_background (gtk_widget_get_style_context (widget),
+ gdk_window);
}
static void
gtk_win32_embed_widget_show (GtkWidget *widget)
{
- GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
+ gtk_widget_set_visible (widget, TRUE);
gtk_widget_realize (widget);
gtk_container_check_resize (GTK_CONTAINER (widget));
static void
gtk_win32_embed_widget_hide (GtkWidget *widget)
{
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
+ gtk_widget_set_visible (widget, FALSE);
gtk_widget_unmap (widget);
}
if (gtk_widget_child_focus (old_focus_child, direction))
return TRUE;
- if (window->focus_widget)
+ if (gtk_window_get_focus (window))
{
/* Wrapped off the end, clear the focus setting for the toplevel */
- parent = gtk_widget_get_parent (window->focus_widget);
+ parent = gtk_widget_get_parent (gtk_window_get_focus (window));
while (parent)
{
gtk_container_set_focus_child (GTK_CONTAINER (parent), NULL);