PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Gtk Components » Gtk_ScrollingLabel » Manual

A class that creates a scrolling marquee.

Introduction

Introduction – Getting started with Gtk_Scrollinglabel?

Contributors

Description

Gtk_ScrollingLabel is a class that creates a pseudo-widget which makes scrolling text within a label easy. The text within the label can be set to scroll from left to right, right to left, or bounce within the boundries of the label. The speed of the scrolling text can also be controlled. There are also built in methods to make the text pause or stop when the user moves the mouse over the label and start up again when the mouse leaves the label space.

Getting started with Gtk_ScrollingLabel is easy. All you need to do is instantiate the class, add it to a window, and start the scrolling. Take at look at the example below.

Simple Setup

<?php
// Create a Gtk_ScrollingLabel instance.
require_once 'Gtk/ScrollingLabel.php';
$sLabel =& new Gtk_ScrollingLabel('Scrolling Labels Rule!');

// Create a GtkWindow to put the label in.
$gWin =& new GtkWindow;
$gWin->connect_object('destroy', array('gtk', 'main_quit'));
$gWin->add($sLabel->getWidget());

// Show everything.
$gwin->show_all();

// Start the label and the main loop.
$sLabel->startScroll();
gtk::main();
?>

Gtk_ScrollingLabel::getFullText

Gtk_ScrollingLabel::getFullText – Returns the full text of the label.

Synopsis

require_once 'Gtk/ScrollingLabel.php';

string Gtk_ScrollingLabel::getFullText ( )

Description

Returns the full text of the label. The full text is the text that was set on construction or with setFullText() not just what is currently visible.

Return value

returns the full text of the label.

Note

This function can not be called statically.

Gtk_ScrollingLabel::getHiddenText

Gtk_ScrollingLabel::getHiddenText – Returns all of the text that is not currently visible.

Synopsis

require_once 'Gtk/ScrollingLabel.php';

string Gtk_ScrollingLabel::getHiddenText ( )

Description

Returns the portion of the full label text that is currently not being shown.

Return value

returns the label text that is not visible.

See

getFullText()

Note

This function can not be called statically.

Gtk_ScrollingLabel::getScrollingLabel

Gtk_ScrollingLabel::getScrollingLabel – Returns a GtkEventBox with the scrolling label inside.

Synopsis

require_once 'Gtk/ScrollingLabel.php';

void Gtk_ScrollingLabel::getScrollingLabel ( )

Description

Returns the GtkEventBox that contains the scrolling label.

Return value

returns the GtkEventBox containing the scrolling label.

Note

This function can not be called statically.

Gtk_ScrollingLabel::getStyle

Gtk_ScrollingLabel::getStyle – Gets the label's style widget

Synopsis

require_once 'Gtk/ScrollingLabel.php';

&object Gtk_ScrollingLabel::getStyle ( )

Description

Returns the label's style widget. This lets you make changes to the style to alter the look and feel of the widget. You can change the font of the display, the color of the background, etc.

Return value

returns the GtkStyle widget for the label.

Note

This function can not be called statically.

Gtk_ScrollingLabel::getVisibleLength

Gtk_ScrollingLabel::getVisibleLength – Returns the length of the visible area in characters.

Synopsis

require_once 'Gtk/ScrollingLabel.php';

int Gtk_ScrollingLabel::getVisibleLength ( )

Description

Returns the length of the visible area in characters. The length of the visible area is the maximum number of characters that are visible at one time.

Return value

integer the maximum number of characters that are visible at one time.

See

setVisibleLength()

Note

This function can not be called statically.

Gtk_ScrollingLabel::pause

Gtk_ScrollingLabel::pause – Stops the label from scrolling without reseting the label text

Synopsis

require_once 'Gtk/ScrollingLabel.php';

void Gtk_ScrollingLabel::pause ( )

Description

Stops the label from scrolling but does not reset the label text to the begining. If you want the label to stop scrolling and return to its original position (blank), use stopScroll().

Return value

returns true if the scrolling has stopped.

See

unPause()

Note

This function can not be called statically.

Gtk_ScrollingLabel::setBounce

Gtk_ScrollingLabel::setBounce – Sets the text to bounce between the borders of the label

Synopsis

require_once 'Gtk/ScrollingLabel.php';

boolean Gtk_ScrollingLabel::setBounce ( boolean $bounce )

Description

If $bounce is true, the text will scroll to the left until the first character hits the left edge of the visible window then it will scroll back to the right. When the last character hits the right edge of the visible window the text will scroll back to the left again.

If all of the scrolling text cannot be viewed at once, making the text bounce will have an undesired result. Therefore it is suggested that the length of the text always be at least one character less than the maximum viewable string length.

Parameter

Return value

returns Whether or not the text is set to bounce

Note

This function can not be called statically.

Gtk_ScrollingLabel::setStartSignal

Gtk_ScrollingLabel::setStartSignal – Connects the startScroll() method to a given event.

Synopsis

require_once 'Gtk/ScrollingLabel.php';

void Gtk_ScrollingLabel::setStartSignal ( string $signal )

Description

setStartSignal() will make the event box listen for the signal $signal and will envoke startScroll() when ever it is heard. The signal should be a signal that GtkEventBox listens for normally or a button press event.

Parameter

Return value

returns The handler id for the connection.

See

startScroll()

Note

This function can not be called statically.

Gtk_ScrollingLabel::startScroll

Gtk_ScrollingLabel::startScroll – Begins scrolling the text from the start of the string.

Synopsis

require_once 'Gtk/ScrollingLabel.php';

boolean Gtk_ScrollingLabel::startScroll ( )

Description

startScroll() will make the text begin scrolling in the direction given by calling setDirection(). If the text is scrolling left to right (GTK_SCROLLINGLABEL_RIGHT), the current character position is set to the end of the text. This means that the last character of the label will be the first character shown. If the text is scrolling right to left (GTK_SCROLLINGLABEL_LEFT), the current character position is set to zero. This means that first character shown will be a blank space.

This method is best used when connected to an event.

Return value

returns true if the text has started scrolling. false otherwise.

See

setStartSignal()

Note

This function can not be called statically.

Gtk_ScrollingLabel::unPause

Gtk_ScrollingLabel::unPause – Begins scrolling the label from its current position

Synopsis

require_once 'Gtk/ScrollingLabel.php';

void Gtk_ScrollingLabel::unPause ( )

Description

Begins scrolling the label from its current position. unPause() is different from startScroll() in that it does not reset the label to the begining of the text.

Return value

returns true if the text has started scrolling.

See

pause()

startScroll()

Note

This function can not be called statically.