本文整理汇总了C++中gtk_widget_get_visual函数的典型用法代码示例。如果您正苦于以下问题:C++ gtk_widget_get_visual函数的具体用法?C++ gtk_widget_get_visual怎么用?C++ gtk_widget_get_visual使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gtk_widget_get_visual函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lv_configure_event
/*!
\brief lv_configure_event() is the logviewer configure event that gets called
whenever the display is resized or created
\param widget is the pointer to widget receiving event
\param event is the pointer to Config event structure
\param data is unused)
\returns FALSE
*/
G_MODULE_EXPORT gboolean lv_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
{
GdkPixmap *pixmap = NULL;
GdkPixmap *pmap = NULL;
GtkAllocation allocation;
GdkWindow *window = gtk_widget_get_window(widget);
gtk_widget_get_allocation(widget,&allocation);
/* Get pointer to backing pixmap ... */
if (!lv_data)
{
lv_data = g_new0(Logview_Data,1);
lv_data->traces = g_hash_table_new(g_str_hash,g_str_equal);
}
pixmap = lv_data->pixmap;
pmap = lv_data->pmap;
if (window)
{
if (pixmap)
g_object_unref(pixmap);
if (pmap)
g_object_unref(pmap);
gint w = allocation.width;
gint h = allocation.height;
pixmap=gdk_pixmap_new(window,
w,h,
gtk_widget_get_visual(widget)->depth);
gdk_draw_rectangle(pixmap,
gtk_widget_get_style(widget)->black_gc,
TRUE, 0,0,
w,h);
pmap=gdk_pixmap_new(window,
w,h,
gtk_widget_get_visual(widget)->depth);
gdk_draw_rectangle(pmap,
gtk_widget_get_style(widget)->black_gc,
TRUE, 0,0,
w,h);
gdk_window_set_back_pixmap(window,pixmap,0);
lv_data->pixmap = pixmap;
lv_data->pmap = pmap;
if ((lv_data->traces) && (g_list_length(lv_data->tlist) > 0))
{
draw_infotext();
trace_update(TRUE);
}
gdk_window_clear(window);
}
return FALSE;
}
开发者ID:bigamil,项目名称:MegaTunix,代码行数:63,代码来源:logviewer_events.c
示例2: pixmaps
/*!
\brief handles configure events when the chart gets created or resized.
Takes care of creating/destroying graphics contexts, backing pixmaps (two
levels are used to split the rendering for speed reasons) colormaps are
also created here as well
\param widget (GtkWidget *) pointer to the chart object
\param event (GdkEventConfigure *) pointer to GDK event datastructure that
encodes important info like window dimensions and depth.
*/
gboolean mtx_stripchart_configure (GtkWidget *widget, GdkEventConfigure *event)
{
MtxStripChart * chart = MTX_STRIPCHART(widget);
MtxStripChartPrivate *priv = MTX_STRIPCHART_GET_PRIVATE(chart);
cairo_t *cr = NULL;
priv->w = widget->allocation.width;
priv->h = widget->allocation.height;
/* Backing pixmap (copy of window) */
if (priv->bg_pixmap)
g_object_unref(priv->bg_pixmap);
priv->bg_pixmap=gdk_pixmap_new(widget->window,
priv->w,priv->h,
gtk_widget_get_visual(widget)->depth);
cr = gdk_cairo_create(priv->bg_pixmap);
cairo_set_operator(cr,CAIRO_OPERATOR_DEST_OUT);
cairo_paint(cr);
cairo_destroy(cr);
/* Trace pixmap */
if (priv->trace_pixmap)
g_object_unref(priv->trace_pixmap);
priv->trace_pixmap=gdk_pixmap_new(widget->window,
priv->w,priv->h,
gtk_widget_get_visual(widget)->depth);
cr = gdk_cairo_create(priv->trace_pixmap);
cairo_set_operator(cr,CAIRO_OPERATOR_DEST_OUT);
cairo_paint(cr);
cairo_destroy(cr);
/* Grat pixmap */
if (priv->grat_pixmap)
g_object_unref(priv->grat_pixmap);
priv->grat_pixmap=gdk_pixmap_new(widget->window,
priv->w,priv->h,
gtk_widget_get_visual(widget)->depth);
cr = gdk_cairo_create(priv->grat_pixmap);
cairo_set_operator(cr,CAIRO_OPERATOR_DEST_OUT);
cairo_paint(cr);
cairo_destroy(cr);
gdk_window_set_back_pixmap(widget->window,priv->bg_pixmap,0);
if (priv->font_options)
cairo_font_options_destroy(priv->font_options);
priv->font_options = cairo_font_options_create();
cairo_font_options_set_antialias(priv->font_options,
CAIRO_ANTIALIAS_GRAY);
generate_stripchart_static_traces(chart);
render_marker (chart);
return TRUE;
}
开发者ID:seank,项目名称:MegaTunix,代码行数:62,代码来源:stripchart-private.c
示例3: gtk_codegraph_realize
void gtk_codegraph_realize(GtkWidget *widget){
GdkWindowAttr attributes;
guint attributes_mask;
g_return_if_fail(widget != NULL);
g_return_if_fail(GTK_IS_CODEGRAPH(widget));
GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
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_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new(
gtk_widget_get_parent_window (widget),
& attributes, attributes_mask);
gdk_window_set_user_data(widget->window, widget );
widget->style = gtk_style_attach(widget->style, widget->window);
gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);
gtk_codegraph_create_backing_pixmap(GTK_CODEGRAPH(widget));
}
开发者ID:boris-r-v,项目名称:STD,代码行数:34,代码来源:gtkcodegraph.c
示例4: pp_layout_nup_pageview_realize
static void
pp_layout_nup_pageview_realize (GtkWidget *widget)
{
pp_Layout_NUp_PageView *pageview;
GdkWindowAttr attributes;
gint attributes_mask;
g_return_if_fail (widget != NULL);
g_return_if_fail (PP_IS_PAGEVIEW (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
pageview = PP_LAYOUT_NUP_PAGEVIEW (widget);
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget) |
GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_user_data (widget->window, widget);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
}
开发者ID:speachy,项目名称:photoprint,代码行数:35,代码来源:pp_layout_nup_pageview.cpp
示例5: classpath_jawt_get_depth
/* Does not require locking: meant to be called after the drawing
surface is locked. */
int
classpath_jawt_get_depth (JNIEnv* env, jobject canvas)
{
GtkWidget *widget;
GdkVisual *visual;
void *ptr;
jobject peer;
jclass class_id;
jmethodID method_id;
class_id = (*env)->GetObjectClass (env, canvas);
method_id = (*env)->GetMethodID (env, class_id,
"getPeer",
"()Ljava/awt/peer/ComponentPeer;");
peer = (*env)->CallObjectMethod (env, canvas, method_id);
ptr = gtkpeer_get_widget (env, peer);
widget = GTK_WIDGET (ptr);
if (GTK_WIDGET_REALIZED (widget))
{
visual = gtk_widget_get_visual (widget);
g_assert (visual != NULL);
return visual->depth;
}
else
return (VisualID) NULL;
}
开发者ID:0day-ci,项目名称:gcc,代码行数:34,代码来源:gtk_jawt.c
示例6: gul_gui_window_present
/** gul_gui_window_present:
* @window: A #GtkWindow
* @user_time: Time of the event that caused the window to
* want to raise
*
* Like gtk_window_present, but doesn't have
* http://bugzilla.gnome.org/show_bug.cgi?id=166379
**/
void
gul_gui_window_present (GtkWindow *window, guint32 user_time)
{
GtkWidget *widget;
g_return_if_fail (GTK_IS_WINDOW (window));
widget = GTK_WIDGET (window);
if (gtk_widget_get_visual (widget))
{
g_assert (widget->window != NULL);
if (user_time == 0)
{
user_time = gtk_get_current_event_time ();
}
gdk_window_show (widget->window);
/* note that gdk_window_focus() will also move the window to
* the current desktop, for WM spec compliant window managers.
*/
gdk_window_focus (widget->window, user_time);
}
else
{
gtk_widget_show (widget);
}
}
开发者ID:GNOME,项目名称:galeon,代码行数:38,代码来源:gul-gui.c
示例7: PLATFORM
std::unique_ptr<BackingStoreBackendCairo> BackingStore::createBackend()
{
#if PLATFORM(GTK) && PLATFORM(X11)
const auto& sharedDisplay = PlatformDisplay::sharedDisplay();
if (is<PlatformDisplayX11>(sharedDisplay)) {
GdkVisual* visual = gtk_widget_get_visual(m_webPageProxy.viewWidget());
GdkScreen* screen = gdk_visual_get_screen(visual);
ASSERT(downcast<PlatformDisplayX11>(sharedDisplay).native() == GDK_SCREEN_XDISPLAY(screen));
return std::make_unique<BackingStoreBackendCairoX11>(downcast<PlatformDisplayX11>(sharedDisplay).native(), GDK_WINDOW_XID(gdk_screen_get_root_window(screen)),
GDK_VISUAL_XVISUAL(visual), gdk_visual_get_depth(visual), m_size, m_deviceScaleFactor);
}
#endif
IntSize scaledSize = m_size;
scaledSize.scale(m_deviceScaleFactor);
#if PLATFORM(GTK)
RefPtr<cairo_surface_t> surface = adoptRef(gdk_window_create_similar_surface(gtk_widget_get_window(m_webPageProxy.viewWidget()),
CAIRO_CONTENT_COLOR_ALPHA, scaledSize.width(), scaledSize.height()));
#else
RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, scaledSize.width(), scaledSize.height()));
#endif
cairoSurfaceSetDeviceScale(surface.get(), m_deviceScaleFactor, m_deviceScaleFactor);
return std::make_unique<BackingStoreBackendCairoImpl>(surface.get(), m_size);
}
开发者ID:fanghongjia,项目名称:JavaScriptCore,代码行数:26,代码来源:BackingStoreCairo.cpp
示例8: load_pixmaps
/** Load/construct the images */
static void load_pixmaps(QuoteView * qv)
{
static gboolean init = FALSE;
int width, height;
GdkPixmap *pixmap;
GdkGC *gc;
if (init)
return;
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
pixmap =
gdk_pixmap_new(qv->quotes->window, width, height,
gtk_widget_get_visual(qv->quotes)->depth);
gc = gdk_gc_new(pixmap);
gdk_gc_set_fill(gc, GDK_TILED);
gdk_gc_set_tile(gc, theme_get_terrain_pixmap(SEA_TERRAIN));
gdk_gc_set_foreground(gc, &black);
gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, width, height);
maritime_pixbuf =
gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL, 0, 0, 0, 0,
-1, -1);
g_object_unref(pixmap);
g_object_unref(gc);
cross_pixbuf =
gtk_widget_render_icon(qv->quotes, GTK_STOCK_CANCEL,
GTK_ICON_SIZE_MENU, NULL);
init = TRUE;
}
开发者ID:jquick,项目名称:pioneers,代码行数:33,代码来源:quote-view.c
示例9: gtk_experiment_transcript_realize
static void
gtk_experiment_transcript_realize(GtkWidget *widget)
{
GdkWindowAttr attributes;
gint attributes_mask;
gtk_widget_set_realized(widget, TRUE);
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events(widget)
| GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
attributes.visual = gtk_widget_get_visual(widget);
attributes.colormap = gtk_widget_get_colormap(widget);
gtk_widget_set_has_window(widget, TRUE);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask);
widget->style = gtk_style_attach(widget->style, widget->window);
gdk_window_set_user_data(widget->window, widget);
gtk_style_set_background(widget->style, widget->window, GTK_STATE_ACTIVE);
gtk_experiment_transcript_reconfigure(GTK_EXPERIMENT_TRANSCRIPT(widget));
}
开发者ID:rhaberkorn,项目名称:experiment-player,代码行数:33,代码来源:gtk-experiment-transcript.c
示例10: git_source_view_realize
static void
git_source_view_realize (GtkWidget *widget)
{
GdkWindowAttr attribs;
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
memset (&attribs, 0, sizeof (attribs));
attribs.x = widget->allocation.x;
attribs.y = widget->allocation.y;
attribs.width = widget->allocation.width;
attribs.height = widget->allocation.height;
attribs.wclass = GDK_INPUT_OUTPUT;
attribs.window_type = GDK_WINDOW_CHILD;
attribs.visual = gtk_widget_get_visual (widget);
attribs.colormap = gtk_widget_get_colormap (widget);
attribs.event_mask = gtk_widget_get_events (widget)
| GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK
| GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attribs,
GDK_WA_X | GDK_WA_Y
| GDK_WA_VISUAL | GDK_WA_COLORMAP);
gdk_window_set_user_data (widget->window, widget);
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (widget->window,
&widget->style->base[GTK_WIDGET_STATE (widget)]);
git_source_view_calculate_line_height (GIT_SOURCE_VIEW (widget));
}
开发者ID:bpeel,项目名称:blame-browse,代码行数:34,代码来源:git-source-view.c
示例11: HILDON_COLOR_CHOOSER_GET_PRIVATE
static void
hildon_color_chooser_realize (GtkWidget *widget)
{
HildonColorChooserPrivate *priv = HILDON_COLOR_CHOOSER_GET_PRIVATE (widget);
g_assert (priv);
GdkWindowAttr attributes;
gint attributes_mask;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_ONLY;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget) |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK |
GDK_BUTTON1_MOTION_MASK;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_WMCLASS;
priv->event_window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
gdk_window_set_user_data (priv->event_window, widget);
GTK_WIDGET_CLASS (parent_class)->realize (widget);
}
开发者ID:bruce721,项目名称:next.vifii.com,代码行数:35,代码来源:hildon-color-chooser.c
示例12: moz_web_view_realize
static void
moz_web_view_realize(GtkWidget *widget)
{
g_return_if_fail(widget != NULL);
g_return_if_fail(MOZ_IS_WEB_VIEW(widget));
MozWebView *view = MOZ_WEB_VIEW(widget);
GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
GdkWindowAttr attributes;
gint attributes_mask;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual(widget);
attributes.colormap = gtk_widget_get_colormap(widget);
attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask);
gdk_window_set_user_data(widget->window, view);
gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);
widget->style = gtk_style_attach (widget->style, widget->window);
}
开发者ID:kerpz,项目名称:Gecko,代码行数:32,代码来源:moz-web-view.cpp
示例13: polygon_view_realize
static void
polygon_view_realize (GtkWidget *widget)
{
GdkWindowAttr attributes;
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget) |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_MOTION_MASK |
GDK_EXPOSURE_MASK;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes,
GDK_WA_X | GDK_WA_Y |
GDK_WA_VISUAL | GDK_WA_COLORMAP);
gdk_window_set_user_data (widget->window, widget);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
}
开发者ID:AZed,项目名称:cairo,代码行数:33,代码来源:show-polygon.c
示例14: gstyle_color_widget_realize
static void
gstyle_color_widget_realize (GtkWidget *widget)
{
GtkAllocation allocation;
GdkWindow *window;
GdkWindowAttr attributes = {0};
g_assert (GTK_IS_WIDGET (widget));
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_set_realized (widget, TRUE);
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.event_mask = gtk_widget_get_events (widget)
| GDK_BUTTON_MOTION_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK;
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL);
gtk_widget_set_window (widget, g_object_ref (window));
gtk_widget_register_window (widget, window);
gdk_window_show (window);
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:33,代码来源:gstyle-color-widget.c
示例15: lcd_realize
/* Called when the widget is realized. This usually happens when you call
* gtk_widget_show() on the widget. */
static void lcd_realize (GtkWidget *widget)
{
Lcd *lcd;
GdkWindowAttr attributes;
gint attr_mask;
g_return_if_fail (widget != NULL);
g_return_if_fail (IS_LCD (widget));
/* Set the GTK_REALIZED flag so it is marked as realized. */
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
lcd = LCD (widget);
/* Create a new GtkWindowAttr object that will hold info about the GdkWindow. */
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= (GDK_EXPOSURE_MASK);
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
/* Create a new GdkWindow for the widget. */
attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (widget->parent->window, &attributes, attr_mask);
gdk_window_set_user_data (widget->window, lcd);
/* Attach a style to the GdkWindow and draw a background color. */
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
gdk_window_show (widget->window);
}
开发者ID:BackupTheBerlios,项目名称:tractasono-svn,代码行数:37,代码来源:lcd.c
示例16: classpath_jawt_get_visualID
VisualID
classpath_jawt_get_visualID (JNIEnv* env, jobject canvas)
{
GtkWidget *widget;
Visual *visual;
void *ptr;
jobject peer;
jclass class_id;
jmethodID method_id;
class_id = (*env)->GetObjectClass (env, canvas);
method_id = (*env)->GetMethodID (env, class_id,
"getPeer",
"()Ljava/awt/peer/ComponentPeer;");
peer = (*env)->CallObjectMethod (env, canvas, method_id);
ptr = NSA_GET_PTR (env, peer);
gdk_threads_enter ();
widget = GTK_WIDGET (ptr);
g_assert (GTK_WIDGET_REALIZED (widget));
visual = gdk_x11_visual_get_xvisual (gtk_widget_get_visual (widget));
g_assert (visual != NULL);
gdk_threads_leave ();
return visual->visualid;
}
开发者ID:BackupTheBerlios,项目名称:iphone-binutils-svn,代码行数:33,代码来源:gtk_jawt.c
示例17: gb_slider_create_child_window
static GdkWindow *
gb_slider_create_child_window (GbSlider *self,
GbSliderChild *child)
{
GtkWidget *widget = (GtkWidget *)self;
GdkWindow *window;
GtkAllocation allocation;
GdkWindowAttr attributes;
gint attributes_mask;
g_assert (GB_IS_SLIDER (self));
g_assert (child != NULL);
gb_slider_compute_child_allocation (self, child, &allocation, NULL);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.visual = gtk_widget_get_visual (widget);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
window = gdk_window_new (gtk_widget_get_window (widget), &attributes, attributes_mask);
gtk_widget_register_window (widget, window);
gtk_widget_set_parent_window (child->widget, window);
return window;
}
开发者ID:MaX121,项目名称:gnome-builder,代码行数:32,代码来源:gb-slider.c
示例18: parent_set_hook
static gboolean
parent_set_hook(GSignalInvocationHint*, guint, const GValue* param_values, void* data)
{
wxGLCanvas* win = (wxGLCanvas*)data;
if (g_value_peek_pointer(¶m_values[0]) == win->m_wxwindow)
{
const XVisualInfo* xvi = (XVisualInfo*)win->m_vi;
GdkVisual* visual = gtk_widget_get_visual(win->m_wxwindow);
if (GDK_VISUAL_XVISUAL(visual)->visualid != xvi->visualid)
{
#if GTK_CHECK_VERSION(2, 2, 0)
if (gtk_check_version(2, 2, 0) == NULL)
{
GdkScreen* screen = gtk_widget_get_screen(win->m_wxwindow);
visual = gdk_x11_screen_lookup_visual(screen, xvi->visualid);
}
else
#endif
{
visual = gdkx_visual_get(xvi->visualid);
}
GdkColormap* colormap = gdk_colormap_new(visual, false);
gtk_widget_set_colormap(win->m_wxwindow, colormap);
g_object_unref(colormap);
}
// remove hook
return false;
}
return true;
}
开发者ID:SCP-682,项目名称:Cities3D,代码行数:30,代码来源:glcanvas.cpp
示例19: cvImageWidget_realize
static void
cvImageWidget_realize (GtkWidget *widget)
{
CvImageWidget *image_widget;
GdkWindowAttr attributes;
gint attributes_mask;
//printf("cvImageWidget_realize\n");
g_return_if_fail (widget != NULL);
g_return_if_fail (CV_IS_IMAGE_WIDGET (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
image_widget = CV_IMAGE_WIDGET (widget);
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget) |
GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_user_data (widget->window, widget);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
}
开发者ID:AlexandreFreitas,项目名称:danfreve-blinkdetection,代码行数:35,代码来源:window_gtk.cpp
示例20: scope_realize
static void scope_realize(GtkWidget *widget)
{
Scope *scope;
GdkWindowAttr attributes;
gint attributes_mask;
GdkGCValues gc_values;
GtkAllocation allocation;
GdkWindow *window;
GtkStyle *style;
g_return_if_fail(widget != NULL);
g_return_if_fail(IS_SCOPE(widget));
scope = SCOPE(widget);
gtk_widget_set_realized(widget, TRUE);
gtk_widget_get_allocation(widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual(widget);
attributes.colormap = gtk_widget_get_colormap(widget);
attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
gtk_widget_set_has_window(widget, TRUE);
window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
gtk_widget_set_window(widget, window);
gdk_window_set_user_data(window, scope);
gtk_widget_style_attach(widget);
style = gtk_widget_get_style(widget);
gtk_style_set_background(style, window, GTK_STATE_NORMAL);
/* gc's if necessary */
if (!gdk_colormap_alloc_color(style->colormap, &scope->tracecol,
FALSE, TRUE))
g_warning("unable to allocate color: ( %d %d %d )",
scope->tracecol.red, scope->tracecol.green, scope->tracecol.blue);
gc_values.foreground = scope->tracecol;
scope->trace_gc = gtk_gc_get(style->depth,
style->colormap,
&gc_values, GDK_GC_FOREGROUND);
if (!gdk_colormap_alloc_color(style->colormap, &scope->gridcol,
FALSE, TRUE))
g_warning("unable to allocate color: ( %d %d %d )",
scope->gridcol.red, scope->gridcol.green, scope->gridcol.blue);
gc_values.foreground = scope->gridcol;
scope->grid_gc = gtk_gc_get(style->depth,
style->colormap,
&gc_values, GDK_GC_FOREGROUND);
/* create backing store */
scope->pixmap = gdk_pixmap_new(window, SCOPE_WIDTH, SCOPE_HEIGHT, -1);
scope_send_configure(SCOPE(widget));
}
开发者ID:coreyreichle,项目名称:soundmodem,代码行数:60,代码来源:scope.c
注:本文中的gtk_widget_get_visual函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论