widget class

# widget class Base class for all widgets
Inherits
object
Description
This object class is the representation 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.
`$repaint()`
Repaints the widget directly by calling $paintEvent() immediately.
`$update([<x:ingeter>,<y:integer>,<width:integer>,<height:integer>])`
Updates enterily the widget or a rectangle. This function does not cause an immediate $paintEvent(); instead it schedules a paint event for processing when KVIrc returns to the main event loop.
`$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_or_array>,[<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_or_array>[,<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(<w_or_array>,[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.
`$setWindowTitle(<text>)`
Sets the title of this widget to <text>. This is meaningful for toplevel widgets only.
`$setToolTip(<tooltip_text>)`
Set the tooltip of this widget; the text can contain HTML formatting.
`$windowTitle()`
Returns the title 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(<rgb(hex string)_array(red:integer,green:integer,blue_integer)_or_red>,[geen:integer],[blue:integer])`
Sets the background color of this widget to <rgb_value>:valid values are: - hex string: 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. - array(red:integer,green:integer,blue:integer) - red:integer,green:integer,blue:integer. See also $foregroundColor.
`$setForegroundColor(<rgb(hex string)_array(red:integer,green:integer,blue_integer)_or_red>,[geen:integer],[blue:integer])`
Sets the foreground color of this widget to <rgb_value>:valid values are: - hex string: 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. - array(red:integer,green:integer,blue:integer) - red:integer,green:integer,blue:integer. See also $foregroundColor.
`$foregroundColor()`
Returns the foreground color of this widget in hexadecimal html-like format. See also $setForegroundColor.
`$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(<x>,<y>)`
This function is called when the mouse cursor moves inside this widget. The <x> and <y> coordinates are relative to this widget upper-left corner and are expressed in pixels. If you call "return$true" 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 "return $true" 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 "return $true" 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 "return $true" 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 "return $true" 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 "return $true" 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 "return $true" 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 "return $true" 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 "return $true" 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 "return $true" you will stop the internal processing of this event. The default implementation does nothing.
`$paintEvent(<painter:h_object>,<rect_x:integer>,<rect_y:integer>,<width:integer>,<height:integer>)`
This event handler can be reimplemented to repaint all or part of the widget. It's needed by the Painter class. It's very useful for drawing flicker free animations or low level special graphic effects. The framework will pass as parameter a painterobject. You don't need to begin/end/delete the painter. If you call "return $true" you will stop the internal processing of this event. The default implementation does nothing.
`$setParent(<widget_object:parent>)`
Sets the parent of the widget to parent
`$setWindowIcon(<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
`$setFont(<family:string>,<size:integer>[,<style1:string>, <style2:string>, ...])`
Set the font's family,size and style, valid flag for style are: - italic, bold, underline, overline, strikeout, fixedpitch
`$setWFlags(<flag1>, <flag2>, ...)`
This function sets widget flags, given as parameters. Valid flags are:
     TopLevel        - indicates that this widget is a top-level widget
     Dialog          - indicates that this widget is a top-level window that should be decorated as a dialog
     Desktop         - indicates that this widget is the desktop
     Popup           - indicates that this widget is a popup top-level window
     Title           - gives the window a title bar
     StaysOnTop      - window stays on top
     SysMenu         - add a windows system menu
     Minimize        - add a minimize button for the sysmenu style
     Maximize        - add a maximixe button for the sysmenu style
`$centerToScreen()`
Centers the window on the screen (useful only for toplevel widgets). The best place to call this function is in $showEvent()
`$setFocusPolicy(<key focus>)`
Sets the way the widget accepts keyboard focus. Valid parameters are:
     - TabFocus;    (widget accepts keyboard focus by tabbing)
     - ClickFocus; (widget accepts keyboard focus by clicking)
     - StrongFocus; (widget accepts both tabbing/clicking)
     - No Focus;  (widget does not accept focus at all; this is the default value)
`$keyPressEvent(<key>)`
If widget accepts keyboard focus (see $setFocusPolicy ) this function handles for keys; In its argument the key pressed. Special keys are:
     - Return
     - Enter
     - Down (cursor arrow down)
     - Up   (cursor arrow up)
     - Left (cursor arrow left)
     - Right (cursor arrow right)
     - Shift
     - Ctrl
     - Alt
     - CapsLock
     - Backspace
     - Del
     - Esc
     - 0
     - 1
     - 2
     - 3
     - 4
     - 5
     - 6
     - 7
     - 8
     - 9
     - +
     - -
     - *
     - /
     - (
     - )
     - =
     - .
     - ^
`$mapFromGlobal(<x>,<y>)`
Translates the global screen coordinate pos to widget coordinates.
`$mapToGlobal(<x>,<y>)`
Translates widget coordinates into the global screen coordinate pos.
`integer $globalCursorX()`
Return the x coordinate of mouse pointer global position.
`integer $globalCursorY()`
Return the y coordinate of the mo>use pointer global position.
`<tip:string> $maybeTipEvent(<x_tip_pos:integer>,<y_tip_pos:integer>)`
This event handler is called when a eventualy tip is going to be show. You can be reimplement this event and set a dynamic tool tip by using "return <tooltip_string>". If a tooltip has setted with $setTooltip the dynamic tooltip will be ignored. The default implementation does nothing.
`integer $setAttribute(<string>,<bool_flag>)`
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute. Valid attributes are: OpaquePaintEvent - Indicates that the widget paints all its pixels when it receives a paint event. NoSystemBackground - Indicates that the widget has no background, i.e. when the widget receives paint events, the background is not automatically repainted. PaintOnScreen - Indicates that the widget wants to draw directly onto the screen. NoMousePropagation - Prohibits mouse events from being propagated to the widget's parent.
`$setStyleSheet(<string>)`
Set a style sheet for this widget.
`$customContextMenuRequestedEvent(<x_mouse_pos:integer>,<y_mouse_pos:integer>)`
This event is triggered when the user has requested a context menu on the widget (i.e. right clicking on the widget). The x,y coordinates are widget relative.
`$array(<red:integer,green:integer,blue:integer) $colorPalette(<color_role:string><color_group:string>)`
Returns the color in color_group(disabled, active or inactive), used for color_role. Valid color role are: Window - A general background color. WindowText - A general foreground color. Base - Used as the background color for text. Text - Used as foreground color for the text. Button - The general button background color. ButtonText - A foreground color used with the Button color. Highlight - A color to indicate a selected item or the current item. HighlightedText - A text color that contrasts with Highlight.
`<short_cut_id:integer> $setKeyShortCut(<key:char>)`
Adds a shortcut whith key. A $shortCutEvent will be triggered when the user will press alt+key.
`$shortCutEvent(<shortcut_id:integer>)`
This function will be called when a shortcut key has been triggered. You must reimplement this event to manage a shortcut system in a custom widget. The default implementation does nothing.
`$insertIntoStatusBar(<index:unsigned integer>)`
Insert the widget into the statusbar at the given index. If index is out of range, the widget is appended. See also $removeFromStatusBar().
`$removeFromStatusBar()`
Remove the widget from statusbar.
Examples
        %widget = $new(widget)
        # This is the main container for other elements.
        %widget->$setWindowTitle("This is the widget title")
        %box=$new(vbox,%widget)
        %layout=$new(layout,%widget)
        %layout->$addWidget(%box,0,0)
        %label = $new(label,%box)
        %label->$setText("This is a text label")
        %lineedit = $new(lineedit,%box)
        %lineedit->$setText("This is a lineedit")
        %multilineedit = $new(multilineedit,%box)
        %multilineedit->$setText("This is a multilineedit")
        %checkbox = $new(checkbox,%box)
        %checkbox->$setText("This is a checkbox")
        %combobox = $new(combobox,%box)
                    %combobox->$insertItem("This is a combobox")
                    %combobox->$insertItem("This is a combobox's item")
        %listbox = $new(listbox,%box)
                    %listbox->$insertItem("This is a listbox item")
                    %listbox->$insertItem("This is another item")
        %radiobutton = $new(radiobutton,%box)
        %radiobutton->$setText("This is a radiobutton")
        %button = $new(button, %box)
        %button->$setText("Close me")
        privateimpl(%widget,closeMe)
        {
            delete $$
        }
        objects.connect  %button clicked %widget closeMe
        %widget->$show()

Index, Object Classes

KVIrc 4.2.0.6190 Documentation
Generated by builduser at Sun Jun 5 17:19:09 2016