GtkImage                package:RGtk2                R Documentation

_G_t_k_I_m_a_g_e

_D_e_s_c_r_i_p_t_i_o_n:

     A widget displaying an image

_M_e_t_h_o_d_s _a_n_d _F_u_n_c_t_i_o_n_s:

     'gtkImageGetIconSet(object)'
      'gtkImageGetImage(object)'
      'gtkImageGetPixbuf(object)'
      'gtkImageGetPixmap(object)'
      'gtkImageGetStock(object)'
      'gtkImageGetAnimation(object)'
      'gtkImageGetIconName(object)'
      'gtkImageGetStorageType(object)'
      'gtkImageNewFromFile(filename, show = TRUE)'
      'gtkImageNewFromIconSet(icon.set, size, show = TRUE)'
      'gtkImageNewFromImage(image = NULL, mask = NULL, show = TRUE)'
      'gtkImageNewFromPixbuf(pixbuf = NULL, show = TRUE)'
      'gtkImageNewFromPixmap(pixmap = NULL, mask = NULL, show = TRUE)'
      'gtkImageNewFromStock(stock.id, size, show = TRUE)'
      'gtkImageNewFromAnimation(animation, show = TRUE)'
      'gtkImageNewFromIconName(icon.name, size)'
      'gtkImageSetFromFile(object, filename = NULL)'
      'gtkImageSetFromIconSet(object, icon.set, size)'
      'gtkImageSetFromImage(object, gdk.image = NULL, mask = NULL)'
      'gtkImageSetFromPixbuf(object, pixbuf = NULL)'
      'gtkImageSetFromPixmap(object, pixmap, mask = NULL)'
      'gtkImageSetFromStock(object, stock.id, size)'
      'gtkImageSetFromAnimation(object, animation)'
      'gtkImageSetFromIconName(object, icon.name, size)'
      'gtkImageClear(object)'
      'gtkImageNew(show = TRUE)'
      'gtkImageSet(object, val, mask)'
      'gtkImageGet(object)'
      'gtkImageSetPixelSize(object, pixel.size)'
      'gtkImageGetPixelSize(object)'
      'gtkImage(mask = NULL, size, pixmap = NULL, image = NULL,
     filename, pixbuf = NULL, stock.id, icon.set, animation, show =
     TRUE)'

_H_i_e_r_a_r_c_h_y:

     GObject
        +----GInitiallyUnowned
              +----GtkObject
                    +----GtkWidget
                          +----GtkMisc
                                +----GtkImage 

_I_n_t_e_r_f_a_c_e_s:

     GtkImage implements AtkImplementorIface and  'GtkBuildable'.

_D_e_t_a_i_l_e_d _D_e_s_c_r_i_p_t_i_o_n:

     The 'GtkImage' widget displays an image. Various kinds of object 
     can be displayed as an image; most typically, you would load a 
     'GdkPixbuf' ("pixel buffer") from a file, and then display that. 
     There's a convenience function to do this, 'gtkImageNewFromFile',
     used as follows:


     image <- gtkImageNewFromFile("myfile.png")
     # or, perhaps more conveniently
     image <- gtkImage(file="myfile.png")

     If the file isn't loaded successfully, the image will contain a
     "broken image" icon similar to that used in many web browsers. If
     you want to handle errors in loading the file yourself,  for
     example by displaying an error message, then load the image with
     'gdkPixbufNewFromFile', then create the 'GtkImage' with 
     'gtkImageNewFromPixbuf'.

     The image file may contain an animation, if so the 'GtkImage' will
      display an animation ('GdkPixbufAnimation') instead of a static
     image. 'GtkImage' is a subclass of 'GtkMisc', which implies that
     you can  align it (center, left, right) and add padding to it,
     using  'GtkMisc' methods. 'GtkImage' is a "no window" widget (has
     no 'GdkWindow' of its own),  so by default does not receive
     events. If you want to receive events on the image, such as button
     clicks, place the image inside a  'GtkEventBox', then connect to
     the event signals on the event box.

     _Handling button press events on a  'GtkImage'  ._


     # Handling button-press events on a GtkImage
     button_press_callback <- function(event_box, event, data) {
       print(paste("Event box clicked at coordinates ", event[["x"]],
     ",",
                   event[["y"]], sep=""))

       ## Returning TRUE means we handled the event, so the signal 
       ## emission should be stopped (don't call any further 
       ## callbacks that may be connected). Return FALSE
       ## to continue invoking callbacks.

       return(TRUE)
     }

     create_image <- function() {
       image <- gtkImage(file="myfile.png")

       event_box <- gtkEventBox()
       event_box$add(image)


       gSignalConnect(event_box, "button_press_event",
     button_press_callback, image)

       return(image)
     }

     When handling events on the event box, keep in mind that
     coordinates in the image may be different from event box
     coordinates due to  the alignment and padding settings on the
     image (see 'GtkMisc').  The simplest way to solve this is to set
     the alignment to 0.0 (left/top), and set the padding to zero. Then
     the origin of  the image will be the same as the origin of the
     event box.

     Sometimes an application will want to avoid depending on external
     data files, such as image files. GTK+ comes with a program to
     avoid this, called 'gdk-pixbuf-csource'. This program allows you
     to convert an image into a C variable declaration, which can then
     be loaded into a 'GdkPixbuf' using 'gdkPixbufNewFromInline()'.

