|
|
File: g:\Work\WWW\php\tbox\lib/ctextmenu.phps
PHP Documentation - PHP/Toolbox
CTextMenu
CSnippet | +-- CTextMenu
The text menu class.
|
private class CTextMenu extends CSnippet
The text menu class.
It renders horizontal menu of text items.
So, such a menu system is easy (and fast) to design, construct and load.
| $menu = new CTextMenu(array(
| "item_1",
| "item_2",
| ...
| ), "menu", 620, 18, array("0","FFFFFF"), 10
| );
| ...
| $menu->render(20, 20);
It uses div (IE) or layer (NN) tags to implement the items logic.
|
|
|
|
|
|
Fields inherited from CSnippet |
$id |
|
Private Field Summary |
string |
$ITEMUse it to specify the name of global variable that tracks current item. * |
array |
$items |
unknown |
$agent |
|
Public Method Details |
CTextMenu |
public void CTextMenu( array $items, string $menu_class, int $width, int $height, [ array $bgcolor, integer $gap ] )
|
|
Constructs the menu.
|
Parameter |
|
array |
$items |
|
|
- item array: array("item_html_1", ...) is accepted by default. |
string |
$menu_class |
|
|
- CSS class for menu items. |
int |
$width |
|
|
- total width of menu bar. |
int |
$height |
|
|
- height of menu bar. |
array |
$bgcolor |
= >>array()<<
|
|
- item colors: array(NORMAL,HIGHLIGHTED); array("0","FFFFFF") by default. |
integer |
$gap |
= >>0<<
|
|
- the gap between items. |
|
Returns |
void |
|
render |
public void render( [ integer $left, integer $top ] )
|
|
Renders the menu.
|
Parameter |
|
integer |
$left |
= >>0<<
|
|
- the menu absolute x-position. |
integer |
$top |
= >>0<<
|
|
- the menu absolute y-position. |
|
Returns |
void |
|
|
Private Method Details |
getAgent |
private string getAgent( )
|
|
Use it to override default (not very smart :) user agent detection.
Main rendering mehtod use "render_item_$this->agent" method to render the items.
So, it's possible to provide additional item rendering methods to utilize
such a custom detection.
|
Returns |
string |
See Also |
render(), render_item_msie() |
|
render_item |
private string render_item( int $i, mixed $key, string $value )
|
|
Returns the item.
Use it to override default behavior.
|
Parameter |
|
int |
$i |
|
|
- item number. |
mixed |
$key |
|
|
- item key (if it's specified as key=>value). |
string |
$value |
|
|
- item text. |
|
Returns |
string - item html. |
|
render_item_msie |
private void render_item_msie( $i, $key, $value )
|
|
Renders the item for MSIE.
|
Parameter |
|
|
$i |
|
|
No additional comments. |
|
$key |
|
|
No additional comments. |
|
$value |
|
|
No additional comments. |
|
Returns |
void |
See Also |
getAgent() |
|
render_item_ |
private void render_item_( $i, $key, $value )
|
|
Renders the item for NN.
|
Parameter |
|
|
$i |
|
|
No additional comments. |
|
$key |
|
|
No additional comments. |
|
$value |
|
|
No additional comments. |
|
Returns |
void |
See Also |
getAgent() |
|
|
Private Field Details |
$ITEM |
private string $ITEM
>>"ITEM" <<
Use it to specify the name of global variable that tracks current item. *
|
|
$items |
private array $items
>>array() <<
|
|
$agent |
private unknown $agent
>> <<
|
|
|
|
|
PHPDoc 1.0beta |