Learn R Programming

RGtk2 (version 2.12.17)

gdk-Windows: Windows

Description

Onscreen display areas in the target window system

Arguments

Methods and Functions

gdkWindowNew(parent = NULL, attributes) gdkWindowDestroy(object) gdkWindowGetWindowType(object) gdkWindowAtPointer() gdkWindowShow(object) gdkWindowShowUnraised(object) gdkWindowHide(object) gdkWindowIsVisible(object) gdkWindowIsViewable(object) gdkWindowGetState(object) gdkWindowWithdraw(object) gdkWindowIconify(object) gdkWindowDeiconify(object) gdkWindowStick(object) gdkWindowUnstick(object) gdkWindowMaximize(object) gdkWindowUnmaximize(object) gdkWindowFullscreen(object) gdkWindowUnfullscreen(object) gdkWindowSetKeepAbove(object, setting) gdkWindowSetKeepBelow(object, setting) gdkWindowSetOpacity(object, opacity) gdkWindowSetComposited(object, composited) gdkWindowMove(object, x, y) gdkWindowResize(object, width, height) gdkWindowMoveResize(object, x, y, width, height) gdkWindowScroll(object, dx, dy) gdkWindowMoveRegion(object, region, x, y) gdkWindowReparent(object, new.parent, x, y) gdkWindowClear(object) gdkWindowClearArea(object, x, y, width, height) gdkWindowClearAreaE(object, x, y, width, height) gdkWindowRaise(object) gdkWindowLower(object) gdkWindowFocus(object, timestamp = "GDK_CURRENT_TIME") gdkWindowRegisterDnd(object) gdkWindowBeginResizeDrag(object, edge, button, root.x, root.y, timestamp) gdkWindowBeginMoveDrag(object, button, root.x, root.y, timestamp) gdkWindowConstrainSize(geometry, width, height) gdkWindowBeep(object) gdkWindowBeginPaintRect(object, rectangle) gdkWindowBeginPaintRegion(object, region) gdkWindowEndPaint(object) gdkWindowInvalidateRect(object, rect = NULL, invalidate.children) gdkWindowInvalidateRegion(object, region, invalidate.children) gdkWindowInvalidateMaybeRecurse(object, region, child.func, user.data) gdkWindowGetUpdateArea(object) gdkWindowFreezeUpdates(object) gdkWindowThawUpdates(object) gdkWindowProcessAllUpdates() gdkWindowProcessUpdates(object, update.children) gdkWindowSetDebugUpdates(setting) gdkWindowGetInternalPaintInfo(object) gdkWindowEnableSynchronizedConfigure(object) gdkWindowConfigureFinished(object) gdkWindowSetUserData(object, user.data = NULL) gdkWindowSetOverrideRedirect(object, override.redirect) gdkWindowSetAcceptFocus(object, accept.focus) gdkWindowSetFocusOnMap(object, focus.on.map) gdkWindowAddFilter(object, fun, data) gdkWindowRemoveFilter(object, fun, data) gdkWindowShapeCombineMask(object, shape.mask = NULL, offset.x, offset.y) gdkWindowShapeCombineRegion(object, shape.region = NULL, offset.x, offset.y) gdkWindowSetChildShapes(object) gdkWindowMergeChildShapes(object) gdkWindowInputShapeCombineMask(object, mask, x, y) gdkWindowInputShapeCombineRegion(object, shape.region, offset.x, offset.y) gdkWindowSetChildInputShapes(object) gdkWindowMergeChildInputShapes(object) gdkWindowSetStaticGravities(object, use.static) gdkWindowSetHints(object, x, y, min.width, min.height, max.width, max.height, flags) gdkWindowSetTitle(object, title) gdkWindowSetBackground(object, color) gdkWindowSetBackPixmap(object, pixmap = NULL, parent.relative) gdkWindowSetCursor(object, cursor = NULL) gdkWindowGetUserData(object) gdkWindowGetGeometry(object) gdkWindowSetGeometryHints(object, geometry) gdkWindowSetIconList(object, pixbufs) gdkWindowSetModalHint(object, modal) gdkWindowSetTypeHint(object, hint) gdkWindowGetTypeHint(object) gdkWindowSetSkipTaskbarHint(object, modal) gdkWindowSetSkipPagerHint(object, modal) gdkWindowSetUrgencyHint(object, urgent) gdkWindowGetPosition(object) gdkWindowGetRootOrigin(object) gdkWindowGetFrameExtents(object) gdkWindowGetOrigin(object) gdkWindowGetDeskrelativeOrigin(object) gdkWindowGetPointer(object) gdkWindowGetParent(object) gdkWindowGetToplevel(object) gdkWindowGetChildren(object) gdkWindowPeekChildren(object) gdkWindowGetEvents(object) gdkWindowSetEvents(object, event.mask) gdkWindowSetIcon(object, icon.window, pixmap, mask) gdkWindowSetIconName(object, name) gdkWindowSetTransientFor(object, leader) gdkWindowSetRole(object, role) gdkWindowSetStartupId(object, startup.id) gdkWindowSetGroup(object, leader) gdkWindowGetGroup(object) gdkWindowSetDecorations(object, decorations) gdkWindowGetDecorations(object) gdkWindowSetFunctions(object, functions) gdkWindowGetToplevels() gdkGetDefaultRootWindow() gdkSetPointerHooks(object, new.hooks) gdkWindow(parent = NULL, attributes)

