ScrollingLabel
[ class tree: ScrollingLabel ] [ index: ScrollingLabel ] [ all elements ]

Class: Gtk2_ScrollingLabel

Source Location: /Gtk2_ScrollingLabel-0.4.1/ScrollingLabel.php

Class Overview


Class for creating a label with the ability to scroll text.


Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 29]
Class for creating a label with the ability to scroll text.


[ Top ]


Class Variables

$bounce =  true

[line 112]

Whether the text should change direction when it hits an edge.
  • Access: protected

Type:   boolean


[ Top ]

$currentCharPosition =  0

[line 98]

The first character to show when direction is self::GTK2_SCROLLINGLABEL_LEFT

The last character to show when direction is self::GTK2_SCROLLINGLABEL_RIGHT

  • Access: protected

Type:   integer


[ Top ]

$direction =  self::GTK2_SCROLLINGLABEL_LEFT

[line 105]

The direction the text should be moving.
  • Access: protected

Type:   integer


[ Top ]

$gtkTimeoutTag =

[line 75]

The tag returned to indicate the call to gtk timeout.
  • Access: protected

Type:   integer


[ Top ]

$label =

[line 61]

The label which will display the text.
  • Access: protected

Type:   GtkLabel


[ Top ]

$labelText =

[line 68]

The full text that will be displayed over time.
  • Access: protected

Type:   string


[ Top ]

$speed =  70

[line 90]

The number of milliseconds between calls to the method passed to gtk timeout.
  • Access: protected

Type:   integer


[ Top ]

$visibleLength =  70

[line 82]

The number of characters that should be visible
  • Access: protected

Type:   integer


[ Top ]

$widget =

[line 54]

The event box which will contain the label and listen for events.
  • Access: protected

Type:   GtkEventBox


[ Top ]



Method Detail

bounce   [line 609]

boolean bounce( boolean $bounce)

Deprecated method to set bouncing.

Parameters:

boolean   $bounce   —  true means change directions.

[ Top ]

error   [line 893]

mixed error( string $msg, [integer $code = self::GTK2_SCROLLINGLABEL_DEFAULT_ERROR], [integer $pearMode = PEAR_ERROR_RETURN])

Raise a pear error.

error will raise a PEAR error with $msg as the message. If the optional parameter $code is set, that error code will be used. Otherwise the default error code will be used. If the optional $pearMode is passed that mode will be used to display/return the error.

  • Return: A PEAR_Error or void.
  • Access: public

Parameters:

string   $msg   —  The human readable error message.
integer   $code   —  The error code.
integer   $pearMode   —  The PEAR mode for the error.

[ Top ]

getFullText   [line 718]

string getFullText( none 0)

Return all of the text that can ever be shown by this label.
  • Access: public

Parameters:

none   0   — 

[ Top ]

getHiddenText   [line 730]

string getHiddenText( none 0)

Return all of the text that is not currently visible.
  • Access: public

Parameters:

none   0   — 

[ Top ]

getScrollingLabel   [line 873]

&object getScrollingLabel( none 0)

Return the GTKEventBox with the GTKLabel inside.
  • Access: public

Parameters:

none   0   — 

[ Top ]

getStyle   [line 643]

&object &getStyle( none 0)

Get the label's style widget.

getStyle() 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.

  • Access: public

Parameters:

none   0   — 

[ Top ]

getVisibleLength   [line 835]

integer getVisibleLength( none 0)

Return the visible area length in characters
  • Access: public

Parameters:

none   0   — 

[ Top ]

getVisibleText   [line 663]

string getVisibleText( none 0)

Return the portion of the label text that should be visible

getVisibleText() is used internally to get the text that should be shown everytime the text scrolls. It can also be called publically to get the text that is currently displayed in the visible window area. The part of the text that is visible depends on the current character position and the direction the text is moving.


Parameters:

none   0   — 

[ Top ]

hide   [line 860]

void hide( none 0)

Hide the GTK components.
  • Access: public

Parameters:

none   0   — 

[ Top ]

jumpToChar   [line 783]

integer jumpToChar( integer $charPosition)

Change the current character position.

jumpToChar() allows you to go directly to a character position on the next call to scrollLabel. The new position must be between zero (the first character) and the length of the label minus one. The character position should be calculated using the string from padText(). When the text is scrolling to the left the $charPosition should be the left-most character to display. When text is scrolling to the right, $charPosition should be the right-most character to display.

The visible label will not change until scrollLabel is called again.

  • Return: The new current character position. (PEAR_Error when there is a problem.)
  • Access: public

Parameters:

integer   $charPosition   —  Depending on the direction either the left or right most character to display.

[ Top ]

padText   [line 696]

string padText( none 0)

Pad the text with enough space to fill the visible area.

padText adds the needed amount of white space to the text so that it can scroll properly. When the text is set to bounce the padding should only be what is needed to make the string as long as the visible window area. If the text is not bouncing, the text must be padded with as many spaces as the length of the visible area.


Parameters:

none   0   — 

[ Top ]

pause   [line 340]

boolean pause( none 0)

Stop the scroll where it is and do not change the current position.

Usually connected to an event.

