<commit_before>/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/************************************************

  rbgtkscrolledwindow.c -

  $Author: ktou $
  $Date: 2006/11/13 12:53:21 $

  Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
  Copyright (C) 1998-2000 <NAME>,
                          <NAME>,
                          <NAME>
************************************************/

#include "global.h"

#define _SELF(self) (GTK_SCROLLED_WINDOW(RVAL2GOBJ(self)))

static VALUE
scwin_initialize(argc, argv, self)
    int argc;
    VALUE *argv;
    VALUE self;
{
    VALUE arg1, arg2;
    GtkAdjustment *h_adj = NULL;
    GtkAdjustment *v_adj = NULL;

    rb_scan_args(argc, argv, "02", &arg1, &arg2);

    if (!NIL_P(arg1)) h_adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1));
    if (!NIL_P(arg2)) v_adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg2));

    RBGTK_INITIALIZE(self, gtk_scrolled_window_new(h_adj, v_adj));
    return Qnil;
}

static VALUE
scwin_set_policy(self, hpolicy, vpolicy)
    VALUE self, hpolicy, vpolicy;
{
    gtk_scrolled_window_set_policy(_SELF(self),
                                   RVAL2GENUM(hpolicy, GTK_TYPE_POLICY_TYPE),
                                   RVAL2GENUM(vpolicy, GTK_TYPE_POLICY_TYPE));
    return self;
}

static VALUE
scwin_get_policy(self)
    VALUE self;
{
    GtkPolicyType hpolicy, vpolicy;

    gtk_scrolled_window_get_policy(_SELF(self), &hpolicy, &vpolicy);
    return rb_ary_new3(2, 
                       GENUM2RVAL(hpolicy, GTK_TYPE_POLICY_TYPE), 
                       GENUM2RVAL(vpolicy, GTK_TYPE_POLICY_TYPE)); 
}

static VALUE
scwin_add_with_viewport(self, other)
    VALUE self, other;
{
    gtk_scrolled_window_add_with_viewport(_SELF(self),
                                          GTK_WIDGET(RVAL2GOBJ(other)));
    G_CHILD_ADD(self, other);
    return self;
}

#if GTK_CHECK_VERSION(2,8,0)
static VALUE
scwin_get_hscrollbar(self)
    VALUE self;
{
    return GOBJ2RVAL(gtk_scrolled_window_get_hscrollbar(_SELF(self)));
}

static VALUE
scwin_get_vscrollbar(self)
    VALUE self;
{
    return GOBJ2RVAL(gtk_scrolled_window_get_vscrollbar(_SELF(self)));
}
#endif

#if GTK_CHECK_VERSION(2,10,0)
static VALUE
scwin_set_placement(self, corner_type)
    VALUE self, corner_type;
{
    gtk_scrolled_window_set_placement(_SELF(self), 
                                      RVAL2GENUM(corner_type, GTK_TYPE_CORNER_TYPE));
    return self;
}

static VALUE
scwin_unset_placement(self)
    VALUE self;
{
    gtk_scrolled_window_unset_placement(_SELF(self));
    return self;
}

static VALUE
scwin_get_placement(self)
    VALUE self;
{
    return GENUM2RVAL(gtk_scrolled_window_get_placement(_SELF(self)), 
                      GTK_TYPE_CORNER_TYPE);
}
#endif

/* Defined as properties
GtkAdjustment* gtk_scrolled_window_get_hadjustment
                                            (GtkScrolledWindow *scrolled_window);
GtkAdjustment* gtk_scrolled_window_get_vadjustment<commit_msg>* change to ANSI C style.<commit_after>/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/************************************************

  rbgtkscrolledwindow.c -

  $Author: ktou $
  $Date: 2006/11/13 12:53:21 $

  Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
  Copyright (C) 1998-2000 <NAME>,
                          <NAME>,
                          <NAME>
************************************************/

#include "global.h"

#define _SELF(self) (GTK_SCROLLED_WINDOW(RVAL2GOBJ(self)))

static VALUE
scwin_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE arg1, arg2;
    GtkAdjustment *h_adj = NULL;
    GtkAdjustment *v_adj = NULL;

    rb_scan_args(argc, argv, "02", &arg1, &arg2);

    if (!NIL_P(arg1)) h_adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1));
    if (!NIL_P(arg2)) v_adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg2));

    RBGTK_INITIALIZE(self, gtk_scrolled_window_new(h_adj, v_adj));
    return Qnil;
}

static VALUE
scwin_set_policy(VALUE self, VALUE hpolicy, VALUE vpolicy)
{
    gtk_scrolled_window_set_policy(_SELF(self),
                                   RVAL2GENUM(hpolicy, GTK_TYPE_POLICY_TYPE),
                                   RVAL2GENUM(vpolicy, GTK_TYPE_POLICY_TYPE));
    return self;
}

static VALUE
scwin_get_policy(VALUE self)
{
    GtkPolicyType hpolicy, vpolicy;

    gtk_scrolled_window_get_policy(_SELF(self), &hpolicy, &vpolicy);
    return rb_ary_new3(2, 
                       GENUM2RVAL(hpolicy, GTK_TYPE_POLICY_TYPE), 
                       GENUM2RVAL(vpolicy, GTK_TYPE_POLICY_TYPE)); 
}

static VALUE
scwin_add_with_viewport(VALUE self, VALUE other)
{
    gtk_scrolled_window_add_with_viewport(_SELF(self),
                                          GTK_WIDGET(RVAL2GOBJ(other)));
    G_CHILD_ADD(self, other);
    return self;
}

#if GTK_CHECK_VERSION(2,8,0)
static VALUE
scwin_get_hscrollbar(VALUE self)
{
    return GOBJ2RVAL(gtk_scrolled_window_get_hscrollbar(_SELF(self)));
}

static VALUE
scwin_get_vscrollbar(VALUE self)
{
    return GOBJ2RVAL(gtk_scrolled_window_get_vscrollbar(_SELF(self)));
}
#endif

#if GTK_CHECK_VERSION(2,10,0)
static VALUE
scwin_set_placement(VALUE self, VALUE corner_type)
{
    gtk_scrolled_window_set_placement(_SELF(self), 
                                      RVAL2GENUM(corner_type, GTK_TYPE_CORNER_TYPE));
    return self;
}

static VALUE
scwin_unset_placement(VALUE self)
{
    gtk_scrolled_window_unset_placement(_SELF(self));
    return self;
}

static VALUE
scwin_get_placement(VALUE self)
{
    return GENUM2RVAL(gtk_scrolled_window_get_placement(_SELF(self)), 
                      GTK_TYPE_CORNER_TYPE);
}
#endif

/* Defined as properties
GtkAdjustment* gtk_scrolled_window_get_hadjustment
                                            (GtkScrolledWindow *scrolled_window);
GtkAdjustment* gtk_scrolled_window_get_vadjustment
{'fraction_non_alphanumeric': 0.1282986111111111, 'fraction_numerical': 0.021527777777777778, 'mean_word_length': 3.2422680412371134, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7539283', 'n_tokens_mistral': 2197, 'n_tokens_neox': 2053, 'n_words': 331}