# widget class

Base class for all widgets

Inherits
object
Description
This object class is the rappresentation of a widget. All the other widget-type classes inherit from this one.
Functions

`$show()`
Shows this widget and the children. See also $hide() and $isVisible.
`$hide()`
Hides this widget (and conseguently all the children). See also $show() and $isVisible.
`$x()`
Returns the x coordinate of the upper-left corner of this widget relative to the parent widget, or to the desktop if this widget is a toplevel one.
`$y()`
Returns the y coordinate of the uspper-left corner of this widget relative to the parent widget, or to the desktop if this widget is a toplevel one.
`$width()`
Returns the width of this widget in pixels.
`$height()`
Returns the height of this widget in pixels.
`$geometry()`
Returns the widget geometry in this form: x, y, width, height.
`$setGeometry(<x>,<y>,<width>,<heigth>)`
Sets the geometry of this widget. <x> and <y> are relative to the parent widget or to the desktop (if this widget is a toplevel one). All the parameters are in pixels.
`$setMinimumWidth(<value>)`
Sets the minimum width of this widget to <value>. The user will not be able to resize the widget to a smaller value. This value is also used by the layout class.
`$setMinimumHeight(<value>)`
Sets the minimum height of this widget to <value>. The user will not be able to resize the widget to a smaller value. This value is also used by the layout class.
`$setMaximumWidth(<value>)`
Sets the maximum width of this widget to <value>. The user will not be able to resize the widget to a bigger value. This value is also used by the layout class.
`$setMaximumHeight(<value>)`
Sets the maximum height of this widget to <value>. The user will not be able to resize the widget to a bigger value. This value is also used by the layout class.
`$move(<x>,<y>)`
Moves this widget to the coordinate <x> and <y> relative to its parent widget (or the desktop if this widget is a toplevel one). This is equivalent to $setGeometry(<x>,<y>, $width(),$height()).
`$resize(<width>,<height>)`
Changes the widget's width to <width> and height to <height>. See also $setGeometry().
`$isEnabled()`
Returns '1' if the widget is enabled , '0' otherwise. See also $setEnabled().
`$setEnabled(<bool>)`
Sets the widget state to enabled or disabled if <bool> is 1 or 0 respectively. A disabled widget does not receive keyboard nor mouse input.
`$setCaption(<text>)`
Sets the caption of this widget to <text>. This is meaningful for toplevel widgets only.
`$caption()`
Returns the caption text of this widget.
`$isTopLevel()`
Returns '1' if this widget is a toplevel (parentless) one, '0' otherwise.
`$isVisible()`
Returns '1' if this widget is currently visible (read: is managed by the window manager and displayed by the X server; the widget may be hidden behind other widgets). If the widget is not visible this function returns '0'. See also $show() and $hide().
`$raise()`
Moves this widget to the top of the stack of the widgets relative to its parent. See also $lower.
`$lower()`
Moves this widget to the bottom of the stack of the widgets relative to its parent. See also $raise
`$hasFocus()`
Returns '1' if this widget has the keyboard focus. See also $setFocus.
`$setFocus()`
Sets this widget to be the one that receives keyboard events. See also $hasFocus
`$parentWidget()`
Returns the object id of the parent widget, or '0' if this widget is a toplevel one.
`$backgroundColor()`
Returns the background color of this widget in hexadecimal html-like format. For example , for a black bacground you will get the string "000000" , for a red one , "FF0000", for a white one "FFFFFF". See also $setBackgroundColor()
`$setBackgroundColor(<color>)`

Sets the background color of this widget to <color>. <color> must be a string with 6 hexadecimal digits (like the ones used to specify colors in html pages). The first two digits specify the RED component, the third and fourth digit specify the GREEN component and the last two specify the BLUE component. For example "FFFF00" means full red, full green and no blue that gives a yellow color, "808000" designates a brown color (dark yellow), "A000A0" is a kind of violet. See also $backgroundColor.

`$setMouseTracking(<bool>)`
Enables or disables the mouse tracking if <bool> is '1' or '0' respectively. When mouse tracking is enabled you will receive mouse move events even if no button is pressed, otherwise you will receive it only when a mouse button is being pressed (so after a mousePressEvent).
`$mousePressEvent(<button>,<x>,<y>)`

This function is called when a mouse button is pressed while the cursor is in this widget. <button> is 0 if the pressed button is the left one, 1 if the button is the right one and 2 if it is the middle one. The <x> and <y> coordinates are relative to this widget upper-left corner and are expressed in pixels. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.

`$mouseReleaseEvent(<button>,<x>,<y>)`

This function is called when a mouse button is released while the cursor is in this widget. <button> is 0 if the released button is the left one, 1 if the button is the right one and 2 if it is the middle one. The <x> and <y> coordinates are relative to this widget upper-left corner and are expressed in pixels. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.

`$mouseDoubleClickEvent(<button>,<x>,<y>)`

This function is called when a mouse button is double clicked while the cursor is in this widget. <button> is 0 if the double clicked button is the left one, 1 if the button is the right one and 2 if it is the middle one. The <x> and <y> coordinates are relative to this widget upper-left corner and are expressed in pixels. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.

`$mouseMoveEvent(<button>,<x>,<y>)`

This function is called when the mouse cursor moves inside this widget. <button> is 0 if the pressed button is the left one, 1 if the button is the right one and 2 if it is the middle one. The special value of -1 indicates that no button is being pressed. The <x> and <y> coordinates are relative to this widget upper-left corner and are expressed in pixels. Normally you will receive this event only if a mouse button is being pressed while moving. If you want to receive it also when the mouse buttons are not pressed, call $setMouseTracking(). If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.

`$focusInEvent()`
This function is called when this widget gains keyboard focus. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.
`$focusOutEvent()`
This function is called when this widget looses keyboard focus. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.
`$mouseLeaveEvent()`
This function is called when the mouse leaves this widget. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.
`$mouseEnterEvent()`
This function is called when the mouse enters this widget. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.
`$showEvent()`
This function is called when this widget is being shown. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.
`$hideEvent()`
This function is called when this widget is being hidden. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.
`$closeEvent()`
This function is called when this widget is going to be closed. If you call "setreturn 1" you will ignore the close event. The default implementation does nothing.
`$resizeEvent()`
This function is called immediately after this widget has been resized. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.
`$moveEvent()`
This function is called immediately after this widget has been moved. If you call "setreturn 1" you will stop the internal processing of this event. The default implementation does nothing.
`$setIcon(<image_id>)`
Sets the icon for this widget. This is meaningful only for toplevel widgets. See the image identifier documentation for the explaination of the <image_id> parameter.
`$setBackgroundImage(<image_id>)`
Sets the background image for this widget. See the image identifier documentation for the explaination of the <image_id> parameter. For some kind of widgets, setting a background pixmap may have no effect or have strange results. Experiment with it. To unset the background image call $setBackgroundColor

Main index, Object class index

KVirc 3.0.0 documentation
Generated by root at Thu Apr 29 12:41:05 2004