_S_t_r_u_c_t_u_r_e_s:


     '_G_t_k_I_m_a_g_e' This struct contain private data only and should be
          accessed by the functions below.


_C_o_n_v_e_n_i_e_n_t _C_o_n_s_t_r_u_c_t_i_o_n:

     'gtkImage' is the result of collapsing the constructors of
     'GtkImage' ('gtkImageNew', 'gtkImageNewFromPixmap',
     'gtkImageNewFromImage', 'gtkImageNewFromFile',
     'gtkImageNewFromPixbuf', 'gtkImageNewFromStock',
     'gtkImageNewFromIconSet', 'gtkImageNewFromAnimation') and accepts
     a subset of its arguments matching the required arguments of one
     of its delegate constructors.

_E_n_u_m_s _a_n_d _F_l_a_g_s:


     '_G_t_k_I_m_a_g_e_T_y_p_e' Describes the image data representation used by a
          'GtkImage'. If you want to get the image from the widget, you
          can only get the currently-stored representation. e.g.  if
          the 'gtkImageGetStorageType' returns 'GTK_IMAGE_PIXBUF', then
          you can call 'gtkImageGetPixbuf' but not 'gtkImageGetStock'. 
          For empty images, you can request any storage type (call any
          of the "get" functions), but they will all return 'NULL'
          values.

          '_e_m_p_t_y' there is no image displayed by the widget

          '_p_i_x_m_a_p' the widget contains a 'GdkPixmap'

          '_i_m_a_g_e' the widget contains a 'GdkImage'

          '_p_i_x_b_u_f' the widget contains a 'GdkPixbuf'

          '_s_t_o_c_k' the widget contains a stock icon name (see )

          '_i_c_o_n-_s_e_t' the widget contains a 'GtkIconSet'

          '_a_n_i_m_a_t_i_o_n' the widget contains a 'GdkPixbufAnimation'


_P_r_o_p_e_r_t_i_e_s:


     '_f_i_l_e' [_c_h_a_r_a_c_t_e_r : _R_e_a_d / _W_r_i_t_e] Filename to load and display. 
          Default value: NULL


     '_i_c_o_n-_n_a_m_e' [_c_h_a_r_a_c_t_e_r : _R_e_a_d / _W_r_i_t_e] The name of the icon in the
          icon theme. If the icon theme is changed, the image will be
          updated automatically.  

          Default value: NULL  Since  2.6


     '_i_c_o_n-_s_e_t' ['_G_t_k_I_c_o_n_S_e_t' : _R_e_a_d / _W_r_i_t_e] Icon set to display.


     '_i_c_o_n-_s_i_z_e' [_i_n_t_e_g_e_r : _R_e_a_d / _W_r_i_t_e] Symbolic size to use for
          stock icon, icon set or named icon.  Allowed values: >= 0 
          Default value: 4


     '_i_m_a_g_e' ['_G_d_k_I_m_a_g_e' : _R_e_a_d / _W_r_i_t_e] A GdkImage to display.


     '_m_a_s_k' ['_G_d_k_P_i_x_m_a_p' : _R_e_a_d / _W_r_i_t_e] Mask bitmap to use with
          GdkImage or GdkPixmap.


     '_p_i_x_b_u_f' ['_G_d_k_P_i_x_b_u_f' : _R_e_a_d / _W_r_i_t_e] A GdkPixbuf to display.


     '_p_i_x_b_u_f-_a_n_i_m_a_t_i_o_n' ['_G_d_k_P_i_x_b_u_f_A_n_i_m_a_t_i_o_n' : _R_e_a_d / _W_r_i_t_e] 
          GdkPixbufAnimation to display.


     '_p_i_x_e_l-_s_i_z_e' [_i_n_t_e_g_e_r : _R_e_a_d / _W_r_i_t_e] The "pixel-size" property
          can be used to specify a fixed size overriding the
          '"icon-size"' property for images of type 
          'GTK_IMAGE_ICON_NAME'.  

          Allowed values: >= -1  Default value: -1  Since  2.6


     '_p_i_x_m_a_p' ['_G_d_k_P_i_x_m_a_p' : _R_e_a_d / _W_r_i_t_e] A GdkPixmap to display.


     '_s_t_o_c_k' [_c_h_a_r_a_c_t_e_r : _R_e_a_d / _W_r_i_t_e] Stock ID for a stock image to
          display.  Default value: NULL


     '_s_t_o_r_a_g_e-_t_y_p_e' ['_G_t_k_I_m_a_g_e_T_y_p_e' : _R_e_a_d] The representation being
          used for image data.  Default value: GTK_IMAGE_EMPTY


_A_u_t_h_o_r(_s):

     Derived by RGtkGen from GTK+ documentation

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://developer.gnome.org/doc/API/2.0/gtk/GtkImage.html>

_S_e_e _A_l_s_o:

     'GdkPixbuf'

