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

Class: Gtk_Styled_ScrollBar

Source Location: /Gtk_Styled-1.0.0/ScrollBar.php

Class Overview


Class for creating a pseudo-scrollbar whose style can be controlled more easily than a regular scrollbar.


Author(s):

Version:

  • @VER@

Copyright:

  • Copyright © 2005 Scott Mattocks

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 55]
Class for creating a pseudo-scrollbar whose style can be controlled more easily than a regular scrollbar.

While it is possible to control some style elements of a GtkScrollBar, other elements cannot be controlled so easily. Items such as the images at the begining and end (usually arrows) and the scroll bar that is dragged to scroll the element cannot be changed. This leads to applications that either must conform to the windowing systems look and feel or appear incomplete. The goal of this family of PHP-GTK classes is to provide all the same functionality as a normal scroll bar but allow the user to have better control over the look and feel.

There are several steps to undertake inorder to make this family of classes mimic a GtkScrollBar: Done: Define what needs to be done. Done: Create a pseudo widget that looks like a scroll bar. Done: Make the pseudo widget act like a scroll bar (move up and down) Done: Make the pseudo widget control another widget Done: Make the bar dragable within the track only. Done: Make the pseudo widget "styleable"

  • Author: Scott Mattocks <scottmattocks@php.net>
  • Version: @VER@
  • Copyright: Copyright &copy; 2005 Scott Mattocks
  • License: PHP


[ Top ]


Class Variables

$delay =  200

[line 93]

The number of microseconds to wait before incrementing the value again while the user is holding a button.

Type:   integer


[ Top ]

$height =  15

[line 103]

The height of a button.

Type:   integer


[ Top ]

$lessButton =

[line 76]

The the button that makes the value of the scroll less.

Type:   object


[ Top ]

$moreButton =

[line 81]

The the button that makes the value of the scroll more.

Type:   object


[ Top ]

$pressing =

[line 87]

The time out tag that indicates the user is pressing and holding a part of the scroll bar.

Type:   integer


[ Top ]

$styleAdjustment =

[line 71]

The pseudo widget that defines the basic properties of the scroll bar.

Type:   object


[ Top ]

$widget =

[line 61]

The useable widget

Type:   object


[ Top ]

$widgetToScroll =

[line 66]

The widget that the scroll bar will control.

Type:   object


[ Top ]

$width =  15

[line 98]

The width of a button.

Type:   integer


[ Top ]



Method Detail

Gtk_Styled_ScrollBar (Constructor)   [line 119]

void Gtk_Styled_ScrollBar( object &$styleAdjustment)

Constructor. Check parameters an call helper methods.

A Gtk_Styled_ScrollBar requires a Gtk_StyleAdjustment on construction. The style adjustment can be either an H or V style adjustment but Whichever is passed controls the look and behavior of the scroll bar.

The widget to be scrolled is added later.

  • Access: public

Parameters:

object   &$styleAdjustment   — 

[ Top ]

addWidgetToScroll   [line 305]

void addWidgetToScroll( object &$widgetToScroll)

Add a widget to be controlled by the Gtk_Styled_ScrollBar.

It doesn't make much sense to have a scroll bar with nothing to scroll. This method puts the Gtk_Styled_ScrollBar incharge of the $widgetToScroll. The widget to scroll should obviously be scrollable. The Gtk_Styled_ScrollBar will only control scrolling in one direction. Which direction depends on what type of Gtk_StyleAdjustment was passed on construction. To fully control all directions of scrolling, you must add the widget to scroll to two different Gtk_Styled_ScrollBars.

  • Access: public

Parameters:

object   &$widgetToScroll   — 

[ Top ]

getLessButton   [line 284]

&object &getLessButton( none 0)

Return the 'less' button.
  • Access: public

Parameters:

none   0   — 

[ Top ]

getMoreButton   [line 272]

&object &getMoreButton( none 0)

Return the 'more' button.
  • Access: public

Parameters:

none   0   — 

[ Top ]

getWidget   [line 539]

&object &getWidget( none 0)

Get the final product that the user can use.

To make things easier for the user, and to keep some consistency with other PEAR Gtk classes, the final usable object is called widget and is returned from the getWidget method.

  • Access: public

Parameters:

none   0   — 

[ Top ]

setAdjFromAdj   [line 517]

void setAdjFromAdj( object &$adj)

Set the styleAdjustment values based off of a GtkAdjustment.
  • Access: public

Parameters:

object   &$adj   —  The GtkAdjustment to get the values from.

[ Top ]

setAdjValue   [line 439]

void setAdjValue( object $event, double $value, [ $continue = false])

Set the value of the adjustment and styleAdjustment.

Sets the value of the "real" adjustment and the style adjustment. By setting the value of the adjustment, the scrolling widget will move as if it has been scrolled. This makes it easier to fake the scrolling action as if it were done by the style adjustment.

  • Access: public

Parameters:

object   $event   —  The GdkEvent that occured to make the value change
double   $value   —  The new value for the adjustments.
   $continue   — 

[ Top ]

setAdjValueFromAdj   [line 505]

void setAdjValueFromAdj( object &$adj)

Set the styleAdjustment value based on the value of a GtkAdjustment object.

In order to keep the styleAdjustment in sync with the scrolling widget, the value must be taken from the GtkAdjustment that controls the GtkScrollbar.

  • Access: public

Parameters:

object   &$adj   —  The GtkAdjustment to get the value from.

[ Top ]

setAdjValueMouse   [line 389]

void setAdjValueMouse( none 0)

Set the adjustment value based on the mouse position.

When the scrollbar is being dragged to change its value the change in mouse position should influence an equal change in bar position. In other words one pixel change in mouse position does not necessarily translate to one pixel change in bar position.

  • Access: public

Parameters:

none   0   — 

[ Top ]

setButtonContents   [line 215]

widget setButtonContents( object &$button, object &$widget)

Set the pixmap image of a button.

The method allows the user to set the contents of the button. Each button should have an image visually indicating what affect it will have on the value of the adjustment. By default these image are triangles pointing in the direction that they will move the scroll bar. The user may supply any image they desire and may also change the shape of the button using the setButtonMask() method.

  • Return: The previous widget in the button.
  • Access: public

Parameters:

object   &$button   —  The button to set the image for.
object   &$widget   —  The new contents of the button.

[ Top ]

setButtonMask   [line 260]

void setButtonMask( object &$button, object &$mask, [integer $x = 0], [integer $y = 0])

Set the pix mask of one of the buttons.

The user may control the shape of the scrollbar buttons by adding a pix mask. By default the buttons are grey squares but by using this method and setButtonContents it is possible to make the button any shape and/or color desired.

The button that passed to this method should be the return value from one of getLessButton() or getMoreButton().The x and y parameters will offset the mask from the upper left corner.

  • Access: public

Parameters:

object   &$button   —  The button whose shape is to be changed.
object   &$mask   —  The mask to apply to the button.
integer   $x   —  The offset from the left edge.
integer   $y   —  The offset from the top edge.

[ Top ]

setButtonStyle   [line 236]

void setButtonStyle( object &$button, object &$style)

Set the style of one of the buttons.

The whole purpose of this class is to allow you to set the style of a the widget. The track and bar styles are set in the Adjustment. The button styles can be set here.

  • Access: public

Parameters:

object   &$button   — 
object   &$style   — 

[ Top ]

stopValue   [line 478]

void stopValue( none 0)

Stop incrementing the value.

This method kills the timeout that is calling the setAdjValue method. This will stop the scrollbar from moving after the user has released the button or moved the mouse outside of the track.

  • Access: public

Parameters:

none   0   — 

[ Top ]


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