pause() will stop the text in its tracks. The scrolling will stop but the visible text will not change. This is different from stopScroll() in that stopScroll() will clear the display back to its starting state.

This method is best used when connected to an event.


Parameters:

none   0   — 

[ Top ]

setBounce   [line 594]

boolean setBounce( boolean $bounce)

Set whether or not the text should change directions when it hits an edge

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 to the right. When the last character hits the right edge of the visible window the text will scroll back to the left.

Note: I don't know what will happen if bounce is true and the text is larger than what can be viewed at one time in the window. Therefore it is suggested that the length of the text always be at least one less than the size of the window.

  • Return: The current state of $this->bounce
  • Access: public

Parameters:

boolean   $bounce   —  true means change directions.

[ Top ]

setDirection   [line 561]

integer setDirection( integer $direction)

Set the diretion that the text should scroll.

Set the direction that the text will move across the visible area of the label. The only accepted directions are the two constants self::GTK2_SCROLLINGLABEL_LEFT and self::GTK2_SCROLLINGLABEL_RIGHT which move the from right to left and left to right respectively. The return value is the diretion the text will move on the next call to scrollLabel().

  • Access: public

Parameters:

integer   $direction   —  An integer specifying the direction.

[ Top ]

setFullText   [line 754]

string setFullText( string $text)

Set the full text of the label.

setFullText() will change the text of the scrolling label. The return value is what the text of the label will be when _scrollLabel is next called.

  • Return: The label's text.
  • Access: public

Parameters:

string   $text   —  The new text for the label.

[ Top ]

setPauseSignal   [line 441]

integer setPauseSignal( string $signal)

Connect the pause method to an event.

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

  • Access: public
  • Uses: connectSignal

Parameters:

string   $signal   —  The GTK signal to connect to the method.

[ Top ]

setSpeed   [line 524]

integer setSpeed( string $speed, [boolean $restart = false])

Set the speed of the scrolling text.

setSpeed() will change how quickly the text scrolls across the visible label area. $speed is the number of milliseconds to wait between calls to _scrollLabel. $speed is passes to gtk::timeout_add(). If $restart is set to true, the speed of the text will be changed immediately. Otherwise the speed will not be changed until _scrollLabel is called again. This effectively means that the speed changes one letter after you set the new speed if $restart is false.

  • Access: public

Parameters:

string   $speed   —  The speed the text should scroll.
boolean   $restart   —  Whether or not the speed should be changed before the next call to _scrollLabel

[ Top ]

setStartSignal   [line 480]

integer setStartSignal( string $signal)

Connect the start method to an event.

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.

  • Access: public
  • Uses: connectSignal

Parameters:

string   $signal   —  The GTK signal to connect to the method.

[ Top ]

setStopSignal   [line 500]

integer setStopSignal( string $signal)

Connect the stop method to an event.

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

  • Access: public
  • Uses: connectSignal

Parameters:

string   $signal   —  The GTK signal to connect to the method.

[ Top ]

setStyle   [line 626]

&object setStyle( &$style, &object $style)

Set the style in which the text will be displayed.

setStyle() lets you define the look of the text that is scrolling as well as the background of the widget.

This method has not been implemented yet.

  • Access: public

Parameters:

&object   $style   —  The GTK_Style object to use.
   &$style   — 

[ Top ]

setUnPauseSignal   [line 460]

integer setUnPauseSignal( string $signal)

Connect the unpause method to an event.

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

  • Access: public
  • Uses: connectSignal

Parameters:

string   $signal   —  The GTK signal to connect to the method.

[ Top ]

setVisibleLength   [line 814]

integer setVisibleLength( integer $length)

Change how many characters should be visible at any given time.

setVisibleLength() will set the number of characters that are visible at any given time. While it is ik to set the visible length smaller than the width of the displaying widget, you probably don't want to make it larger then the width of the displaying widget. It will make the padded lenght longer and add additional time before the text begins to appear on screen.

  • Return: The new size of the visible area in characters.
  • Access: public

Parameters:

integer   $length   —  The new size of the visible area in characters.

[ Top ]

show   [line 847]

void show( none 0)

Show the GTK components.
  • Access: public

Parameters:

none   0   — 

[ Top ]

startScroll   [line 247]

boolean startScroll( none 0)

Begin scrolling the text from the start of the string.

Usually connected to an event.

startScroll() will make the text begin scrolling in the direction given by calling setDirection(). If the text is scrolling left to right (GTK_self::GTK2_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 (self::GTK2_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.


Parameters:

none   0   — 

[ Top ]

stopScroll   [line 311]

boolean stopScroll( none 0)

Stop scrolling the text and return the string to the beginning.

Usually connected to an event.

stopScroll will stop the text from scrolling and set the current character position to zero. When the text is started in motion again, it will be shown as it would if it had been started for the first time.

This method is best used when connected to an event.


Parameters:

none   0   — 

[ Top ]

unPause   [line 272]

boolean unPause( none 0)

Begin scrolling the text from the current character position.

Work horse for startScroll. Usually connected to an event.

unPause() does pretty much the same thing as startScroll except that it does not manipulate the current character position. When you unpause the scroll, the text continues from where it left off when it was paused.

This method is best used when conneted to an event.


Parameters:

none   0   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:35:53 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.