Hierarchy

GObject +----GdkDrawable +----GdkWindow

Detailed Description

A GdkWindow is a rectangular region on the screen. It's a low-level object, used to implement high-level objects such as GtkWidget and GtkWindow on the GTK+ level. A GtkWindow is a toplevel window, the thing a user might think of as a "window" with a titlebar and so on; a GtkWindow may contain many GdkWindow. For example, each GtkButton has a GdkWindow associated with it. Composited windows # The expose event handler for the event box. # # This function simply draws a transparency onto a widget on the area # for which it receives expose events. This is intended to give the # event box a "transparent" background. # # In order for this to work properly, the widget must have an RGBA # colormap. The widget should also be set as app-paintable since it # doesn't make sense for GTK+ to draw a background if we are drawing it # (and because GTK+ might actually replace our transparency with its # default background color). # transparent_expose <- function(widget, event) { cr <- gdkCairoCreate(widget$window) cr$setOperator("clear") gdkCairoRegion(cr, event$region) cr$fill()

return(FALSE) }

# The expose event handler for the window. # # This function performs the actual compositing of the event box onto # the already-existing background of the window at 50% normal opacity. # # In this case we do not want app-paintable to be set on the widget # since we want it to draw its own (red) background. Because of this, # however, we must ensure that we set after = TRUE when connecting to the signal # so that this handler is called after the red has been drawn. If it was # called before then GTK would just blindly paint over our work. # # Note: if the child window has children, then you need a cairo 1.16 # feature to make this work correctly. #

window_expose_event <- function(widget, event) { # get our child (in this case, the event box) child <- widget$getChild()

# create a cairo context to draw to the window cr <- gdkCairoCreate(widget$window)

# the source data is the (composited) event box gdkCairoSetSourcePixmap(cr, child$window, child$allocation$x, child$allocation$y)

# draw no more than our expose event intersects our child region <- gdkRegionRectangle(child$allocation) region$intersect(event$region) gdkCairoRegion(cr, region) cr$clip()

# composite, with a 50% opacity cr$setOperator("over") cr$paintWithAlpha(0.5)

return(FALSE) }

# Make the widgets button <- gtkButton("A Button") event <- gtkEventBox() window <- gtkWindow()

# Put a red background on the window red <- gdkColorParse("red")$color window$modifyBg("normal", red)

# Set the colormap for the event box. # Must be done before the event box is realized. # screen <- event$getScreen() rgba <- screen$getRgbaColormap() event$setColormap(rgba)

# Set our event box to have a fully-transparent background # drawn on it. Currently there is no way to simply tell GTK+ # that "transparency" is the background color for a widget. # event$setAppPaintable(TRUE) gSignalConnect(event, "expose-event", transparent_expose)

# Put them inside one another window$setBorderWidth(10) window$add(event) event$add(button)

# Set the event box GdkWindow to be composited. # Obviously must be performed after event box is realized. # event$window$setComposited(TRUE)

# Set up the compositing handler. # Note that we do _after_ so that the normal (red) background is drawn # by gtk before our compositing occurs. # gSignalConnect(window, "expose-event", window_expose_event, after = TRUE) In the example , a button is placed inside of an event box inside of a window. The event box is set as composited and therefore is no longer automatically drawn to the screen. When the contents of the event box change, an expose event is generated on its parent window (which, in this case, belongs to the toplevel GtkWindow). The expose handler for this widget is responsible for merging the changes back on the screen in the way that it wishes. In our case, we merge the contents with a 50% transparency. We also set the background colour of the window to red. The effect is that the background shows through the button.

Convenient Construction

gdkWindow is the equivalent of gdkWindowNew.

References

http://developer.gnome.org/doc/API/2.0/gdk/gdk-Windows.html