Esempio n. 1
0
G_MODULE_EXPORT void 
gw_radicalswindow_show_cb (GtkWidget *widget, gpointer data)
{
    //Declarations
    GtkWindow *window;
    GtkScrolledWindow *scrolledwindow;
    GtkPolicyType policy;
    int x, y, width, height, max_height;

    //Initializations
    window = GTK_WINDOW (widget);
    if (window == NULL) return;
    scrolledwindow = GTK_SCROLLED_WINDOW (data);
    gtk_scrolled_window_get_policy (scrolledwindow, NULL, &policy);

    gtk_scrolled_window_set_policy (scrolledwindow, GTK_POLICY_NEVER, GTK_POLICY_NEVER);
    gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
    gtk_window_get_position (window, &x, &y);
    gtk_window_get_size (window, &width, &height);
    max_height = gdk_screen_height () - y;
    if (max_height > 50) max_height -= 50;

    if (height > max_height)
    {
      gtk_scrolled_window_set_policy (scrolledwindow, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
      gtk_window_resize (GTK_WINDOW (window), width, max_height);
    }
    else
    {
      gtk_scrolled_window_set_policy (scrolledwindow, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    }

    return;
}
static VALUE
rg_policy(VALUE self)
{
    GtkPolicyType hpolicy, vpolicy;

    gtk_scrolled_window_get_policy(_SELF(self), &hpolicy, &vpolicy);
    return rb_ary_new3(2, 
                       GTKPOLICYTYPE2RVAL(hpolicy), 
                       GTKPOLICYTYPE2RVAL(vpolicy)); 
}
Esempio n. 3
0
int
clip_GTK_SCROLLEDWINDOWGETPOLICY (ClipMachine *cm)
{
    C_widget *csw = _fetch_cw_arg(cm);
    GtkPolicyType hpolicy, vpolicy ;

    CHECKOPT(2,NUMERIC_t);
    gtk_scrolled_window_get_policy (GTK_SCROLLED_WINDOW(csw->widget), &hpolicy, &vpolicy);

    _clip_storni(cm, (int)hpolicy, 2, 0);
    _clip_storni(cm, (int)vpolicy, 3, 0);
    return 0;
err:
    return 1;
}
Esempio n. 4
0
static int gtkCanvasSetYAutoHideAttrib(Ihandle* ih, const char *value)
{
  GtkPolicyType hscrollbar_policy;
  gtk_scrolled_window_get_policy(gtkCanvasGetScrolledWindow(ih), &hscrollbar_policy, NULL);

  if (ih->data->sb & IUP_SB_VERT)
  {
    GtkPolicyType vscrollbar_policy;

    if (iupStrBoolean(value))
      vscrollbar_policy = GTK_POLICY_AUTOMATIC;
    else
      vscrollbar_policy = GTK_POLICY_ALWAYS;

    gtk_scrolled_window_set_policy(gtkCanvasGetScrolledWindow(ih), hscrollbar_policy, vscrollbar_policy);
  }
  else
    gtk_scrolled_window_set_policy(gtkCanvasGetScrolledWindow(ih), hscrollbar_policy, GTK_POLICY_NEVER);

  return 1;
}
static void
set_fixed_size (GtkWidget *chooser)
{
  CcInputChooserPrivate *priv = GET_PRIVATE (chooser);
  GtkPolicyType policy;
  gint width, height;

  gtk_scrolled_window_get_policy (GTK_SCROLLED_WINDOW (priv->scrolledwindow), &policy, NULL);
  if (policy == GTK_POLICY_AUTOMATIC)
    return;

  /* Don't let it automatically get wider than the main CC window nor
     get taller than the initial height */
  gtk_window_get_size (gtk_window_get_transient_for (GTK_WINDOW (chooser)),
                       &width, NULL);
  gtk_window_get_size (GTK_WINDOW (chooser), NULL, &height);
  gtk_widget_set_size_request (chooser, width * MAIN_WINDOW_WIDTH_RATIO, height);

  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolledwindow),
                                  GTK_POLICY_AUTOMATIC,
                                  GTK_POLICY_AUTOMATIC);
}