Re: Announcing Teak 0.20
| From: | Rich Payne | Date: | Fri, 22 Feb 2002 15:01:18 +0000 |
| Subject: | Re: Announcing Teak 0.20 | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1309@lists.php.net to get a copy of this message | ||
Doesn't that interfere with the Tooltip? Or does it just change the icon
on the button? As you can see I haven't tried the code yet.
thanks,
--rdp
On Fri, 22 Feb 2002, Nikolajus Krauklis wrote:
> > After months of development and minutes of QA testing I'm happy to
> > announce Teak 0.20, also known as the "No, this isn't a dead project yet"
> > release.
>
> i a little bit change exelent Teak PictureButton class
> widgets\PictureButton.php ) maybe it will be usefull.
> ChangeLog: added possibility automaticly display image then mouse is on the
> button, you should to
> set $im_name_over to false not to do so.
>
> Sorry for english, there this class (in my computer works perfecty).
>
> <?php
> /*
> Here we just build our own button that has an icon and a text label on it.
> I use this throughout Teak so it makes sense
> to create our own subclass
> We pass to it:
> $text = text label to appear on the button
> $im_name = text string of the image to load
> $im_name_over = text string of the image to load then mouse is over button
> $window = The parent window, we need the GdkWindow from there for loading
> the pixmap
> $orientation = one of VERT or HORZ, tells us to make a GtkVBox or GtkHbox
> in the button
> $tt_text = ToolTip Text (if any)
> */
>
> Class PictureButton extends GtkButton {
> function PictureButton ($text, $im_name, $im_name_over, $window,
> $orientation, $tt_text) {
> $this->GtkButton();
>
> list($pixmap, $mask) =
> Gdk::pixmap_create_from_xpm($window->window,null,$im_name);
> $im = &new GtkPixmap($pixmap, $mask);
>
> switch ($orientation) {
> case VERT:
> $button_box = &new GtkVBox();
> break;
>
> case HORZ:
> $button_box = &new GtkHBox();
> break;
>
> default:
> $button_box = &new GtkVBox();
> break;
> }
> $button_label = &new GtkLabel($text);
>
> $button_box->pack_start($im);
> $button_box->pack_start($button_label);
>
> if ($tt_text !== NULL) {
> $tt = &new GtkTooltips();
> $tt->set_delay(300);
> $tt->set_tip($this, $tt_text, '');
> $tt->enable();
> }
>
> $this->add($button_box);
>
> if ($im_name_over!=false)
> {
> list($pixmap, $mask) =
> Gdk::pixmap_create_from_xpm($window->window,null,$im_name_over);
>
>
> $this->connect_object('enter',array(&$this,'onmouse_over'),$im,$pixmap,$mask
> );
>
> list($pixmap, $mask) =
> Gdk::pixmap_create_from_xpm($window->window,null,$im_name);
>
>
> $this->connect_object('leave',array(&$this,'onmouse_out'),$im,$pixmap,$mask)
> ;
> }
> }
>
> function onmouse_over($im,$pixmap,$mask)
> {
> $im->set($pixmap,$mask);
> }
>
> function onmouse_out($im,$pixmap,$mask)
> {
> $im->set($pixmap,$mask);
> }
> }
>
> ?>
>
>
>
>
>
--
Rich Payne
http://talisman.mv.com