Example #1
0
static void itk_button_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
	GtkButton *button = GTK_BUTTON (widget);
	gtk_widget_set_allocation(widget, allocation);

	if (gtk_widget_get_realized (widget))
	    gdk_window_move_resize (gtk_button_get_event_window(button),
	                            allocation->x,
	                            allocation->y,
	                            allocation->width,
	                            allocation->height);
}
Example #2
0
static void
panel_toggle_button_size_allocate (GtkWidget *widget,
    GtkAllocation *allocation)
{
  GtkWidget *child;
  
  child = gtk_bin_get_child (GTK_BIN (widget));

  gtk_widget_set_allocation (widget, allocation);
  
  if (gtk_widget_get_realized (widget))
    gdk_window_move_resize (gtk_button_get_event_window (GTK_BUTTON(widget)), 
	allocation->x, allocation->y,
	allocation->width, allocation->height); 
  
  if (child)
    gtk_widget_size_allocate (child, allocation);
}
    //________________________________________________________________________________
    void ComboBoxData::updateButtonEventWindow( void ) const
    {

        // store local pointer to relevant widget
        GtkWidget* widget( _button._widget );

        // check validity and type
        if( !( widget && GTK_IS_BUTTON( widget ) ) ) return;

        // get window
        GdkWindow* window( gtk_button_get_event_window( GTK_BUTTON( widget ) ) );

        if( !window ) return;

        // offset
        /* TODO: we should get it from the x-thickness property of the GtkFrame for this combobox */
        const int offset = 4;

        // get allocation
        const GtkAllocation allocation( Gtk::gtk_widget_get_allocation( widget ) );
        gdk_window_move_resize( window, allocation.x-offset, allocation.y, allocation.width+offset, allocation.height );

    }
Example #4
0
GdkWindow *wxHyperlinkCtrl::GTKGetWindow(wxArrayGdkWindows& windows) const
{
    return UseNative() ? gtk_button_get_event_window(GTK_BUTTON(m_widget))
                       : wxGenericHyperlinkCtrl::GTKGetWindow(windows);
}
Example #5
0
GdkWindow *wxAnyButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
{
    return gtk_button_get_event_window(GTK_BUTTON(m_widget));
}
Example #6
0
static void
menu_position_side_func (GtkMenu       *menu,
                         gint          *x,
                         gint          *y,
                         gboolean      *push_in,
                         GtkMenuButton *menu_button)
{
  GtkMenuButtonPrivate *priv = menu_button->priv;
  GtkAllocation allocation;
  GtkAllocation menu_allocation;
  GtkWidget *widget = GTK_WIDGET (menu_button);
  GdkRectangle monitor;
  gint monitor_num;
  GdkScreen *screen;
  GdkWindow *window;
  GtkAlign align;
  GtkTextDirection direction;

  window = gtk_widget_get_window (widget);

  direction = gtk_widget_get_direction (widget);
  align = gtk_widget_get_valign (GTK_WIDGET (menu));
  screen = gtk_widget_get_screen (GTK_WIDGET (menu));
  monitor_num = gdk_screen_get_monitor_at_window (screen, window);
  if (monitor_num < 0)
    monitor_num = 0;
  gdk_screen_get_monitor_workarea (screen, monitor_num, &monitor);

  gdk_window_get_origin (gtk_button_get_event_window (GTK_BUTTON (menu_button)), x, y);

  gtk_widget_get_allocation (widget, &allocation);
  gtk_widget_get_allocation (priv->menu, &menu_allocation);

  if ((priv->arrow_type == GTK_ARROW_RIGHT && direction == GTK_TEXT_DIR_LTR) ||
      (priv->arrow_type == GTK_ARROW_LEFT && direction == GTK_TEXT_DIR_RTL))

    {
      if (*x + allocation.width + menu_allocation.width <= monitor.x + monitor.width)
        *x += allocation.width;
      else
        *x -= menu_allocation.width;
    }
  else
    {
      if (*x - menu_allocation.width >= monitor.x)
        *x -= menu_allocation.width;
      else
        *x += allocation.width;
    }

  /* treat the default align value like START */
  if (align == GTK_ALIGN_FILL)
    align = GTK_ALIGN_START;

  if (align == GTK_ALIGN_CENTER)
    *y -= (menu_allocation.height - allocation.height) / 2;
  else if (align == GTK_ALIGN_END)
    *y -= menu_allocation.height - allocation.height;

  *push_in = FALSE;
}
Example #7
0
GdkWindow *wxCheckBox::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
{
    return gtk_button_get_event_window(GTK_BUTTON(m_widgetCheckbox));
}
Example #8
0
static VALUE
rg_event_window(VALUE self)
{
    return GOBJ2RVAL(gtk_button_get_event_window(_SELF(self)));
}