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"
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.
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.
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.
The GdkEvent that occured to make the value change
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.
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.
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.