Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Writting a widget with native scrolling support

Received: by 10.115.109.18 with SMTP id l18mr359887wam.8.1224777371192;
        Thu, 23 Oct 2008 08:56:11 -0700 (PDT)
Return-Path: <pygtk-boun...@daa.com.au>
Received: from quoll.daa.com.au (quoll.daa.com.au [203.17.251.1])
        by mx.google.com with ESMTP id m37si7681006waf.0.2008.10.23.08.56.05;
        Thu, 23 Oct 2008 08:56:10 -0700 (PDT)
Received-SPF: pass (google.com: domain of pygtk-boun...@daa.com.au designates 203.17.251.1 as permitted sender) client-ip=203.17.251.1;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of pygtk-boun...@daa.com.au designates 203.17.251.1 as permitted sender) smtp.mail=pygtk-boun...@daa.com.au
Received: from quoll.daa.com.au (localhost.localdomain [127.0.0.1])
	by quoll.daa.com.au (Postfix) with ESMTP id ED5B54AD037;
	Thu, 23 Oct 2008 23:56:01 +0800 (WST)
X-Original-To: py...@daa.com.au
Delivered-To: py...@daa.com.au
Received: from trubo.inescn.pt (ns2.inescn.pt [192.35.246.20])
	by quoll.daa.com.au (Postfix) with ESMTPS id B925B4ACE69
	for <py...@daa.com.au>; Thu, 23 Oct 2008 23:55:55 +0800 (WST)
Received: from localhost (localhost [127.0.0.1])
	by trubo.inescn.pt (8.13.8/8.13.8/8) with ESMTP id m9NFto2X024805;
	Thu, 23 Oct 2008 16:55:50 +0100
X-Virus-Scanned: amavisd-new at inescporto.pt
Received: from trubo.inescn.pt ([127.0.0.1])
	by localhost (trubo.inescn.pt [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id Q4H34ADODrmH; Thu, 23 Oct 2008 16:55:36 +0100 (WEST)
Received: from pong.inescporto.pt (pong.inescn.pt [194.117.26.74])
	by trubo.inescn.pt (8.13.8/8.13.8/56) with ESMTP id m9NFtQCo024749;
	Thu, 23 Oct 2008 16:55:26 +0100
Received: from [127.0.0.1] (localhost [127.0.0.1])
	by pong.inescporto.pt (Postfix) with ESMTP id ACD2A2F691B;
	Thu, 23 Oct 2008 16:56:20 +0100 (WEST)
From: "Gustavo J. A. M. Carneiro" <g...@inescporto.pt>
To: Laszlo Nagy <gand...@shopzeus.com>
In-Reply-To: <49007F5C.80301@shopzeus.com>
References: <48FCD9F3.5000608@shopzeus.com>
	<1224601628.8521.12.camel@dark-tower>  <49007F5C.80301@shopzeus.com>
Organization: INESC Porto
Date: Thu, 23 Oct 2008 16:55:25 +0100
Message-Id: <1224777325.8521.54.camel@dark-tower>
Mime-Version: 1.0
X-Mailer: Evolution 2.22.3.1 
Cc: py...@daa.com.au
Subject: Re: [pygtk] Writting a widget with native scrolling support
X-BeenThere: py...@daa.com.au
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Discussion of pygtk and related packages <pygtk.daa.com.au>
List-Unsubscribe: <http://www.daa.com.au/mailman/listinfo/pygtk>,
	<mailto:pygtk-requ...@daa.com.au?subject=unsubscribe>
List-Archive: <http://www.daa.com.au/pipermail/pygtk>
List-Post: <mailto:py...@daa.com.au>
List-Help: <mailto:pygtk-requ...@daa.com.au?subject=help>
List-Subscribe: <http://www.daa.com.au/mailman/listinfo/pygtk>,
	<mailto:pygtk-requ...@daa.com.au?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: pygtk-boun...@daa.com.au
Errors-To: pygtk-boun...@daa.com.au

On Thu, 2008-10-23 at 15:42 +0200, Laszlo Nagy wrote:
> Gustavo J. A. M. Carneiro wrote:
> > http://www.daa.com.au/pipermail/pygtk/2006-January/011668.html
> >   
> Yes, this was the only related post that I could find on the internet. 
> But I could not use it for anything because it does not tell how to do 
> it. It says:
> 
> "For custom widgets, check the method gtk.Widget.set_set_scroll_adjustments_signal(signal_name)"
> 
> 
> But this method only has a signal_name parameter. I do not see how I 
> could use it for specifying my adjustments and making my widget support 
> scrolling natively?
> 
> (Also that was written in 2006, probably it is outdated.)

It is not outdated.  See
http://library.gnome.org/devel/gtk/2.14/GtkWidget.html

        GtkWidgetClass
        typedef struct {
          /* The object class structure needs to be the first
           *  element in the widget class structure in order for
           *  the class mechanism to work correctly. This allows a
           *  GtkWidgetClass pointer to be cast to a GtkObjectClass
           *  pointer.
           */
          GtkObjectClass parent_class;
        
          
          guint activate_signal;
        
          guint set_scroll_adjustments_signal;
        } GtkWidgetClass;
        
        activate_signal The signal to emit when a widget of this class
        is activated, gtk_widget_activate() handles the emission.
        Implementation of this signal is optional. 
        
        set_scroll_adjustment_signal This signal is emitted when a
        widget of this class is added to a scrolling aware parent,
        gtk_widget_set_scroll_adjustments() handles the emission.
        Implementation of this signal is optional.
        
        
gtk.Widget.set_set_scroll_adjustments_signal is PyGtk's equivalent to
Gtk+/C setting the field set_scroll_adjustments_signal of the
GtkWidgetClass of your widget.  Basically you have to define a signal
"my-signal" in your widget that accepts two gtk.Adjustment objects as
parameters, then do
MyClass.set_set_scroll_adjustments_signal("my-signal").  Of course you
still need to implement the scrolling by monitoring the adjustments and
updating the widget's view accordingly, but after that you can add your
widget to a scrolled window.

        
> 
> Thanks,
> 
>    Laszlo
> 
> 
-- 
Gustavo J. A. M. Carneiro
<g...@inescporto.pt> <gust...@users.sourceforge.net>
"The universe is always one step beyond logic" -- Frank Herbert

_______________________________________________
pygtk mailing list   py...@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/