diff options
Diffstat (limited to 'src/modules/objects')
34 files changed, 988 insertions, 1064 deletions
diff --git a/src/modules/objects/KvsObject_buttonGroup.cpp b/src/modules/objects/KvsObject_buttonGroup.cpp index d2be856c0..a7ec6a034 100644 --- a/src/modules/objects/KvsObject_buttonGroup.cpp +++ b/src/modules/objects/KvsObject_buttonGroup.cpp @@ -51,7 +51,7 @@ !fn: <id:integer> $addButton(<checkbutton or radiobutton:object>) Adds the given button to the button group and returns an unique identifier. !fn: <object> $checkedButton() - Returns the button group's checked button, or 0 if no buttons are checked. + Returns the button group's checked button, or [b]0[/b] if no buttons are checked. */ KVSO_BEGIN_REGISTERCLASS(KvsObject_buttonGroup,"buttongroup","object") diff --git a/src/modules/objects/KvsObject_checkBox.cpp b/src/modules/objects/KvsObject_checkBox.cpp index 3056ae91f..25c605b1f 100644 --- a/src/modules/objects/KvsObject_checkBox.cpp +++ b/src/modules/objects/KvsObject_checkBox.cpp @@ -49,7 +49,7 @@ (unchecked). @functions: !fn: <bool> $isChecked() - Returns '1' if the check box is checked, '0' otherwise.[br] + Returns [b]1[/b] if the check box is checked, and [b]0[/b] otherwise.[br] See also [classfnc]$setChecked[/classfnc](). !fn: $setChecked([<bChecked:bool>]) Sets the check box 'checked state' to <bool>. diff --git a/src/modules/objects/KvsObject_colorDialog.cpp b/src/modules/objects/KvsObject_colorDialog.cpp index 2d37bbadc..97b4bb1ea 100644 --- a/src/modules/objects/KvsObject_colorDialog.cpp +++ b/src/modules/objects/KvsObject_colorDialog.cpp @@ -63,7 +63,7 @@ const int option_cod[] = { (unchecked). @functions: !fn: <bool> $isChecked() - Returns '1' if the check box is checked, '0' otherwise.[br] + Returns [b]1[/b] if the check box is checked, and [b]0[/b] otherwise.[br] See also [classfnc]$setChecked[/classfnc](). !fn: $setChecked([<bChecked:bool>]) Sets the check box 'checked state' to <bool>. diff --git a/src/modules/objects/KvsObject_dateTimeEdit.cpp b/src/modules/objects/KvsObject_dateTimeEdit.cpp index b75fba824..d81692d2e 100644 --- a/src/modules/objects/KvsObject_dateTimeEdit.cpp +++ b/src/modules/objects/KvsObject_dateTimeEdit.cpp @@ -49,34 +49,33 @@ @functions: !fn: $setDate(<text:string>,<format:string>) Sets the date of the widget using the format <format>. Possible values for format are: - [br]d the day as number without a leading zero (1 to 31) - [br]dd the day as number with a leading zero (01 to 31) - [br]ddd the abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses QDate::shortDayName(). - [br]dddd the long localized day name (e.g. 'Monday' to 'Qt::Sunday'). Uses QDate::longDayName(). - [br]M the month as number without a leading zero (1-12) - [br]MM the month as number with a leading zero (01-12) - [br]MMM the abbreviated localized month name (e.g. 'Jan' to 'Dec'). Uses QDate::shortMonthName(). - [br]MMMM the long localized month name (e.g. 'January' to 'December'). Uses QDate::longMonthName(). - [br]yy the year as two digit number (00-99) - [br]yyyy the year as four digit number + [br][b]d[/b]: the day as number without a leading zero (1 to 31) + [br][b]dd[/b]: the day as number with a leading zero (01 to 31) + [br][b]ddd[/b]: the abbreviated localized day name (e.g. [b]Mon[/b] to [b]Sun/b]). Uses QDate::shortDayName(). + [br][b]dddd[/b]: the long localized day name (e.g. [b]Monday[/b] to [b]Sunday[/b]). Uses QDate::longDayName(). + [br][b]M[/b]: the month as number without a leading zero (1-12) + [br][b]MM[/b]: the month as number with a leading zero (01-12) + [br][b]MMM[/b]: the abbreviated localized month name (e.g. [b]Jan[/b] to [b]Dec[/b]). Uses QDate::shortMonthName(). + [br][b]MMMM[/b]: the long localized month name (e.g. [b]January[/b] to [b]December[/b]). Uses QDate::longMonthName(). + [br][b]yy[/b]: the year as two digit number (00-99) + [br][b]yyyy[/b]: the year as four digit number !fn: <string> $date(<format:string>) Returns the widget date according to format. !fn: $setTime(<text:string>,<format:string>) Sets the date of the widget using the format <format>. Possible values for format are: - [br]h the hour without a leading zero - [br]hh the hour with a leading zero - [br]m the minute without a leading zero - [br]mm the minute with a leading zero - [br]s the second without a leading zero - [br]ss the second with a leading zero - [br]z the milliseconds without leading zeroes - [br]zzz the milliseconds with leading zeroes - [br]AP(or ap) use AM/PM display. AP will be replaced by either "AM" or "PM". + [br][b]h[/b]: the hour without a leading zero + [br][b]hh[/b]: the hour with a leading zero + [br][b]m[/b]: the minute without a leading zero + [br][b]mm[/b]: the minute with a leading zero + [br][b]s[/b]: the second without a leading zero + [br][b]ss[/b]: the second with a leading zero + [br][b]z[/b]: the milliseconds without leading zeroes + [br][b]zzz[/b]: the milliseconds with leading zeroes + [br][b]AP / ap[/b]: use AM/PM display. AP will be replaced by either [i]AM[/i] or [i]PM[/i]. !fn: $time(<format:string>) Returns the widget time according to format. */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_dateTimeEdit,"datetimeedit","widget") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dateTimeEdit,date) diff --git a/src/modules/objects/KvsObject_dockWindow.cpp b/src/modules/objects/KvsObject_dockWindow.cpp index dcc97379e..02b0545e8 100644 --- a/src/modules/objects/KvsObject_dockWindow.cpp +++ b/src/modules/objects/KvsObject_dockWindow.cpp @@ -51,14 +51,14 @@ The widget must be a child of this dock window (otherwise strange things may happen). !fn: $setAllowedDockAreas(<docks:string>) Sets the allowed main window dock areas for this dock window.[br] - <docks> must be a combination of "l","r","t","b","f" and "m".[br] - "l" stands for left dock area, "r" stands for right dock area, "t" stands for the top dock areas, "b" stands for the bottom dock area, "f" stands for "floating" and "m" for "minimized".[br] + <docks> must be a combination of [i]l[/i], [i]r[/i], [i]t[/i], [i]b[/i], [b]f[/b] and [b]m[/b].[br] + [b]l[/b] stands for left dock area, [b]r[/b] stands for right dock area, [b]t[/b] stands for the top dock areas, [b]b[/b] stands for the bottom dock area, + [b]f[/b] stands for [i]floating[/i] and [b]m[/b] for [i]minimized[/i].[br] If a flag is present then the related block area is enabled,otherwise it is disabled. !fn: $dock(<dockarea:string>) Docks this dock window to the specified dockarea of the main KVIrc window which can be one of "l" (left dock area), "t" (top dock area), "r" (right dock area), "b" (bottom dock area), "f" (floating) and "m" (minimized). */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_dockWindow,"dockwindow","widget") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dockWindow,addWidget) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_dockWindow,setAllowedDockAreas) diff --git a/src/modules/objects/KvsObject_file.cpp b/src/modules/objects/KvsObject_file.cpp index ba5c5d6ce..e0542287a 100644 --- a/src/modules/objects/KvsObject_file.cpp +++ b/src/modules/objects/KvsObject_file.cpp @@ -75,11 +75,11 @@ const QIODevice::OpenMode mod_cod[] = { [class]object[/class] @description: This object class provides access to files - basic I/O - operations, copying, removing etc... + operations, copying, removing etc. @functions: !fn: $setName(<file_name:string>) Sets the file name to <file_name>. It does [b]not move[/b] the file, - it just changes the file the object is "pointing to". You can + it just changes the file the object is [i]pointing to[/i]. You can not change names of already open files.[br] See also: [classfnc]$open[/classfnc](), [classfnc]$name[/classfnc](). @@ -87,15 +87,15 @@ const QIODevice::OpenMode mod_cod[] = { Returns name set by [classfnc]$setName[/classfnc]().[br] See also: [classfnc]$setName[/classfnc](). !fn: $open(<mode1:string>, <mode2:string>) - Attempts to open the file in specified mode or modes "sum". + Attempts to open the file in specified mode or modes [i]sum[/i]. Valid modes are:[br] [pre] - RAW - RAW, non-buffered access[br] - ReadOnly - opens the file read-only[br] - WriteOnly - opens the file write-only[br] - ReadWrite - opens the file in read-write mode[br] - Append - opens the file in append mode. The file index is set to the end of the file.[br] - Truncate - truncates the file[br] + RAW - RAW, non-buffered access[br] + ReadOnly - opens the file read-only[br] + WriteOnly - opens the file write-only[br] + ReadWrite - opens the file in read-write mode[br] + Append - opens the file in append mode. The file index is set to the end of the file.[br] + Truncate - truncates the file[br] [/pre] If you call this function without any parameters, the file is opened in read-only mode.[br] @@ -116,7 +116,7 @@ const QIODevice::OpenMode mod_cod[] = { !fn: <integer> $size() Returns current file size. !fn: <boolean> $atEnd() - Returns '1' if you have reached end of the file, '0' otherwise. + Returns '1' if you have reached end of the file, [b]0[/b] otherwise. [br]See also: [classfnc]$seek[/classfnc](), [classfnc]$where[/classfnc](). !fn: <integer> $where() @@ -149,7 +149,6 @@ const QIODevice::OpenMode mod_cod[] = { $writeBlock() */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_file,"file","object") KVSO_REGISTER_HANDLER(KvsObject_file,"setName",setName) KVSO_REGISTER_HANDLER(KvsObject_file,"name",name) diff --git a/src/modules/objects/KvsObject_groupBox.cpp b/src/modules/objects/KvsObject_groupBox.cpp index 04e5f31ef..74d9236fe 100644 --- a/src/modules/objects/KvsObject_groupBox.cpp +++ b/src/modules/objects/KvsObject_groupBox.cpp @@ -48,7 +48,6 @@ const int align_cod[] = { #define align_num (sizeof(align_tbl) / sizeof(align_tbl[0])) - /* @doc: groupbox @keyterms: @@ -73,13 +72,13 @@ const int align_cod[] = { !fn: <string> $title() Returns the groupbox title text. !fn: $setFlat(<bflag:boolean>) - Sets whether the group box is painted flat. Valid Values are 1 or 0. + Sets whether the group box is painted flat. Valid Values are [b]1[/b] or [b]0[/b]. !fn: <boolean> $isFlat() - Returns 1 (true) if the groupbox is painted flat; otherwise returns 0 (false). + Returns [b]1[/b] (true) if the groupbox is painted flat; otherwise returns [b]0[/b] (false). !fn: <boolean> $isCheckable() - Returns 1 (true) if the group box has a checkbox in its title; otherwise returns 0 (false). + Returns [b]1[/b] (true) if the group box has a checkbox in its title; otherwise returns [b]0[/b] (false). !fn: $setCheckable(<bflag:boolean>) - Sets whether the groupbox has a checkbox in its title: Valid values are 1 or 0. + Sets whether the groupbox has a checkbox in its title: Valid values are [b]1[/b] or [b]0[/b]. !fn: $setInsideMargin(<margin:uint>) Sets the the width of the inside margin to m pixels. !fn: <integer> $insideMargin() @@ -98,35 +97,35 @@ const int align_cod[] = { Sets the groupbox's orientation. Valid values are: Horizontal, Vertical. @examples: [example] - [comment]//First we'll create the main widget. as a dialog[/comment] + [comment]# First we'll create the main widget. as a dialog[/comment] %widget=$new(dialog) %layout=$new(layout,%widget) - [comment]//Then the groupbox[/comment] + [comment]# Then the groupbox[/comment] %gb=$new(groupbox,%widget) %gb->$setTitle(Login) %gb->$setAlignment("Left") - [comment]//Add the groupbox to the main layout[/comment] + [comment]# Add the groupbox to the main layout[/comment] %layout->$addWidget(%gb,0,0) - [comment]//Now we create the user field + [comment]# Now we create the user field (labels + lineedit) in a horizontal box[/comment] %hbox=$new(hbox,%gb) %labeluser=$new(label,%hbox) %labeluser->$settext(User: ) %inputuser=$new(lineedit,%hbox) - [comment]//Now we create the password field + [comment]# Now we create the password field (labels + lineedit) in a horizontal box[/comment] %hbox=$new(hbox,%gb) %labelpass=$new(label,%hbox) %labelpass->$settext(Pass: ) %inputpass=$new(lineedit,%hbox) %inputpass->$setechomode("password") - [comment]//Now we create the OK/Cancel box buttons[/comment] + [comment]# Now we create the OK/Cancel box buttons[/comment] %hbox=$new(hbox,%gb) %btnok=$new(button,%hbox) %btnok->$settext("OK") %btncancel=$new(button,%hbox) %btncancel->$settext("Cancel") - [comment]//Let's show our nice form[/comment] + [comment]# Let's show our nice form[/comment] %widget->$show() [/example] */ diff --git a/src/modules/objects/KvsObject_http.cpp b/src/modules/objects/KvsObject_http.cpp index 3d01509d2..57bb11d74 100644 --- a/src/modules/objects/KvsObject_http.cpp +++ b/src/modules/objects/KvsObject_http.cpp @@ -100,7 +100,7 @@ The function returns a unique identifier which is passed by [b]requestStartedEvent()[/b] and [b]requestFinishedEvent()[/b]. When the request is started the requestStarted() signal is emitted. When it is finished the requestFinished() signal is emitted. !fn: <id:integer>$currentId() - Returns the identifier of the HTTP request being executed or 0 if there is no request being executed. + Returns the identifier of the HTTP request being executed or [b]0[/b] if there is no request being executed. !fn: <id:integer> $setProxy(<host:string>,<port:integer>,[<user:string>,<password:string>]) Enables HTTP proxy support, using the proxy server host on port port. Optionals parameters user and password can be provided if the proxy server requires authentication. diff --git a/src/modules/objects/KvsObject_label.cpp b/src/modules/objects/KvsObject_label.cpp index 6278a029a..e096604b6 100644 --- a/src/modules/objects/KvsObject_label.cpp +++ b/src/modules/objects/KvsObject_label.cpp @@ -88,7 +88,6 @@ const int frame_cod[] = { #define frame_num (sizeof(frame_tbl) / sizeof(frame_tbl[0])) - /* @doc: label @keyterms: @@ -130,14 +129,14 @@ const int frame_cod[] = { This function sets alignment flags, given as parameters, for this label. Valid flags are: [pre] - Right - Text is aligned to right border[br] - Left - Text is aligned to left border[br] - Top - Text is aligned to the top border[br] - Bottom - Text is aligned to the bottom border[br] - HCenter - Text is horizontally centered[br] - VCenter - Text is vertically centered[br] - Center - Equals HCenter + VCenter[br] - Justify - Text is spaced apart to cover available room[br] + Right - Text is aligned to right border[br] + Left - Text is aligned to left border[br] + Top - Text is aligned to the top border[br] + Bottom - Text is aligned to the bottom border[br] + HCenter - Text is horizontally centered[br] + VCenter - Text is vertically centered[br] + Center - Equals HCenter + VCenter[br] + Justify - Text is spaced apart to cover available room[br] [/pre] It is obvious that you can not set [i]Right[/i] and [i]Left[/i] simultaneously - this will [b]not[/b] @@ -156,22 +155,17 @@ const int frame_cod[] = { The flags determine the shape or shadow of the label's frame. Valid shape flags are:[br] [pre] - NoFrame - Draw no frame. You shouldn't specify a shadow when - using this.[br] - Box - Draws a rectangular box. Its borders can be - [i]Raised[/i] or [i]Sunken[/i][br] - Panel - Draws a rectangular panel which can be - [i]Raised[/i] or [i]Sunken[/i][br] - WinPanel - Similar to [i]Panel[/i], but is more in Win95 style[br] - Hline - Draws a horizontal line that frames nothing (useful as separator) + NoFrame - Draw no frame. You shouldn't specify a shadow when using this.[br] + Box - Draws a rectangular box. Its borders can be [i]Raised[/i] or [i]Sunken[/i][br] + Panel - Draws a rectangular panel which can be [i]Raised[/i] or [i]Sunken[/i][br] + WinPanel - Similar to [i]Panel[/i], but is more in Win95 style[br] + Hline - Draws a horizontal line that frames nothing (useful as separator) [/pre] Valid shadow flags are:[br] [pre] - Plain - No 3D effect (draws using foreground color)[br] - Raised - Makes the label look like it was raised above the - parent widget[br] - Sunken - Makes the label look like it was [i]pushed[/i] inside - the parent widget[br] + Plain - No 3D effect (draws using foreground color)[br] + Raised - Makes the label look like it was raised above the parent widget[br] + Sunken - Makes the label look like it was [i]pushed[/i] inside the parent widget[br] [/pre] !fn: $setImage(<image_id>) Sets the image to be displayed on this label. @@ -181,7 +175,6 @@ const int frame_cod[] = { */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_label,"label","widget") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_label,setText) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_label,text) diff --git a/src/modules/objects/KvsObject_layout.cpp b/src/modules/objects/KvsObject_layout.cpp index 67ddfa4e3..4953bfba0 100644 --- a/src/modules/objects/KvsObject_layout.cpp +++ b/src/modules/objects/KvsObject_layout.cpp @@ -54,6 +54,7 @@ const int align_cod[] = { Qt::AlignBottom, }; #define align_num (sizeof(align_tbl) / sizeof(align_tbl[0])) + /* @doc: layout @keyterms: @@ -100,13 +101,14 @@ const int align_cod[] = { !fn: $setResizeMode(<resize_mode:string>) Sets the resize mode of the parent widget in relation to this layout. <mode> can be one of:[br] - -Auto: this is the default[br] - -Fixed: the parent widget of this layout is resized to the "sizeHint" value and it cannot be resized by the user.[br] - -Minimum: the minimum size of the parent widget of this layout is set to minimumSize() and it cannot be smaller[br] - -FreeResize: the parent widget of this layout is not constrained at all[br] + [pre] + -Auto: this is the default[br] + -Fixed: the parent widget of this layout is resized to the "sizeHint" value and it cannot be resized by the user.[br] + -Minimum: the minimum size of the parent widget of this layout is set to minimumSize() and it cannot be smaller[br] + -FreeResize: the parent widget of this layout is not constrained at all[br] + [/pre] */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_layout,"layout","object") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_layout,addWidget) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_layout,addMultiCellWidget) diff --git a/src/modules/objects/KvsObject_lineEdit.cpp b/src/modules/objects/KvsObject_lineEdit.cpp index 8a194cef7..f6ccd00c3 100644 --- a/src/modules/objects/KvsObject_lineEdit.cpp +++ b/src/modules/objects/KvsObject_lineEdit.cpp @@ -44,7 +44,6 @@ static const int mode_cod[] = { #define mode_num (sizeof(mode_tbl) / sizeof(mode_tbl[0])) - /* @doc: lineedit @keyterms: @@ -72,9 +71,11 @@ static const int mode_cod[] = { See also [classfnc]$text[/classfnc](). !fn: $setEchoMode(<echo_mode:string>) Sets the line edit's echo mode. Possible value are:[br] - -Normal: display chars as they entered[br] - -Noecho: do not display anything[br] - -Password: display asterisks instead of the characters actually entered[br] + [pre] + -Normal: display chars as they entered[br] + -Noecho: do not display anything[br] + -Password: display asterisks instead of the characters actually entered[br] + [/pre] See also [classfnc]$echoMode[/classfnc](). !fn: <string> $echoMode() Return the line edit's echo mode. @@ -134,29 +135,29 @@ static const int mode_cod[] = { Sets the validation input mask to inputMask.[br] [b]Example:[/b][br] [example] - %ledit_example->$setInputMask( "+99 99 99 99 99;_" );[br] - %ledit_example->$setInputMask( "000.000.000.000;_" );[br] - %ledit_example->IP Number Mask.[br] - %ledit_example->setInputMask( ">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#" ); + %ledit_example->$setInputMask( "+99 99 99 99 99;_" );[br] + %ledit_example->$setInputMask( "000.000.000.000;_" );[br] + %ledit_example->IP Number Mask.[br] + %ledit_example->setInputMask( ">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#" ); [/example] The mask format understands these mask characters:[br] [example] - [b][comment]Character Meaning[/comment][/b][br] - A - ASCII alphabetic character required. A-Z, a-z.[br] - a - ASCII alphabetic character permitted but not required.[br] - N - ASCII alphanumeric character required. A-Z, a-z, 0-9.[br] - n - ASCII alphanumeric character permitted but not required.[br] - X - Any character required.[br] - x - Any character permitted but not required.[br] - 9 - ASCII digit required. 0-9.[br] - 0 - ASCII digit permitted but not required.[br] - D - ASCII digit required. 1-9.[br] - d - ASCII digit permitted but not required.[br] - # - ASCII digit or plus/minus sign permitted but not required.[br] - > - All following alphabetic characters are uppercased.[br] - < - All following alphabetic characters are lowercased.[br] - ! - Switch off case conversion.[br] - \ - Use \ to escape the special characters listed above to use them as separators. + [b][comment]Character Meaning[/comment][/b][br] + A - ASCII alphabetic character required. A-Z, a-z.[br] + a - ASCII alphabetic character permitted but not required.[br] + N - ASCII alphanumeric character required. A-Z, a-z, 0-9.[br] + n - ASCII alphanumeric character permitted but not required.[br] + X - Any character required.[br] + x - Any character permitted but not required.[br] + 9 - ASCII digit required. 0-9.[br] + 0 - ASCII digit permitted but not required.[br] + D - ASCII digit required. 1-9.[br] + d - ASCII digit permitted but not required.[br] + # - ASCII digit or plus/minus sign permitted but not required.[br] + > - All following alphabetic characters are uppercased.[br] + < - All following alphabetic characters are lowercased.[br] + ! - Switch off case conversion.[br] + \ - Use \ to escape the special characters listed above to use them as separators. [/example] The mask consists of a string of mask characters and separators, optionally[br] followed by a semi-colon and the character used for blanks: the blank characters[br] @@ -188,8 +189,6 @@ static const int mode_cod[] = { This signal is emitted by the default implementation of [classfnc]$textChangedEvent[/classfnc](). */ - - KVSO_BEGIN_REGISTERCLASS(KvsObject_lineEdit,"lineedit","widget") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_lineEdit,text) diff --git a/src/modules/objects/KvsObject_listWidget.cpp b/src/modules/objects/KvsObject_listWidget.cpp index 7b846df13..59c860509 100644 --- a/src/modules/objects/KvsObject_listWidget.cpp +++ b/src/modules/objects/KvsObject_listWidget.cpp @@ -69,14 +69,14 @@ const char * const itemflags_tbl[] = { @description: The listbox class is a widget displaying a list of string items.[br] The listbox can operate in four selection modes: single, multi, extended - and none. In the "single" mode only one item can be selected at a time - and that item is also the current one. In the "multi" mode multiple + and none. In the [i]single[/i] mode only one item can be selected at a time + and that item is also the current one. In the [i]multi[/i] mode multiple items can be selected and unselected and the current item may or may not - be one of the selected items. In the "extended" mode multiple items + be one of the selected items. In the [i]extended[/i] mode multiple items can be selected but they must be selected in a single mouse action or by keeping the shift button pressed while clicking on the item. In this mode the current item is always one of the selected items.[br] - In the "none" mode no items can be selected and the current item + In the [i]none[/i] mode no items can be selected and the current item may be any item in the list.[br] In most situations you will operate the listwidget in [i]single[/i] mode (and this is the default mode set at widget creation). @@ -84,23 +84,23 @@ const char * const itemflags_tbl[] = { !fn: $setSelectionMode(<selection_mode:string>) Sets the current selection mode specified by the parameter <mode> that can be one of the following string:[br] - "single" : only one item can be selected at a time[br] - "multi" : multiple items can be selected at a time[br] - "extended" : multiple items can be selected but only in a single mouse interaction[br] - "none" : no items can be selected[br] - The default mode is "single" + [b]single[/b]: only one item can be selected at a time[br] + [b]multi[/b]: multiple items can be selected at a time[br] + [b]extended[/b]: multiple items can be selected but only in a single mouse interaction[br] + [b]none[/b]: no items can be selected[br] + The default mode is [i]"single" !fn: $setFlag(<idx:integer>,<flag1:string>, <flag2:string>, ...) Sets the flags for the item at index idx to the given flags. These determine whether the item can be selected or modified. This is often used to disable an item.[br] Supported flags are: [example] - [br]- noitemflag : no flag sets; - [br]- selectable : item is selectable; - [br]- editable : item is editable; - [br]- dragEnabled : item can dragged; - [br]- dropEnabled : item can used as drop target; - [br]- userCheckable : item is checkable; - [br]- enabled :item is enabled; - [br]- tristate : item is checkable with three separate states. + - noitemflag : no flag sets;[br] + - selectable : item is selectable;[br] + - editable : item is editable;[br] + - dragEnabled : item can dragged;[br] + - dropEnabled : item can used as drop target;[br] + - userCheckable : item is checkable;[br] + - enabled :item is enabled;[br] + - tristate : item is checkable with three separate states. [/example] !fn: $setChecked(<checkstate:bool>) Sets the eventual item check box 'checked state' to <bool>. @@ -153,8 +153,7 @@ const char * const itemflags_tbl[] = { This signal is emitted by the default implementation of [classfnc]$itemEnteredEvent[/classfnc]().[br] !sg: <string> $selectionChanged() This signal is emitted by the default implementation of [classfnc]$selectionChangedEvent[/classfnc]().[br] - */ - +*/ KVSO_BEGIN_REGISTERCLASS(KvsObject_listWidget,"listbox","widget") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_listWidget,insertItem) diff --git a/src/modules/objects/KvsObject_multiLineEdit.cpp b/src/modules/objects/KvsObject_multiLineEdit.cpp index c6a77fff6..9bef80f03 100644 --- a/src/modules/objects/KvsObject_multiLineEdit.cpp +++ b/src/modules/objects/KvsObject_multiLineEdit.cpp @@ -64,22 +64,22 @@ Sets the editor to be read-only if bReadOnly is 1 or removes the read-only status if bReadOnly is 0 !fn: <boolean> $atBeginning() - Returns 1 (true) if the cursor is placed at the beginning of the text; otherwise returns 0 (false). + Returns [b]1[/b] (true) if the cursor is placed at the beginning of the text; otherwise returns [b]0[/b] (false). !fn: <boolean> $atEnd() - Returns 1 (true) if the cursor is placed at the end of the text; otherwise returns 0 (false). + Returns [b]1[/b] (true) if the cursor is placed at the end of the text; otherwise returns [b]0[/b] (false). !fn: $setWordWrap(<wrap_mode:string>) Sets the word wrap mode to mode.[br] Valid Values are:[br] [example] - - NoWrap - Do not wrap the text.[br] - - WidgetWidth - Wrap the text at the current width of the widget.[br] - - FixedPixelWidth - Wrap the text at a fixed number of pixels from the widget's left side.[br] - - FixedColumnWidth - Wrap the text at a fixed number of character columns from the widget's left side. + - NoWrap - Do not wrap the text.[br] + - WidgetWidth - Wrap the text at the current width of the widget.[br] + - FixedPixelWidth - Wrap the text at a fixed number of pixels from the widget's left side.[br] + - FixedColumnWidth - Wrap the text at a fixed number of character columns from the widget's left side. [/example] !fn: <string> $wordWrap() Returns the word wrap mode. NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth. !fn: <string> $text() - Returns the multiline edit's text. + Returns the multiline edits text. !fn: <integer> $length() Returns the number of characters in the text This function ignores newlines. !fn: $setMaxLines(<mac_lines:integer>) @@ -99,17 +99,17 @@ !fn: $setFamily(<font_family:string>) Sets the font family of the current format to fontFamily. !fn: $setItalic(<bItalic:boolean>) - If the bool value is 1 sets the current format to italic; otherwise, if it's 0 sets the current format to no-italic. + If the bool value is [b]1[/b] sets the current format to italic; otherwise, if it's [b]0[/b] sets the current format to no-italic. !fn: $setBold(<bBold:boolean>) - If the bool value is 1 sets the current format to bold; otherwise, if it's 0 sets the current format to no-bold. + If the bool value is [b]1[/b] sets the current format to bold; otherwise, if it's [b]0[/b] sets the current format to no-bold. !fn: $setUnderline(<bUnderline:boolean>) - If the bool value is 1 sets the current format to underline; otherwise, if it's 0 sets the current format to no-underline. + If the bool value is [b]1[/b] sets the current format to underline; otherwise, if it's [b]0[/b] sets the current format to no-underline. !fn: <boolean> $italic() - Returns 1 (true) if the current format is italic; otherwise returns 0 (false). + Returns [b]1[/b] (true) if the current format is italic; otherwise returns [b]0[/b] (false). !fn: <boolean> $bold() - Returns 1 (true) if the current format is bold; otherwise returns 0 (false). + Returns [b]1[/b] (true) if the current format is bold; otherwise returns [b]0[/b] (false). !fn: <boolean> $underline() - Returns 1 (true) if the current format is underline; otherwise returns 0 (false). + Returns [b]1[/b] (true) if the current format is underline; otherwise returns [b]0[/b] (false). !fn: $zoomIn(<zoom_range:integer>) Zooms in on the text by making the base font size range points larger. !fn: $zoomOut(<zoom_range:integer>) @@ -123,7 +123,7 @@ !fn: $setUndoRedoEnabled(<bUndoRedo:boolean>) Sets whether undo/redo is enabled to the bool value. !fn: <boolean> $isUndoRedoEnabled() - Returns 1 (true) if undo/redo is enabled; otherwise returns 0 (false). + Returns [b]1[/b] (true) if undo/redo is enabled; otherwise returns [b]0[/b] (false). !fn: <integer> $undoDepth() Returns the depth of the undo history. !fn: $setText(<txt:string>) @@ -142,7 +142,7 @@ !fn: $setPointSize(<point_size:integer)) Sets the point size of the font. !fn: $setLinkUnderline(<bLinkUnderline:boolean>) - Sets to 1 if you want that hypertext links will be underlined; otherwise sets to 0. + Sets to [b]1[/b] if you want that hypertext links will be underlined; otherwise sets to [b]0[/b]. !fn: $setTextFormat(<textformat:string>) Sets the text format. Correct values are RichText, PlainText. !fn: <string> $textFormat() @@ -150,27 +150,27 @@ !fn: $loadFile(<path:string>) Load the file specified in the <path>, also HTML files. !fn: <boolean> $isUndoAvailable () - Returns 1 (true) if undo is available; otherwise returns 0 (false). + Returns [b]1 (true)[/b] if undo is available; otherwise returns [b]0 (false)[/b]. !fn: <boolean> $isRedoAvailable () - Returns 1 (true) if redo is available; otherwise returns 0 (false). + Returns [b]1 (true)[/b] if redo is available; otherwise returns [b]0 (false)[/b]. !fn: <integer> $lines() Returns the number of lines in the multilineedit. !fn: <integer> $lineOfChar(<paragraph:integer>,<index:integer>) Returns the line number of the line in paragraph par in which the character at position index appears.[br] - If there is no such paragraph or no such character at the index position -1 is returned. + If there is no such paragraph or no such character at the index position [b]-1[/b] is returned. !fn: $setModified(<bModified:boolean>) - Sets whether the document has been modified by the user. Valid Values are 1 (true) or 0 (false) + Sets whether the document has been modified by the user. Valid Values are [b]1 (true)[/b] or [b]0 (false)[/b]. !fn: $setAlignment(<alignment:string>) - Sets the alignment of the current paragraph to <alignment>. - Valid values are: + Sets the alignment of the current paragraph to <alignment>.[br] + Valid values are: [example] - - Auto - Aligns according to the language.[br] - - Left - Aligns with the left edge.[br] - - Right - Aligns with the right edge.[br] - - Center - Centers in both dimensions. - - Justify - Justify the text. + - Auto - Aligns according to the language.[br] + - Left - Aligns with the left edge.[br] + - Right - Aligns with the right edge.[br] + - Center - Centers in both dimensions. + - Justify - Justify the text. [/example] - */ +*/ KVSO_BEGIN_REGISTERCLASS(KvsObject_textedit,"multilineedit","widget") diff --git a/src/modules/objects/KvsObject_painter.cpp b/src/modules/objects/KvsObject_painter.cpp index 183e5e276..2d64ea223 100644 --- a/src/modules/objects/KvsObject_painter.cpp +++ b/src/modules/objects/KvsObject_painter.cpp @@ -201,7 +201,6 @@ const char * const brushstyles_tbl[] = { #define brushstyles_num (sizeof(brushstyles_tbl) / sizeof(brushstyles_tbl[0])) - /* @doc: painter @keyterms: @@ -238,10 +237,10 @@ const char * const brushstyles_tbl[] = { All parameters are in integer form. The HSV system, like RGB, has three components:[br] [pre] - * H, for hue, is either 0-359 if the color is chromatic (not gray), or meaningless if it is gray.[br] - It represents degrees on the color wheel familiar to most people. Red is 0 (degrees), green is 120 and blue is 240.[br] - * S, for saturation, is 0-255, and the bigger it is, the stronger the color is. Grayish colors have saturation near 0; very strong colors have saturation near 255.[br] - * V, for value, is 0-255 and represents lightness or brightness of the color. 0 is black; 255 is as far from black as possible.[br] + * H, for hue, is either 0-359 if the color is chromatic (not gray), or meaningless if it is gray.[br] + It represents degrees on the color wheel familiar to most people. Red is 0 (degrees), green is 120 and blue is 240.[br] + * S, for saturation, is 0-255, and the bigger it is, the stronger the color is. Grayish colors have saturation near 0; very strong colors have saturation near 255.[br] + * V, for value, is 0-255 and represents lightness or brightness of the color. 0 is black; 255 is as far from black as possible.[br] [/pre] Examples: [b]Red[/b] is H=0, S=255, V=255.[br] Light red could have H about 0, S about 50-100, and S=255. @@ -251,19 +250,19 @@ const char * const brushstyles_tbl[] = { Sets the painter's brush to have the specified color.[br] Example: [example] - class (wdg,widget)[br] - {[br] - paintevent()[br] - {[br] - %b=$new(painter)[br] - %b->$setBackgroundMode(Opaque)[br] - %b->$setBrush(0,250,250)[br] - %b->$begin($$)[br] - %b->$drawEllipse(50,50,100,50)[br] - }[br] - }[br] - %aa=$new(wdg)[br] - %aa->$show() + class (wdg,widget) + { + paintevent() + { + %b=$new(painter) + %b->$setBackgroundMode(Opaque) + %b->$setBrush(0,250,250) + %b->$begin($$) + %b->$drawEllipse(50,50,100,50) + } + } + %aa=$new(wdg)[br] + %aa->$show() [/example] !fn: $drawRect(<x:integer>,<y:integer>,<w:unsigned integer>,<h:unsigned integer>) Draws a rectangle with upper left corner at (x, y) and with width w and height h. @@ -287,30 +286,30 @@ const char * const brushstyles_tbl[] = { Draws the given <text> within the rectangle specified by <x>,<y> <width> and <height>.[br] The <flag> parameters may be:[br] [pre] - Left[br] - Top[br] - Right[br] - Bottom[br] - HCenter[br] - VCenter[br] - Center[br] - TextSingleLine[br] - TextExpandTabs[br] - TextShowMnemonic[br] - TextWordWrap[br] - TextIncludeTrailingSpaces[br] + Left[br] + Top[br] + Right[br] + Bottom[br] + HCenter[br] + VCenter[br] + Center[br] + TextSingleLine[br] + TextExpandTabs[br] + TextShowMnemonic[br] + TextWordWrap[br] + TextIncludeTrailingSpaces [/pre] !fn: $drawPixmap(<x:integer>,<y:integer>,<pixmap:hobject>,<sx:integer>,<sy:integer>,<ex:integer>,<ey:integer>) Draws a pixmap at x,y coordinates[br] !fn: $setFont(<family:string>,<size:integer>[,<style:enum>,<style:enum>,..])[br] Set the font's family, size and style, valid flag for style are:[br] [pre] - italic[br] - bold [br] - underline [br] - overline [br] - strikeout [br] - fixedpitch [br] + italic[br] + bold [br] + underline [br] + overline [br] + strikeout [br] + fixedpitch [br] [/pre] !fn: $setFontSize(<size:unsigned integer>)[br] Set the current painter font's size.[br] @@ -336,8 +335,8 @@ const char * const brushstyles_tbl[] = { Sets the background mode of the painter to <bgMode>: Valid values are:[br] [pre] - - Transparent (that is the default value);[br] - - Opaque. + - Transparent (that is the default value);[br] + - Opaque. [/pre] !fn: $setOpacity(<opacity_factor:real>) Sets the painter opacity that affects all painter operations (drawpixmap, drawtext...). Valid values range are from 0 (total transparency) to 1 (total opacity)[br] @@ -350,179 +349,175 @@ const char * const brushstyles_tbl[] = { You must call the [classfnc]$begin[/classfnc] before using it. !fn: $setSmoothPixmapTransform(<boolean>) Enable/disable smooth bilinear pixmap transformation algorithm (such as bilinear). - You must call the [classfnc]$begin[/classfnc] before using it. + You must call the [classfnc]$begin[/classfnc] before using it.[br] Example: [example] - [br] - class (hello,widget)[br] - {[br] - constructor()[br] - {[br] - $$->%sintbl[]= $array( 0, 38, 71, 92, 100, 92, 71, 38,0, -38, -71, -92, -100, -92, -71, -38);[br] - $$->%index=0[br] - $$->$starttimer( 30 );[br] - $$->$resize(800,600 );[br] - $$->%string=$0[br] - $$->%waitfor=1;[br] - $$->%nextanim=0[br] - [br] - #zoom and rotation anim[br] - $$->%Zoomindex=11[br] - $$->%degree=0[br] - $$->%Noanim=0[br] - $$->%scrollright=-450[br] - [br] - #anim effect init[br] - $$->%xoffset=4[br] - $$->%yoffset=3[br] - $$->%xstart=270[br] - $$->%ystart=200[br] - $$->%b=0[br] - $$->%yoffs=400[br] - [br] - #parallax parameter[br] - $$->%Off=400[br] - $$->%roll=1[br] - }[br] - timerevent()[br] - {[br] - $$->%b = $(($$->%b + 1) & 15);[br] - if ($$->%nextanim == 1) $$->$repaint(1);[br] - $$->$repaint(0);[br] - }[br] - drawAnim()[br] - {[br] - %P->$setFont(32,"times",bold);[br] - %w=$(%P->$fontMetricsWidth($$->%string[$$->%index]) + 20);[br] - %h=$(%P->$fontMetricsHeight * 2);[br] - %pmx = $(($$->$width/2) -%w/2);[br] - %pmy = $(($$->$height()/2) - %h/2);[br] - %x = 10;[br] - %y= $((%h/2) + $$->$fontDescent());[br] - %i=0[br] - while ( $str.mid("Grifisx/Noldor",%i,1) != "") [br] - {[br] - %i16 = $(($$->%b+%i) & 15);[br] - %char=$str.mid("Grifisx/Noldor",%i,1)[br] - %P->$setPen($((15-%i16)*16),$((15-%i16)*16),$((15-%i16)*16) );[br] - %P->$drawText( $(%x+$$->%xstart),$($$->%ystart+%y-$$->%sintbl[%i16]*%h/800),%char,1,Auto);[br] - %x += %P->$fontMetricsWidth(%char);[br] - %i++;[br] - }[br] - }[br] - matrixeffect()[br] - {[br] - if (($$->%Zoomindex == 99) && ($$->%degree==360)) return %P->$drawPixmap($(400-32),$(300-32),"kvirc.png",0,0,-1,-1)[br] - %P->$scale(0.$$->%Zoomindex,0.$$->%Zoomindex)[br] - if ($$->%Zoomindex != 99) $$->%Zoomindex++;[br] - %P->$rotate($$->%degree)[br] - %P->$translate(400,300)[br] - %P->$drawPixmap(-32,-32,"kvirc.png",0,0,-1,-1)[br] - %P->$setFont(28,"times",bold);[br] - %P->$reset()[br] - if ($$->%scrollright >= 550) return[br] - %P->$scale(0.$$->%Zoomindex,0.$$->%Zoomindex)[br] - %P->$translate(400,350)[br] - %P->$drawText($$->%scrollright,10,"Another cool class brought to you by...",-1,Auto) [br] - $$->%scrollright += 3;[br] - %P->$reset()[br] - }[br] - nextanim()[br] - {[br] - %p=$new(painter)[br] - %p->$setBackgroundMode(Opaque)[br] - %p->$setBrush($rand(255),$rand(255),$rand(255))[br] - %p->$begin($$)[br] - %rand=$rand(5)[br] - %p->$drawrect($rand(800),$rand(400),120,200)[br] - %p->$drawArc($rand(800),$rand(400),120,200,20,$(16*20))[br] - %p->$drawPie($rand(800),$rand(400),120,200,20,$(16*20))[br] - %p->$drawChord($rand(800),$rand(400),120,200,20,$(16*20))[br] - %p->$drawEllipse($rand(800),$rand(400),100,30)[br] - %p->$end()[br] - delete %p[br] - }[br] - paintEvent()[br] - {[br] - if ($$->%nextanim ==1) return $$->$nextanim()[br] - # pixmap creation: every effect will be painted on it then copied on widget[br] - %pixmap=$new(pixmap)[br] - %pixmap->$resize($$->$width(),$$->$height())[br] - [br] - # painter creation [br] - %P=$new(painter);[br] - %P->$begin(%pixmap);[br] - $$->$drawanim[br] - $$->$matrixeffect[br] - %i=0[br] - while (%i != 100)[br] - {[br] - %i16 = $(($$->%b+%i) & 15);[br] - %P->$setPen($((15-%i16)*16),$((15-%i16)*16),$((15-%i16)*16) );[br] - %P->$drawpoint($rand(800),$rand(600))[br] - %i++[br] - }[br] - [br] - # sets the animations order to manage the parallax effect[br] - %P->$end[br] - objects.bitBlt $$ 0 0 %pixmap[br] - delete %pixmap[br] - delete %P[br] - if (%Pauseflag == 1) return[br] - [br] - # manage the animations parameters[br] - if (($$->%Off<=60) && ($$->%roll<182)) $$->%roll += 2;[br] - if ($$->%roll>182) $$->%waitfor=0[br] - if ($$->%Noanim != 1) $$->%degree += 16;[br] - if ($$->%degree >= 360)[br] - {[br] - $$->%degree=0;[br] - if ($$->%Zoomindex == 99) $$->%Noanim=1[br] - } [br] - if ($$->%Noanim != 1) return[br] - [br] - #sinusoid animation[br] - if (($$->%xstart <1) && ($$->%xoffset == -4)) $$->%xoffset=4;[br] - if (($$->%xstart >$($$->$width()-%P->$fontMetricsWidth("Grifisx/Noldor"))) && ($$->%xoffset == 4)) $$->%xoffset=-4;[br] - if (($$->%ystart <1) && ($$->%yoffset == -3)) $$->%yoffset=3;[br] - if (($$->%ystart >$($$->$height()-60)) && ($$->%yoffset == 3)) $$->%yoffset=-3;[br] - $$->%xstart += $$->%xoffset;[br] - $$->%ystart += $$->%yoffset;[br] - }[br] - }[br] - [br] - %Hello=$new(hello)[br] - %Hello->$setWindowTitle("Painter effects" );[br] - %Hello->$setFont(28,"times",bold);[br] - %Btn=$new(button,%Hello)[br] - %Btn->$setmaximumwidth(80)[br] - %Btn->$setmaximumheight(30)[br] - %Btn->$setFont(8,"times",bold);[br] - %Btn->$settext(Next)[br] - [br] - privateimpl(%Btn,mousepressevent)[br] - {[br] - if ($$->$parent->%nextanim==0) [br] - {[br] - $$->$parent->%nextanim=1[br] - $$->$settext(Prev)[br] - } [br] - else[br] - {[br] - $$->$parent->%nextanim=0[br] - $$->$settext(Next)[br] - }[br] - }[br] - [br] - %lay=$new(layout,%Hello)[br] - %lay->$addwidget(%Btn,4,0)[br] - %Hello->$setBackgroundColor("000000");[br] - %Hello->$setmaximumwidth(800)[br] - %Hello->$setminimumwidth(780)[br] - %Hello->$setmaximumheight(600)[br] - %Hello->$setminimumheight(600)[br] - %Hello->$move(10,10)[br] - %Hello->$show();[br] [br] + class (hello,widget) + { + constructor() + { + $$->%sintbl[]= $array( 0, 38, 71, 92, 100, 92, 71, 38,0, -38, -71, -92, -100, -92, -71, -38); + $$->%index=0 + $$->$starttimer( 30 ); + $$->$resize(800,600 ); + $$->%string=$0 + $$->%waitfor=1; + $$->%nextanim=0 + [comment]#zoom and rotation anim[/comment] + $$->%Zoomindex=11 + $$->%degree=0 + $$->%Noanim=0 + $$->%scrollright=-450 + + [comment]#anim effect init[/comment] + $$->%xoffset=4 + $$->%yoffset=3 + $$->%xstart=270 + $$->%ystart=200 + $$->%b=0 + $$->%yoffs=400 + + [comment]#parallax parameter[/comment] + $$->%Off=400 + $$->%roll=1 + } + timerevent() + { + $$->%b = $(($$->%b + 1) & 15); + if ($$->%nextanim == 1) $$->$repaint(1); + $$->$repaint(0); + } + drawAnim() + { + %P->$setFont(32,"times",bold); + %w=$(%P->$fontMetricsWidth($$->%string[$$->%index]) + 20); + %h=$(%P->$fontMetricsHeight * 2); + %pmx = $(($$->$width/2) -%w/2); + %pmy = $(($$->$height()/2) - %h/2); + %x = 10; + %y= $((%h/2) + $$->$fontDescent()); + %i=0 + while ( $str.mid("Grifisx/Noldor",%i,1) != "") + { + %i16 = $(($$->%b+%i) & 15); + %char=$str.mid("Grifisx/Noldor",%i,1) + %P->$setPen($((15-%i16)*16),$((15-%i16)*16),$((15-%i16)*16) ); + %P->$drawText( $(%x+$$->%xstart),$($$->%ystart+%y-$$->%sintbl[%i16]*%h/800),%char,1,Auto); + %x += %P->$fontMetricsWidth(%char); + %i++; + } + } + matrixeffect() + { + if (($$->%Zoomindex == 99) && ($$->%degree==360)) return %P->$drawPixmap($(400-32),$(300-32),"kvirc.png",0,0,-1,-1) + %P->$scale(0.$$->%Zoomindex,0.$$->%Zoomindex) + if ($$->%Zoomindex != 99) $$->%Zoomindex++; + %P->$rotate($$->%degree) + %P->$translate(400,300) + %P->$drawPixmap(-32,-32,"kvirc.png",0,0,-1,-1) + %P->$setFont(28,"times",bold); + %P->$reset() + if ($$->%scrollright >= 550) return + %P->$scale(0.$$->%Zoomindex,0.$$->%Zoomindex) + %P->$translate(400,350) + %P->$drawText($$->%scrollright,10,"Another cool class brought to you by...",-1,Auto) + $$->%scrollright += 3; + %P->$reset() + } + nextanim() + { + %p=$new(painter) + %p->$setBackgroundMode(Opaque) + %p->$setBrush($rand(255),$rand(255),$rand(255)) + %p->$begin($$) + %rand=$rand(5) + %p->$drawrect($rand(800),$rand(400),120,200) + %p->$drawArc($rand(800),$rand(400),120,200,20,$(16*20)) + %p->$drawPie($rand(800),$rand(400),120,200,20,$(16*20)) + %p->$drawChord($rand(800),$rand(400),120,200,20,$(16*20)) + %p->$drawEllipse($rand(800),$rand(400),100,30) + %p->$end() + delete %p + } + paintEvent() + { + if ($$->%nextanim ==1) return $$->$nextanim() + [comment]# pixmap creation: every effect will be painted on it then copied on widget[/comment] + %pixmap=$new(pixmap) + %pixmap->$resize($$->$width(),$$->$height()) + + [comment]# painter creation[/comment] + %P=$new(painter); + %P->$begin(%pixmap); + $$->$drawanim + $$->$matrixeffect + %i=0 + while (%i != 100) + { + %i16 = $(($$->%b+%i) & 15); + %P->$setPen($((15-%i16)*16),$((15-%i16)*16),$((15-%i16)*16) ); + %P->$drawpoint($rand(800),$rand(600)) + %i++ + } + + [comment]# sets the animations order to manage the parallax effect[/comment] + %P->$end + objects.bitBlt $$ 0 0 %pixmap + delete %pixmap + delete %P + if (%Pauseflag == 1) return + [comment]# manage the animations parameters[/comment] + if (($$->%Off<=60) && ($$->%roll<182)) $$->%roll += 2; + if ($$->%roll>182) $$->%waitfor=0 + if ($$->%Noanim != 1) $$->%degree += 16; + if ($$->%degree >= 360) + { + $$->%degree=0; + if ($$->%Zoomindex == 99) $$->%Noanim=1 + } + if ($$->%Noanim != 1) return + [comment]#sinusoid animation[/comment] + if (($$->%xstart <1) && ($$->%xoffset == -4)) $$->%xoffset=4; + if (($$->%xstart >$($$->$width()-%P->$fontMetricsWidth("Grifisx/Noldor"))) && ($$->%xoffset == 4)) $$->%xoffset=-4; + if (($$->%ystart <1) && ($$->%yoffset == -3)) $$->%yoffset=3; + if (($$->%ystart >$($$->$height()-60)) && ($$->%yoffset == 3)) $$->%yoffset=-3; + $$->%xstart += $$->%xoffset; + $$->%ystart += $$->%yoffset; + } + } + + %Hello=$new(hello) + %Hello->$setWindowTitle("Painter effects" ); + %Hello->$setFont(28,"times",bold); + %Btn=$new(button,%Hello) + %Btn->$setmaximumwidth(80) + %Btn->$setmaximumheight(30) + %Btn->$setFont(8,"times",bold); + %Btn->$settext(Next) + + privateimpl(%Btn,mousepressevent) + { + if ($$->$parent->%nextanim==0) + { + $$->$parent->%nextanim=1 + $$->$settext(Prev) + } + else + { + $$->$parent->%nextanim=0 + $$->$settext(Next) + } + } + + %lay=$new(layout,%Hello) + %lay->$addwidget(%Btn,4,0) + %Hello->$setBackgroundColor("000000"); + %Hello->$setmaximumwidth(800) + %Hello->$setminimumwidth(780) + %Hello->$setmaximumheight(600) + %Hello->$setminimumheight(600) + %Hello->$move(10,10) + %Hello->$show(); [/example] */ diff --git a/src/modules/objects/KvsObject_pixmap.cpp b/src/modules/objects/KvsObject_pixmap.cpp index e02cf9106..52eeda284 100644 --- a/src/modules/objects/KvsObject_pixmap.cpp +++ b/src/modules/objects/KvsObject_pixmap.cpp @@ -53,14 +53,16 @@ !fn: $fill(<colorname, RGB or HSV array value or [<red>, <green>, <blue>][<hue>, <saturation>, <value>], [opacity], [system color:RGB or HSV]) Fills the pixmap with color and opacity.[br] !fn: $resize(<width:integer>,<height:integer>) - Resizes the pixmap to w width and h height. Set wh or hg to 0, to have a null pixmap. + Resizes the pixmap to w width and h height. Set [b]wh[/b] or [b]hg to [b]0[/b], to have a null pixmap. !fn: $scale(<width:integer>,<height:integer>,[<aspect_ratio:string>]) - Scales the pixmap or the animation by sx horizontally and sy vertically. + Scales the pixmap or the animation by [b]sx[/b] horizontally and [b]sy[/b] vertically.[br] Aspect_ratio values: - - IgnoreAspectRatio:the pixmap is scaled ignoring his aspect ratio. - - KeepAspectRatio: pixmap is scaled to a rectangle as large as possible inside size, preserving the aspect ratio. - - KeepAspectRatioByExpanding, the pixmap is scaled to a rectangle as small as possible outside size, preserving the aspect ratio. - Default value is KeepAspectRatio. + [pre] + - IgnoreAspectRatio:the pixmap is scaled ignoring his aspect ratio. + - KeepAspectRatio: pixmap is scaled to a rectangle as large as possible inside size, preserving the aspect ratio. + - KeepAspectRatioByExpanding, the pixmap is scaled to a rectangle as small as possible outside size, preserving the aspect ratio. + [/pre] + [b]Default value is KeepAspectRatio.[/b][br][br] !fn: $load(<file_name:string>) Load a pixmap from the file <file_name>. !fn: $save(<file_name:string>) @@ -80,10 +82,8 @@ @signals: !sg: $frameChanged() This signal is emitted by the default implementation of [classfnc]$frameChangedEvent[/classfnc]().[br] - */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_pixmap,"pixmap","object") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_pixmap,fill) diff --git a/src/modules/objects/KvsObject_popupMenu.cpp b/src/modules/objects/KvsObject_popupMenu.cpp index c368e9a02..8524c171c 100644 --- a/src/modules/objects/KvsObject_popupMenu.cpp +++ b/src/modules/objects/KvsObject_popupMenu.cpp @@ -85,83 +85,83 @@ [br] @examples: [example] - [comment]//First we define a class inherited from popupmenu[/comment] - class(menu,popupmenu) - { - constructor() - { - [comment]//We store the item's ID for checking in activatedEvent[/comment] - @%tile_id=@$insertItem("Tile",118) - @%cascade_id=@$insertItem("Cascade",115) - @$insertSeparator(3) - @%closeactw_id=@$insertItem("Close Active Window",08) - @%closeallw_id=@$insertItem("Close All Window",58) - } - activatedEvent() + [comment]# First we define a class inherited from popupmenu[/comment] + class(menu,popupmenu) { - [comment]//Now we emit a signals to the relative to the user choice[/comment] - %id=$0 - if (%id==@%tile_id) @$emit("tile") - else if(%id==@%cascade_id) @$emit("cascade") - else if (%id==@%closeactw_id) @$emit("closeactive") - else @$emit("closeallwindows") - [comment]//Deleting the popup[/comment] - delete $$ + constructor() + { + [comment]# We store the item's ID for checking in activatedEvent[/comment] + @%tile_id=@$insertItem("Tile",118) + @%cascade_id=@$insertItem("Cascade",115) + @$insertSeparator(3) + @%closeactw_id=@$insertItem("Close Active Window",08) + @%closeallw_id=@$insertItem("Close All Window",58) + } + activatedEvent() + { + [comment]# Now we emit a signals to the relative to the user choice[/comment] + %id=$0 + if (%id==@%tile_id) @$emit("tile") + else if(%id==@%cascade_id) @$emit("cascade") + else if (%id==@%closeactw_id) @$emit("closeactive") + else @$emit("closeallwindows") + [comment]# Deleting the popup[/comment] + delete $$ + } } - } - class (ws,widget)[br] - { - [comment]In the constructor we create everything that belong to the single widget.[/comment] - constructor() + class (ws,widget)[br] { - [comment]//Here we generate a loop to create our labels inside the widget.[/comment] - %lay=$new(layout,$$) - [comment]we use a vbox to managing labels in vertical orientation[/comment] - %vb=$new(vbox,$$) - [comment]Then add the vbox to the main layout[/comment] - %lay->$addWidget(%vb,0,0) - [comment]Let's create our colorful labels[/comment] - for(%i=0;%i<15;%i++) + [comment]In the constructor we create everything that belong to the single widget.[/comment] + constructor() { - @%label=$new(label,%vb) - @%label->$settext("Another class by N\&G") - #We set our foreground's colors using the hex array in a random way. - @%label->$setforegroundcolor($array($rand(255),$rand(255),$rand(255))) + [comment]# Here we generate a loop to create our labels inside the widget.[/comment] + %lay=$new(layout,$$) + [comment]we use a vbox to managing labels in vertical orientation[/comment] + %vb=$new(vbox,$$) + [comment]# Then add the vbox to the main layout[/comment] + %lay->$addWidget(%vb,0,0) + [comment]# Let's create our colorful labels[/comment] + for(%i=0;%i<15;%i++) + { + @%label=$new(label,%vb) + @%label->$settext("Another class by N\&G") + [comment]# We set our foreground's colors using the hex array in a random way.[/comment] + @%label->$setforegroundcolor($array($rand(255),$rand(255),$rand(255))) + } + } + customContextMenuRequestedEvent() + { + [comment]# We create the popupmenu relative to this widget at runtime.[/comment] + %p=$new(menu,$$) + objects.connect %p tile @$parent tile + objects.connect %p cascade @$parent cascade + objects.connect %p closeactive @$parent closeactivewindow + objects.connect %p closeallwindows @$parent closeallwindows + %p->$exec($$,$($0+10),$($1+10)) } } - customContextMenuRequestedEvent() + [comment]# We create the workspace widget[/comment] + %Workspace=$new(workspace) + [comment]# We use as space as we have[/comment] + %size[]=%Workspace->$screenResolution() + [comment]# Resize it[/comment] + %Workspace->$resize(%size[0],%size[1]) + [comment]# Then create 20 subwidget[/comment] + for(%i=0;%i<20;%i++) { - [comment]//We create the popupmenu relative to this widget at runtime.[/comment] - %p=$new(menu,$$) - objects.connect %p tile @$parent tile - objects.connect %p cascade @$parent cascade - objects.connect %p closeactive @$parent closeactivewindow - objects.connect %p closeallwindows @$parent closeallwindows - %p->$exec($$,$($0+10),$($1+10)) + %w=$new(ws,%Workspace) + [comment]# Let's add every widget to the workspace[/comment] + %Workspace->$addSubWindow(%w) + [comment]# Then "shake it" a little bit around :-)[/comment] + %w->$move($rand($(%size[0]-50)),$rand($(%size[1]-50))) } - } - [comment]//We create the workspace widget[/comment] - %Workspace=$new(workspace) - [comment]//We use as space as we have[/comment] - %size[]=%Workspace->$screenResolution() - [comment]//Resize it[/comment] - %Workspace->$resize(%size[0],%size[1]) - [comment]//Then create 20 subwidget[/comment] - for(%i=0;%i<20;%i++) - { - %w=$new(ws,%Workspace) - [comment]//Let's add every widget to the workspace[/comment] - %Workspace->$addSubWindow(%w) - [comment]//Then "shake it" a little bit around :-)[/comment] - %w->$move($rand($(%size[0]-50)),$rand($(%size[1]-50))) - } - [comment]//Reimplement closeEvent to delete all this :-)[/comment] - privateimpl(%Workspace,closeEvent) - { - delete $$ - } - [comment]//Let's show![/comment] - %Workspace->$show() + [comment]# Reimplement closeEvent to delete all this :-)[/comment] + privateimpl(%Workspace,closeEvent) + { + delete $$ + } + [comment]# Let's show![/comment] + %Workspace->$show() [/example] */ diff --git a/src/modules/objects/KvsObject_process.cpp b/src/modules/objects/KvsObject_process.cpp index e7c4b1931..d58ec3f64 100644 --- a/src/modules/objects/KvsObject_process.cpp +++ b/src/modules/objects/KvsObject_process.cpp @@ -44,7 +44,7 @@ [class]object[/class] @description: The Process class is used to start external programs and to communicate with them.[br] - !WARNING AT LAST YOU HAVE TO CLOSE THE PROCESS! + [b]WARNING! at last you have to close the process![/b] @functions: !fn: $addArgument(<process-name:string>) With this command you give the process name (or more arguments) for communication. @@ -53,9 +53,9 @@ Tries to run the process.[br] [b]e.g.[/b] [example] - %process=$new(process);[br] - %process->$addArg("cmd.exe");[br] - %process->$start();[br] + %process=$new(process);[br] + %process->$addArg("cmd.exe");[br] + %process->$start();[br] [/example] !fn: <string> $readStdout() Reads the data that the process has written to standard output. @@ -63,70 +63,70 @@ Reads the data that the process has written to standard error. [b]e.g.[/b] [example] - class (test,object)[br] - {[br] - slotReadStdout()[br] - {[br] - %stdo = %Process->$readStdout()[br] - #%Aoutput->$append(%stdo);// coming soon in the new texteditor class[br] - %Aoutput->$settext(%stdo);[br] - }[br] - slotReadStderr()[br] - {[br] - %stderr= %Process->$readStderr()[br] - #%Aoutput->$append(%stderr);// coming soon in the new texteditor class[br] - %Aoutput->$settext(%stderr);[br] - }[br] - }[br] + class (test,object) + { + slotReadStdout() + { + %stdo = %Process->$readStdout() + #%Aoutput->$append(%stdo);[comment]# coming soon in the new texteditor class[/comment] + %Aoutput->$settext(%stdo); + } + slotReadStderr() + { + %stderr= %Process->$readStderr() + #%Aoutput->$append(%stderr);[comment]# coming soon in the new texteditor class[/comment] + %Aoutput->$settext(%stderr); + } + } - %tt=$new(test)[br] - %A=$new(widget)[br] - %A->$setGeometry(100,100,400,300)[br] - %layoutA=$new(layout,%A)[br] - %Ainput=$new(lineedit,%A)[br] - #%Aoutput=$new(textedit,%A) [comment]//coming soon in the new texteditor class[/commnet][br] - %Aoutput=$new(label,%A)[br] - %bclosekill=$new(button,%A)[br] - %bclosekill->$settext("&CloseKill ")[br] - %bkill=$new(button,%A)[br] - %bkill->$settext("&Kill ")[br] - %bterminate=$new(button,%A)[br] - %bterminate->$settext("&Ask to Terminate ")[br] - %layoutA->$addwidget(%Ainput,0,0)[br] - %layoutA->$addwidget(%Aoutput,1,0)[br] - %layoutA->$addwidget(%bclosekill,3,0)[br] - %layoutA->$addwidget(%bkill,4,0,)[br] - %layoutA->$addwidget(%bterminate,5,0)[br] + %tt=$new(test) + %A=$new(widget) + %A->$setGeometry(100,100,400,300) + %layoutA=$new(layout,%A) + %Ainput=$new(lineedit,%A) + #%Aoutput=$new(textedit,%A)[comment]# coming soon in the new texteditor class[/commnet] + %Aoutput=$new(label,%A) + %bclosekill=$new(button,%A) + %bclosekill->$settext("&CloseKill ") + %bkill=$new(button,%A) + %bkill->$settext("&Kill ") + %bterminate=$new(button,%A) + %bterminate->$settext("&Ask to Terminate ") + %layoutA->$addwidget(%Ainput,0,0) + %layoutA->$addwidget(%Aoutput,1,0) + %layoutA->$addwidget(%bclosekill,3,0) + %layoutA->$addwidget(%bkill,4,0,) + %layoutA->$addwidget(%bterminate,5,0) - %Process=$new(process)[br] - %Process->$addArgument("cmd.exe")[br] - %Process->$startProcess();[br] + %Process=$new(process) + %Process->$addArgument("cmd.exe") + %Process->$startProcess(); - connect %Process readyReadStdout %tt slotReadStdout[br] - connect %Process readyReadStderr %tt slotReadStderr[br] - privateimpl(%Ainput,returnPressedEvent)[br] - { - %command=%Ainput->$text() "\r\n"[br] - %Process->$writeToStdin(%command);[br] - %Ainput->$setText("");[br] - }[br] + connect %Process readyReadStdout %tt slotReadStdout + connect %Process readyReadStderr %tt slotReadStderr + privateimpl(%Ainput,returnPressedEvent) + { + %command=%Ainput->$text() "\r\n" + %Process->$writeToStdin(%command); + %Ainput->$setText(""); + } - privateimpl(%bclosekill,mousepressevent)[br] - {[br] - %Process->$closekill();[br] - delete %A;[br] - }[br] - privateimpl(%bkill,mousepressevent)[br] - {[br] - %Process->$kill();[br] - delete %A;[br] - }[br] - privateimpl(%bterminate,mousepressevent)[br] - {[br] - %Process->$tryTerminate();[br] - delete %A;[br] - }[br] - %A->$show();[br] + privateimpl(%bclosekill,mousepressevent) + { + %Process->$closekill(); + delete %A; + } + privateimpl(%bkill,mousepressevent) + { + %Process->$kill(); + delete %A; + } + privateimpl(%bterminate,mousepressevent) + { + %Process->$tryTerminate(); + delete %A; + } + %A->$show(); [/example] !fn: $writeToStdin(<command:string>) With this command you send a command to the process: @@ -136,7 +136,7 @@ (I think that this is the better way.)[br] [b]e.g.[/b] [pre] - %Process->close_kill(); + %Process->close_kill(); [/pre] !fn: $kill() Kill the process the hard way (Bad Idea). diff --git a/src/modules/objects/KvsObject_radioButton.cpp b/src/modules/objects/KvsObject_radioButton.cpp index e26f3c108..05d732224 100644 --- a/src/modules/objects/KvsObject_radioButton.cpp +++ b/src/modules/objects/KvsObject_radioButton.cpp @@ -30,6 +30,7 @@ #include "KviIconManager.h" #include <QRadioButton> + /* @doc: radiobutton @keyterms: @@ -52,18 +53,15 @@ !fn: $setChecked(<bChecked:boolean>) Sets whether the radio button is checked to check. !fn: $setPixmap(<image_id>) - Sets the pixmap shown on the radiobutton..See the [doc:image_id]image identifier[/doc] documentation for the explanation - of the <image_id> parameter. + Sets the pixmap shown on the radiobutton. See the [doc:image_id]image identifier[/doc] + documentation for the explanation of the <image_id> parameter. !fn: <bool>$toggleEvent() - Called by KVIrc when the radibutton state is toggled. + Called by KVIrc when the radiobutton state is toggled. The default implementation emits the toggled(<bool>) signal. !sg: $toggled() This signal is emitted by the default implementation of [classfnc]$toggleEvent[/classfnc]().[br] - - */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_radioButton,"radiobutton","widget") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_radioButton,setText) diff --git a/src/modules/objects/KvsObject_slider.cpp b/src/modules/objects/KvsObject_slider.cpp index 06651dfb0..3eac95140 100644 --- a/src/modules/objects/KvsObject_slider.cpp +++ b/src/modules/objects/KvsObject_slider.cpp @@ -31,7 +31,6 @@ #include <QSlider> - /* @doc: slider @keyterms: @@ -67,12 +66,14 @@ !fn: $setTickmarks(<tick_marks:string>) Sets the tickmark settings for this slider.[br] Values are:[br] - NoMarks - do not draw any tickmarks.[br] - Both - draw tickmarks on both sides of the groove.[br] - Above - draw tickmarks above the (horizontal) slider[br] - Below - draw tickmarks below the (horizontal) slider[br] - Left - draw tickmarks to the left of the (vertical) slider[br] - Right - draw tickmarks to the right of the (vertical) slider + [pre] + NoMarks - do not draw any tickmarks.[br] + Both - draw tickmarks on both sides of the groove.[br] + Above - draw tickmarks above the (horizontal) slider[br] + Below - draw tickmarks below the (horizontal) slider[br] + Left - draw tickmarks to the left of the (vertical) slider[br] + Right - draw tickmarks to the right of the (vertical) slider + [/pre] !fn: $setTickInterval(<value>) Sets the interval between tickmarks. !fn: <integer> $value() @@ -95,11 +96,8 @@ !sg: $valueChanged() This signal is emitted by the default implementation of [classfnc]valueChangedEvent[/classfnc]().[br] If you reimplement that function you will have to emit the signal manually (if you still need it). - */ - - KVSO_BEGIN_REGISTERCLASS(KvsObject_slider,"slider","widget") diff --git a/src/modules/objects/KvsObject_socket.cpp b/src/modules/objects/KvsObject_socket.cpp index 7dfe40c00..1f64b4043 100644 --- a/src/modules/objects/KvsObject_socket.cpp +++ b/src/modules/objects/KvsObject_socket.cpp @@ -83,6 +83,7 @@ const char * const sockerrors_tbl[] = { "ProxyProtocol", "UnknownSocket" }; + /* @doc: socket @keyterms: @@ -103,20 +104,20 @@ const char * const sockerrors_tbl[] = { !fn: <integer or string> $status(<asString:boolean>) Returns the status of the socket :[br] [pre] - 0 = Unconnected - 1 = HostLookUp - 2 = Connecting[br] - 3 = Connected[br] - 4 = Bound[br] - 5 = Closing[br] - 6 = Listening + 0 = Unconnected + 1 = HostLookUp + 2 = Connecting[br] + 3 = Connected[br] + 4 = Bound[br] + 5 = Closing[br] + 6 = Listening [/pre] !fn: $connect(<host>,<port>) Attempts a connection to <host> on port <port>.[br] <host> can be a numeric internet address (either IPv4 or IPv6 (if supported)) or a hostname.[br] - If a hostname is used, a DNS lookup is performed (the socket enters the "DNS call" state).[br] - This function returns 1 if the connect attempt can be successfully initiated, - 0 otherwise.[br] In fact, this function returns 0 only if the supplied <port> parameter + If a hostname is used, a DNS lookup is performed (the socket enters the [i]DNS call[i/] state).[br] + This function returns [b]1[/b] if the connect attempt can be successfully initiated, and + [b]0[/b] otherwise.[br] In fact, this function returns [b]0[/b] only if the supplied <port> parameter is invalid or the socket is in an incoherent state (already connected or listening): for a newly created socket and with a valid <port> number you can safely ignore the return value.[br] @@ -124,56 +125,48 @@ const char * const sockerrors_tbl[] = { the socket is [b]not[/b] connected: it has just initiated the connect attempt and you will be notified of the attempt result by an asynchronous event call: in case of failure, $connectFailedEvent() will be called, in case of - succes, $connectEvent() will be called. - + success, $connectEvent() will be called. !fn: $listen([<port>[,<interface>[,<force_ipv6>]]]) Attempts to listen on the specified <port> and <interface>.[br] - If <port> is not passed it is assumed to be 0, if <interface> is not passed, it is assumed to be - "any interface" (INADDR_ANY).[br] Port 0 means that the kernel should choose a "random" port to listen on.[br] + If <port> is not passed it is assumed to be [b]0[/b], if <interface> is not passed, it is assumed to be + [i]any interface[/i] (INADDR_ANY).[br] Port 0 means that the kernel should choose a [i]random[/i] port to listen on.[br] If the <interface> is recognized as IPv6 address, and IPv6 is supported, the socket listens in IPv6 mode. If <interface> is an empty string and <force_ipv6> is 1 the socket listens - on "any ipv6 interface".[br] - This function returns '1' in case of success and '0' in case of failure.[br] + on [i]any IPv6 interface[/i].[br] + This function returns [b]1[/b] in case of success and [b]0[/b] in case of failure.[br] On some systems listening in the IPv6 namespace allows to accept also IPv4 connections (this includes Linux but not windows afaik).[br] When an incoming connection will arrive, $incomingConnectionEvent() will be called. - !fn: $connectedEvent() This function is called when a connection attempt has been successfully completed. The socket is currently connected to [classfnc:socket]$remoteIp[/classfnc]() on [classfnc:socket]$remotePort[/classfnc](). You can start writing data and you may expect [classfnc:socket]$dataAvailableEvent[/classfnc]() to be triggered. - !fn: $incomingConnectionEvent(<socket:h_object>) This function is called when an incoming connection arrives over a socket in listening state.[br] - You must return 1 if you to terminated this incoming connection call [classfnc:socket]$accept[/classfnc]() passing a newly created socket object + You must return [b]1[/b] if you to terminated this incoming connection call [classfnc:socket]$accept[/classfnc]() passing a newly created socket object to accept and handle the connection.[br] If you don't call [classfnc:socket]$accept[/classfnc]() the incoming connection will be automatically terminated. - !fn: $connectFailedEvent(<reason>) This function is called when a connection attempt fails for some reason. <reason> contains the error string.[br] This function may be called only between a call to [classfnc:socket]$connect[/classfnc]() and the [classfnc:socket]$connectEvent[/classfnc](). - !fn: $disconnectEvent([error]) This function is called when a connection is terminated either cleanly or because of an error.[br] - [error] is an empty string in case of a "clean" termination (connection closed by the remote host) + [error] is an empty string in case of a [i]clean[/i] termination (connection closed by the remote host) or is a message describing the socket error that caused the connection to be interrupted. - !fn: $dataAvailableEvent(<data_length>) This function is called when some data is available to be read: the <data_length> parameter specifies the length of the available data in bytes.[br] You can use one of the $read* functions to obtain the data - !fn: $read(<length>[,<hobject>]) - Reads at most <length> bytes of data from the socket. If <length> is anything "outside" the + Reads at most <length> bytes of data from the socket. If <length> is anything [i]outside[/i] the available data range (<length> < 0 or <length> > available_data_length), this function returns all the available data.[br] By default this function can deal ASCII data only: NULL characters are transformed to ASCII characters 255. You can pass a [class]memorybuffer[/class] object to read binary data. - !fn: $write(<data, array,files or hobject>[,length]) Writes <data> to the socket.[br] This function can deal with binary data passing a [class]memorybuffer[/class] object[br] @@ -183,7 +176,6 @@ const char * const sockerrors_tbl[] = { Using an array you can pass bytes or data string like this: @$write($array($(0xff),$(0xff),$(0xff),$(0xff),"This is an example")); If you're going to [cmd]delete[/cmd] this object just after the $write call, you should call [classfnc:socket]$close[/classfnc]() just before [cmd]delete[/cmd] to ensure the data delivery. - !fn: $close() Resets this socket state: kills any pending or active connection. After a close() call the socket may be used for a new connection.[br] @@ -191,97 +183,91 @@ const char * const sockerrors_tbl[] = { You don't need to call $close() if you [cmd]delete[/cmd] the socket: KVIrc will reset the socket state automatically and free the memory. But if you want to ensure data delivery after a $write call sequence and just before a [cmd]delete[/cmd], $close() is the only chance to do it. - !fn: $remoteIp() Returns the IP address of the remote end of this socket.[br] The return value is meaningful only if the socket is in connected or connecting state. - !fn: $setProtocol(<protocol>) Let KVIrc use TCP or UDP protocol - !fn: $remotePort() Returns the port of the remote end of this socket.[br] The return value is meaningful only if the socket is in connected or connecting state. - !fn: $localIp() Returns the IP address of the local end of this socket.[br] The return value is meaningful only if the socket is in connected, listening or connecting state. - !fn: $localPort() Returns the port of the local end of this socket.[br] The return value is meaningful only if the socket is in connected, listening or connecting state. - @examples: [example] - // Server socket: listen 8080 port and answer to requests (multi-threaded) - class("webserver","socket") - { - function incomingConnectionEvent() + [comment]# Server socket: listen 8080 port and answer to requests (multi-threaded)[/comment] + class("webserver","socket") { - // incoming connection socket passed by the framework - %socket = $0 - debug "Webserver incoming Connection from: %socket->$remoteIp : %socket->$remotePort" - %socket->$write("HTTP/1.0 200 OK\n\n<html><head></head><body><h1>KVIrc Webserver</h1></body></html>\n") - // tells KVIrc no need this socket anymore - return $true() - } - function constructor() - { - debug listen @$listen(8080, "127.0.0.1") + function incomingConnectionEvent() + { + [comment]# incoming connection socket passed by the framework[/comment] + %socket = $0 + debug "Webserver incoming Connection from: %socket->$remoteIp : %socket->$remotePort" + %socket->$write("HTTP/1.0 200 OK\n\n<html><head></head><body><h1>KVIrc Webserver</h1></body></html>\n") + [comment]# tells KVIrc no need this socket anymore[/comment] + return $true() + } + function constructor() + { + debug listen @$listen(8080, "127.0.0.1") + } } - } - // finally start webserver - %WebS = $new(webserver) + [comment]# finally start webserver[/comment] + %WebS = $new(webserver) [/example] [example] - // Client socket - go to google and grab request header[br] - class("httprequest","socket") - { - function errorEvent() - { - // the connection to the server failed - debug "Connection failed: "$0 - delete $$ - } - function disconnectedEvent() - { - // connection has been closed - debug "Connection is closed" - delete $$ - } - function destructor() - { - // if the socket is still open close it - if(@$status() == "Connected") @$close() - } - function stateChangedEvent() - { - debug socket state $0 - } - function dataAvailableEvent() + [comment]# Client socket - go to google and grab request header[/comment][br] + class("httprequest","socket") { - // reading the received data - debug reading $0 bytes - %newdata = @$read($0) - debug data: %newdata - // close and delete the socket - @$close() - delete $$ - } - function constructor() - { - // connect to the server - @$connect("www.google.com",80) - } - function connectedEvent() - { - // connection is complete - // send a request to receive the headers only from http://www.google.com/ - debug connected - debug written bytes @$write("HEAD / HTTP/1.1\r\nHost: www.google.de\r\nConnection: Close\r\nUser-Agent: KVIrc socket\r\n\r\n") on socket; + function errorEvent() + { + [comment]# the connection to the server failed[/comment] + debug "Connection failed: "$0 + delete $$ + } + function disconnectedEvent() + { + [comment]# connection has been closed[/comment] + debug "Connection is closed" + delete $$ + } + function destructor() + { + [comment]# if the socket is still open close it[/comment] + if(@$status() == "Connected") @$close() + } + function stateChangedEvent() + { + debug socket state $0 + } + function dataAvailableEvent() + { + [comment]# reading the received data[/comment] + debug reading $0 bytes + %newdata = @$read($0) + debug data: %newdata + [comment]# close and delete the socket[/comment] + @$close() + delete $$ + } + function constructor() + { + [comment]# connect to the server[/comment] + @$connect("www.google.com",80) + } + function connectedEvent() + { + [comment]# connection is complete[/comment] + [comment]# send a request to receive the headers only from http://www.google.com/[/comment] + debug connected + debug written bytes @$write("HEAD / HTTP/1.1\r\nHost: www.google.de\r\nConnection: Close\r\nUser-Agent: KVIrc socket\r\n\r\n") on socket; + } } - } - %Temp = $new(httprequest) + %Temp = $new(httprequest) [/example] */ diff --git a/src/modules/objects/KvsObject_sql.cpp b/src/modules/objects/KvsObject_sql.cpp index 5083a4f9f..722f1724b 100644 --- a/src/modules/objects/KvsObject_sql.cpp +++ b/src/modules/objects/KvsObject_sql.cpp @@ -40,78 +40,75 @@ c->error("No connection has been initialized!");\ return false;} - /* - @doc: sql - @keyterms: - Sql database. - @title: - sql class - @type: - class - @short: - A SQL database interface. - @inherits: - [class]object[/class] - @description: - This class permits KVIrc to have an interface with a SQL database supported by Qt library drivers. - @functions: - !fn: <boolean> $setConnection(<database_name:string>,<connection_name:string>,[<user:string>,<host_name_string>,<password:string>,<database_driver:string>]) - Connects to the DBMS using the connection <connection_name> and selecting the database <database_name>.[br] - If the optional parameter <database_driver> is passed, it will be used the corresponding driver (if present), otherwise Sqlite will be used. - Returns true if the operation is successful, false otherwise. - !fn:: <array or string> $connectionNames([<stringreturnflag>:'s']) - Returns as array or, if the flag 's' is passed, as a comma separate string all the database active connection's names. - !fn: <array> $tablesList(<connection_name:string>) - Returns as array the database tables list. - !fn: $transaction() - Begin a transaction. - !fn: $commit() - Commit the transaction. - !fn: $setCurrentQuery(<connection_name:string>) - Sets the query for the database connection <connection_name>, which has to be already connected, as current query. - !fn: <connection_name:string> $currentQuery() - Returns the name of the database connection for the current query, or an empty string if there aren't any initialized queries. - !fn: $closeConnection(<connection_name:string>) - Closes the connection <connection_name>. - !fn: <size:integer> $queryResultsSize() - Returns the query size in rows or -1 if the query is empty or the database driver doesn't support the function. - !fn: <error:string> $lastError(<more_details:boolean>) - Returns last error occurred. Use the more_details flag for more info about the error. - !fn: <ok:boolean> $queryExec([<query:string>]) - Execs the current query <query>. The string must follow the right syntax against the database in use. - If there are no parameters, it will exec the query previously done. - After the execution, the query will positioned on the first resulting record. - Returns true if the operation is successful, false otherwise. - See also [classfnc]$queryPrepare[/classfnc]() - !fn: <ok:boolean> $queryPrepare(<query_string>) - Prepare the query <query> to execute. The string must follow the right syntax against the database in use. - It's possible to use the placeholders. It's supported either the identifier ':' and '?' but it's not possible to use them together. - Returns true if the operation is successful, false otherwise. - See also [classfnc]$queryExec[/classfnc]and[classfnc]$queryBindValue[/classfnc]. - !fn: $queryBindValue() - Sets the placeholder <placeholder> to be bound to the value <val> in the prepared statement. - Note that the placeholder mark (e.g :) must be included when specifying the placeholder name. - !fn: <boolean> $queryPrevious() - Sets the current query position to the previous resulting record. - Returns true if the operation is successful, false otherwise. - !fn: <boolean> $queryNext() - Sets the current query position to the next resulting record. - Returns true if the operation is successful, false otherwise. - !fn: <boolean> $queryLast() - Sets the current query position to the last resulting record. - Returns true if the operation is successful, false otherwise. - !fn: <boolean> $queryFirst() - Sets the current query position to the first resulting record. - Returns true if the operation is successful, false otherwise. - !fn: <record:hash> $queryRecord() - Returns a hash containing the current query's record fields. - !fn: $queryFinish() - Sets the current query to inactive. + @doc: sql + @keyterms: + Sql database. + @title: + sql class + @type: + class + @short: + A SQL database interface. + @inherits: + [class]object[/class] + @description: + This class permits KVIrc to have an interface with a SQL database supported by Qt library drivers. + @functions: + !fn: <boolean> $setConnection(<database_name:string>,<connection_name:string>,[<user:string>,<host_name_string>,<password:string>,<database_driver:string>]) + Connects to the DBMS using the connection <connection_name> and selecting the database <database_name>.[br] + If the optional parameter <database_driver> is passed, it will be used the corresponding driver (if present), otherwise SQLite will be used. + Returns true if the operation is successful, false otherwise. + !fn:: <array or string> $connectionNames([<stringreturnflag>:'s']) + Returns as array or, if the flag '[b]s[/b] is passed, as a comma separate string all the database active connection's names. + !fn: <array> $tablesList(<connection_name:string>) + Returns as array the database tables list. + !fn: $transaction() + Begin a transaction. + !fn: $commit() + Commit the transaction. + !fn: $setCurrentQuery(<connection_name:string>) + Sets the query for the database connection <connection_name>, which has to be already connected, as current query. + !fn: <connection_name:string> $currentQuery() + Returns the name of the database connection for the current query, or an empty string if there aren't any initialized queries. + !fn: $closeConnection(<connection_name:string>) + Closes the connection <connection_name>. + !fn: <size:integer> $queryResultsSize() + Returns the query size in rows or -1 if the query is empty or the database driver doesn't support the function. + !fn: <error:string> $lastError(<more_details:boolean>) + Returns last error occurred. Use the more_details flag for more info about the error. + !fn: <ok:boolean> $queryExec([<query:string>]) + Execs the current query <query>. The string must follow the right syntax against the database in use. + If there are no parameters, it will exec the query previously done. + After the execution, the query will positioned on the first resulting record. + Returns true if the operation is successful, false otherwise. + See also [classfnc]$queryPrepare[/classfnc]() + !fn: <ok:boolean> $queryPrepare(<query_string>) + Prepare the query <query> to execute. The string must follow the right syntax against the database in use. + It's possible to use the placeholders. It's supported either the identifier [b]:[/b] and [b]?[/b] but it's not possible to use them together. + Returns true if the operation is successful, false otherwise. + See also [classfnc]$queryExec[/classfnc]and[classfnc]$queryBindValue[/classfnc]. + !fn: $queryBindValue() + Sets the placeholder <placeholder> to be bound to the value <val> in the prepared statement. + Note that the placeholder mark (e.g [b]:[/b]) must be included when specifying the placeholder name. + !fn: <boolean> $queryPrevious() + Sets the current query position to the previous resulting record. + Returns true if the operation is successful, false otherwise. + !fn: <boolean> $queryNext() + Sets the current query position to the next resulting record. + Returns true if the operation is successful, false otherwise. + !fn: <boolean> $queryLast() + Sets the current query position to the last resulting record. + Returns true if the operation is successful, false otherwise. + !fn: <boolean> $queryFirst() + Sets the current query position to the first resulting record. + Returns true if the operation is successful, false otherwise. + !fn: <record:hash> $queryRecord() + Returns a hash containing the current query's record fields. + !fn: $queryFinish() + Sets the current query to inactive. */ - - KVSO_BEGIN_REGISTERCLASS(KvsObject_sql,"sql","object") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,queryLastInsertId) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_sql,commit) diff --git a/src/modules/objects/KvsObject_tabWidget.cpp b/src/modules/objects/KvsObject_tabWidget.cpp index 4eef1a790..69a9ea652 100644 --- a/src/modules/objects/KvsObject_tabWidget.cpp +++ b/src/modules/objects/KvsObject_tabWidget.cpp @@ -94,16 +94,16 @@ See also [classfnc]$setTabsClosable[/classfnc](). @examples: [example] - [comment]// First we'll create the main tabWidget.[/comment] + [comment]# First we'll create the main tabWidget.[/comment] %Tabwidget=$new(tabWidget) %Tabwidget->$setToolTip("Example of TabWidget class") %Tabwidget->$setTabPosition(Top) %Tabwidget->$resize(300,200) - [comment]// Now we'll create the new widgets and put they in to the main tabWidget.[/comment] + [comment]# Now we'll create the new widgets and put they in to the main tabWidget.[/comment] %firsttab=$new(vbox) %secondtab=$new(vbox) - [comment]// Now we'll create the item to put in to tab's pages.[/comment] - [comment]// First tab[/comment] + [comment]# Now we'll create the item to put in to tab's pages.[/comment] + [comment]# First tab[/comment] %hbox=$new(hbox,%firsttab) %labelbt=$new(label,%hbox) %labelbt->$settext(Botton Tab) @@ -114,11 +114,13 @@ %buttontb->$settext("To &Botton") %buttontt=$new(button,%hbox) %buttontt->$settext("To &Top") - [comment]// Now we'll give a layout to all items.[/comment] - [comment]// This also allows to use privateimpl without making buttons global variables[/comment] - [comment]// Add the page to the main tab.[/comment] + [comment] + # Now we'll give a layout to all items. + # This also allows to use privateimpl without making buttons global variables + # Add the page to the main tab. + [/comment] %Tabwidget->$addTab(%firsttab,Top&Button,33) - [comment]// Implementing the action to do when the user click the buttons.[/comment] + [comment]# Implementing the action to do when the user click the buttons.[/comment] privateimpl(%buttontb,mousepressevent) { %Tabwidget->$setTabPosition(Bottom) @@ -127,7 +129,7 @@ { %Tabwidget->$setTabPosition(Top) } - [comment]// We do the same work with the second tab's page.[/comment] + [comment]# We do the same work with the second tab's page.[/comment] %labelwp=$new(label,%secondtab) %labelwp->$settext("Enjoy the new Class provided by") %labelwp->$setalignment("Center") @@ -135,7 +137,7 @@ %labelgen->$settext(Grifisx \& Noldor) %labelgen->$setalignment("Center") %Tabwidget->$addTab(%secondtab,&About,50) - [comment]// Let's show our example.[/comment] + [comment]# Let's show our example.[/comment] %Tabwidget->$show() [/example] @signals: diff --git a/src/modules/objects/KvsObject_tableWidget.cpp b/src/modules/objects/KvsObject_tableWidget.cpp index 3289d3e99..7cf4b869e 100644 --- a/src/modules/objects/KvsObject_tableWidget.cpp +++ b/src/modules/objects/KvsObject_tableWidget.cpp @@ -127,7 +127,7 @@ const char * const itemflags_tbl[] = { !fn: $setForegroundColor(<row:uinteger>,<col:uinteger>,<rgb(hex string)_array(red:integer,green:integer,blue_integer)_or_red_or_colorname>,[geen:integer],[blue:integer]) Sets the foreground of the cell at <row,<col> according to <colorname> <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 + 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 @@ -136,14 +136,14 @@ const char * const itemflags_tbl[] = { These determine whether the cell can be selected or modified. Supported flags are: [pre] - [br]- noitemflag : no flag sets; - [br]- selectable : cell is selecatble; - [br]- editable : cell is editable; - [br]- dragEnabled : cell can dragged; - [br]- dropEnabled : cell can used as drop target; - [br]- userCheckable : cell is checkable; - [br]- enabled :cell is enabled; - [br]- tristate : cell is checkable with three separate states. + - noitemflag : no flag sets; + - selectable : cell is selectable;[br] + - editable : cell is editable;[br] + - dragEnabled : cell can dragged;[br] + - dropEnabled : cell can used as drop target;[br] + - userCheckable : cell is checkable;[br] + - enabled :cell is enabled;[br] + - tristate : cell is checkable with three separate states. [/pre] !fn: $setCellWidget(<row:uint>,<column:uint>,<widget:hobject>) Sets the given widget to be displayed in the cell in the given row and column, passing the ownership of the widget to the table. @@ -168,7 +168,7 @@ const char * const itemflags_tbl[] = { This event is triggered whenever a cell in the table is double clicked. !fn: $paintCellEvent(<painter:hobject>,<row,uint>,<col:uint>,<cell_width:uint>,<cell_height:uint>) This event handler can be reimplemented to repaint cells. - The framework will pass the row/col coordinates, cell's width and height, and, as parameter, a [class]painter[/class]object. + The framework will pass the row/col coordinates, cell's width and height as parameter, a [class]painter[/class]object. You don't need to begin/end/delete the painter. !fn: $sizeHintCellRequestEvent() This event handler can be reimplemented to pass a custom size hint for this cell to the table layout @@ -179,10 +179,8 @@ const char * const itemflags_tbl[] = { @signals: !sg: $clicked() This signal is emitted by the default implementation of [classfnc]$clickEvent[/classfnc](). - */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_tableWidget,"tablewidget","widget") // Horizontal Header diff --git a/src/modules/objects/KvsObject_toolBar.cpp b/src/modules/objects/KvsObject_toolBar.cpp index 263f1a5c6..861b51c79 100644 --- a/src/modules/objects/KvsObject_toolBar.cpp +++ b/src/modules/objects/KvsObject_toolBar.cpp @@ -52,15 +52,13 @@ !fn: $addSeparator() Adds a separator to the right/bottom of the toolbar. !fn: $setLabel(<text:string>) - Sets the toolbar's label. + Sets the toolbars label. !fn: <string> $label() - Returns the toolbar's label. + Returns the toolbars label. !fn: $clear() - Deletes all the toolbar's child widgets. - + Deletes all the toolbars child widgets. */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_toolBar,"toolbar","widget") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_toolBar,addSeparator) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_toolBar,setLabel) diff --git a/src/modules/objects/KvsObject_trayIcon.cpp b/src/modules/objects/KvsObject_trayIcon.cpp index b1aeb90b6..e5dc4a2e1 100644 --- a/src/modules/objects/KvsObject_trayIcon.cpp +++ b/src/modules/objects/KvsObject_trayIcon.cpp @@ -62,12 +62,14 @@ Returns '1' if the tray icon is currently visible. !fn: showMessage(<title:string>,<message:string>,<message_icon:string>,<timeout:integer>) Shows a balloon message for the entry with the given title, message and message_icon for the time specified in millisecondsTimeoutHint. title and message must be plain text strings. - Message can be clicked by the user; the messageClickedEvent() will be triggered when this occurs. + Message can be clicked by the user; the messageClickedEvent() will be triggered when this occurs.[br] Valid values for message_icon are: - [br]- NoIcon : No icon is shown. - [br]- Information : An information icon is shown. - [br]- Warning : A standard warning icon is shown. - [br]- Critical : A critical warning icon is shown. + [pre] + - NoIcon : No icon is shown.[br] + - Information : An information icon is shown.[br] + - Warning : A standard warning icon is shown.[br] + - Critical : A critical warning icon is shown.[br] + [/pre] !fn: setContextMenu(<popupmenu:hobject>). Associates the given <popupmenu> with the tray icon. !fn: activatedEvent(<reason:string>) @@ -75,11 +77,11 @@ If you reimplement this function the reason parameter will be passed as $0. Values for reason are:[br] [pre] - [br]- Unknown : Unknown reason. - [br]- Context : The context menu for the tray icon was requested. - [br]- DoubleClick : The tray icon was double clicked. - [br]- Trigger : The tray icon was clicked. - [br]- MiddleClick : The tray icon was clicked with the middle mouse button. + - Unknown : Unknown reason.[br] + - Context : The context menu for the tray icon was requested.[br] + - DoubleClick : The tray icon was double clicked.[br] + - Trigger : The tray icon was clicked.[br] + - MiddleClick : The tray icon was clicked with the middle mouse button.[br] [/pre] The default implementation emits the [classfnc]$activated[/classfnc]() signal. !fn: messageClickedEvent() diff --git a/src/modules/objects/KvsObject_treeWidget.cpp b/src/modules/objects/KvsObject_treeWidget.cpp index 498375288..cd62e31fc 100644 --- a/src/modules/objects/KvsObject_treeWidget.cpp +++ b/src/modules/objects/KvsObject_treeWidget.cpp @@ -57,7 +57,7 @@ Allocating a [class]listviewtitem[/class] item2 as a child of item1 will insert it to the same listview creating a subtree of items spanning from item1. The subtree can be opened or closed by a simple click either on the parent item or on the little plus sign on the side of it (when [classfnc:listview]$setRootIsDecorated[/classfnc] - is set to $true. The listview can be in Single, Multi, Extended or NoSelection selection mode. + is set to $true. The listview can be in Single, Multi, Extended or NoSelection selection mode.[br][br] In single selection mode there can be only one selected item at a time and the selected item is also the current item (this mode is the default). In Multi and Extended selection mode there can be multiple selected items and the current item is one of them. The difference between multi and extended is in the way @@ -67,7 +67,7 @@ !fn: $addColumn(<text_label:string>,[<width:integer>]) Adds a width pixels wide column with the column header label to the list view. !fn: $setSorting(<column:integer>,<sort_order:string>) - Sets the list view to be sorted by column in ascending order if sort_order is "ascending" or descending order if it is "descending". + Sets the list view to be sorted by column in ascending order if sort_order is [i]ascending[/i] or descending order if it is [i]descending[/i]. !fn: $setSortingEnabled(<bEnabled:boolean>) If <bEnabled> is true, user sorting is enabled for the tree. The default value is false. In order to avoid performance issues, it is recommended that sorting is enabled after inserting the items into the tree. @@ -76,13 +76,13 @@ !fn: $showListViewHeader() Show the listview column header. !fn: <boolean> $isListViewHeaderVisible() - Returns '1' if the listview header is currently visible. Otherwise this function returns '0'. + Returns [b]1[/b] if the listview header is currently visible. Otherwise this function returns [b]0[/b]. !fn: $setAllColumnsShowFocus(<bAllColumnsShowFocus:boolean>) When the argument is $true, causes the listview to display the focus and selection by highlighting all the columns of the item. When the argument is $false then only the first column is selected/highlighted. !fn: $setSelectionMode(<mode:string>) - Sets the selection mode for this listview. <mode> can be one of "Single","NoSelection","Multi" or "Extended". + Sets the selection mode for this listview. <mode> can be one of [i]Single[/i], [i]NoSelection[/i], [i]Multi[/i] or [i]Extended[/i]. !fn: <listviewitem> $selectedItems() Returns the currently selected [class]listviewitem[/class] or $null if no items are selected. This function works only if the list view is in single selection mode. @@ -112,7 +112,7 @@ In its argument is the newly selected item or 0 if the change made no item current.[br] The default implementation emits the [classfnc]$currentChanged[/classfnc]() signal. !fn: $itemActivatedEvent(<item:object>) - This s signal is emitted when the user activates an item by single- or double-clicking or pressing 'Enter'.[br] + This signal is emitted when the user activates an item by single- or double-clicking or pressing Enter.[br] In its argument the current item.[br] The default implementation emits the [classfnc]$itemActivated[/classfnc]() signal. !fn: $spacePressedEvent(<item:object>) @@ -154,10 +154,6 @@ This signal is emitted by the default implementation of [classfnc]$rightButtonClickedEvent[/classfnc](). */ - - -//--------------------------------------------------------------------------------- - KVSO_BEGIN_REGISTERCLASS(KvsObject_treeWidget,"listview","widget") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidget,setHeaderLabels) diff --git a/src/modules/objects/KvsObject_treeWidgeteItem.cpp b/src/modules/objects/KvsObject_treeWidgeteItem.cpp index 6cf0ad0d1..fb584a9e4 100644 --- a/src/modules/objects/KvsObject_treeWidgeteItem.cpp +++ b/src/modules/objects/KvsObject_treeWidgeteItem.cpp @@ -56,8 +56,6 @@ const char * const itemflags_tbl[] = { #define itemflags_num (sizeof(itemflags_tbl) / sizeof(itemflags_tbl[0])) - - /* @doc: listviewitem @keyterms: @@ -116,20 +114,17 @@ const char * const itemflags_tbl[] = { This is often used to disable an item. Supported flags are: [pre] - [br]- noitemflag : no flag sets; - [br]- selectable : item is selectable; - [br]- editable : item is editable; - [br]- dragEnabled : item can dragged; - [br]- dropEnabled : item can used as drop target; - [br]- userCheckable : item is checkable; - [br]- enabled :item is enabled; - [br]- tristate : item is checkable with three separate states. + - noitemflag : no flag sets;[br] + - selectable : item is selectable;[br] + - editable : item is editable;[br] + - dragEnabled : item can dragged;[br] + - dropEnabled : item can used as drop target;[br] + - userCheckable : item is checkable;[br] + - enabled :item is enabled;[br] + - tristate : item is checkable with three separate states. [/pre] */ - -//=========================================================================================== - KVSO_BEGIN_REGISTERCLASS(KvsObject_treeWidgetItem,"listviewitem","object") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,setText) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_treeWidgetItem,text) diff --git a/src/modules/objects/KvsObject_vBox.cpp b/src/modules/objects/KvsObject_vBox.cpp index 0411cfe86..1f8067d44 100644 --- a/src/modules/objects/KvsObject_vBox.cpp +++ b/src/modules/objects/KvsObject_vBox.cpp @@ -59,6 +59,7 @@ const int align_cod[] = { }; #define align_num (sizeof(align_tbl) / sizeof(align_tbl[0])) + /* @doc: vbox @keyterms: @@ -83,11 +84,20 @@ const int align_cod[] = { !fn: $addStretch(<stretch:integer>) Adds a stretchable space with zero minimum size and stretch factor stretch to the end of this box layout. !fn: $setAlignment(<flag1:string>, <flag2:string>, ...) - Sets the alignment for widget w to flags, given as parameters. - Valid flags are: Right, Left, Top, Bottom, HCenter, VCenter, Center, Justify + Sets the alignment for widget w to flags, given as parameters.[br] + Valid flags are:[br] + [pre] + Right[br] + Left[br] + Top[br] + Bottom[br] + HCenter[br] + VCenter[br] + Center[br] + Justify + [/pre] */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_vBox,"vbox","widget") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_vBox,setMargin) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_vBox,setSpacing) diff --git a/src/modules/objects/KvsObject_webView.cpp b/src/modules/objects/KvsObject_webView.cpp index f7d2b0168..da6f4b8fc 100644 --- a/src/modules/objects/KvsObject_webView.cpp +++ b/src/modules/objects/KvsObject_webView.cpp @@ -197,10 +197,10 @@ const char * const actions_tbl[] = { Finds the specified string, in the page, using the given options. Valid flags are: [pre] - FindBackward - Searches backwards instead of forwards; - FindCaseSensitively - Changes the behaviour to a case sensitive find operation. - FindWrapsAroundDocument - Restart from the beginning of the document if the end was reached and the text was not found. - HighlightAllOccurrences - Highlights all existing occurrences. + FindBackward - Searches backwards instead of forwards; + FindCaseSensitively - Changes the behaviour to a case sensitive find operation. + FindWrapsAroundDocument - Restart from the beginning of the document if the end was reached and the text was not found. + HighlightAllOccurrences - Highlights all existing occurrences. [/pre] !fn: <array> $frames() Returns an array containing the names of the document frames. @@ -233,9 +233,9 @@ const char * const actions_tbl[] = { Returns the value of the style with the given name using the specified strategy. If a style with name does not exist, an empty string is returned. Possible value for <style_resolve_strategy> are: [pre] - CascadedStyle - the property's value is determined using the rules defined in the document's stylesheet. This is the default strategy. - InlineStyle - the property's value is determined by element definition, without respecting CSS rules. - ComputedStyle - the property's value is determined by the style property resolved from the environment. + CascadedStyle - the property's value is determined using the rules defined in the document's stylesheet. [b]This is the default strategy[/b]. + InlineStyle - the property's value is determined by element definition, without respecting CSS rules. + ComputedStyle - the property's value is determined by the style property resolved from the environment. [/pre] !fn: pixmap $makePreview() Returns a 212x142 thumbnail of the current webView constants. @@ -305,7 +305,6 @@ const char * const actions_tbl[] = { This signal is emitted by the default implementation of [classfnc:webview]downloadCompletedEvent[/classfnc](). */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_webView,"webview","widget") // page related diff --git a/src/modules/objects/KvsObject_widget.cpp b/src/modules/objects/KvsObject_widget.cpp index bee2b9fa5..79aeb42c1 100644 --- a/src/modules/objects/KvsObject_widget.cpp +++ b/src/modules/objects/KvsObject_widget.cpp @@ -176,6 +176,7 @@ const char * const widgettypes_tbl[] = { #define QT_WIDGET_CLICKFOCUS Qt::ClickFocus #define QT_WIDGET_STRONGFOCUS Qt::StrongFocus #define QT_WIDGET_NOFOCUS Qt::NoFocus + /* @doc: widget @keyterms: @@ -202,7 +203,8 @@ const char * const widgettypes_tbl[] = { Repaints the widget directly by calling [classfnc]$paintEvent[/classfnc]() immediately. !fn: $update([<x:ingeter>,<y:integer>,<width:integer>,<height:integer>]) Updates entirely the widget or a rectangle. - This function does not cause an immediate [classfnc]$paintEvent[/classfnc](); instead it schedules a paint event for processing when KVIrc returns to the main event loop. + This function does not cause an immediate [classfnc]$paintEvent[/classfnc](); + instead it schedules a paint event for processing when KVIrc returns to the main event loop. !fn: $x() Returns the x coordinate of the upper-left corner of this widget relative to the parent widget, @@ -247,7 +249,7 @@ const char * const widgettypes_tbl[] = { Changes the widget's width to <width> and height to <height>. See also [classfnc]$setGeometry[/classfnc](). !fn: $isEnabled() - Returns '1' if the widget is enabled, '0' otherwise. + Returns [b]1[/b] if the widget is enabled, and [b]0[/b] otherwise. See also [classfnc:widget]$setEnabled[/classfnc](). !fn: $setEnabled(<bool>) Sets the widget state to enabled or disabled if <bool> is 1 or 0 respectively. @@ -260,13 +262,12 @@ const char * const widgettypes_tbl[] = { !fn: $windowTitle() Returns the title text of this widget. !fn: $isTopLevel() - Returns '1' if this widget is a toplevel (parentless) one, - '0' otherwise. + Returns [b]1[/b] if this widget is a toplevel (parentless) one, and [b]0[/b] otherwise. !fn: $isVisible() - Returns '1' if this widget is currently visible (read: is managed + Returns [b]1[/b] 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'. + this function returns [b]0[/b]. See also [classfnc]$show[/classfnc]() and [classfnc]$hide[/classfnc](). !fn: $raise() Moves this widget to the top of the stack of the widgets relative @@ -275,13 +276,13 @@ const char * const widgettypes_tbl[] = { Moves this widget to the bottom of the stack of the widgets relative to its parent. See also [classfnc]$raise[/classfnc] !fn: $hasFocus() - Returns '1' if this widget has the keyboard focus. + Returns [b]1[/b] if this widget has the keyboard focus. See also [classfnc]$setFocus[/classfnc]. !fn: $setFocus() Sets this widget to be the one that receives keyboard events. See also [classfnc]$hasFocus[/classfnc] !fn: $parentWidget() - Returns the object ID of the parent widget, or '0' if this + Returns the object ID of the parent widget, or [b]0[/b] if this widget is a toplevel one. !fn: $backgroundColor() Returns the background color of this widget in hexadecimal @@ -317,33 +318,33 @@ const char * const widgettypes_tbl[] = { HTML-like format. See also [classfnc]$setForegroundColor[/classfnc]. !fn: $setMouseTracking(<bool>) - Enables or disables the mouse tracking if <bool> is '1' or '0' respectively. + Enables or disables the mouse tracking if <bool> is [b]1[/b] or [b]0[/b] 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). !fn: $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 cursor is in this widget. <button> is [b]0[/b] if the pressed button + is the left one, [b]1[/b] if the button is the right one and [b]2[/b] 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 "[cmd]setreturn[/cmd] 1" you will stop the internal processing + If you call i][cmd]setreturn[/cmd] [b]1[/b][/i] you will stop the internal processing of this event. The default implementation does nothing. !fn: $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 cursor is in this widget. <button> is [b]0[/b]if the released button + is the left one, [b]1[/b] if the button is the right one and [b]2[/b] 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 "[cmd]setreturn[/cmd] 1" you will stop the internal processing + If you call [i][cmd]setreturn[/cmd] [b]1[/b][/i] you will stop the internal processing of this event. The default implementation does nothing. !fn: $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 cursor is in this widget. <button> is [b]0[/b]if the double clicked button + is the left one, [b]1[/b] if the button is the right one and [b]2[/b] 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 "[cmd]setreturn[/cmd] 1" you will stop the internal processing + If you call [i][cmd]setreturn[/cmd] [b]1[/b][/i] you will stop the internal processing of this event. The default implementation does nothing. !fn: $mouseMoveEvent(<x>,<y>) This function is called when the mouse cursor moves inside this widget. @@ -415,15 +416,15 @@ const char * const widgettypes_tbl[] = { This function sets widget flags, given as parameters. Valid flags are: [pre] - TopLevel - indicates that this widget is a top-level widget[br] - Dialog - indicates that this widget is a top-level window that should be decorated as a dialog[br] - Desktop - indicates that this widget is the desktop[br] - Popup - indicates that this widget is a popup top-level window[br] - Title - gives the window a title bar[br] - StaysOnTop - window stays on top [br] - SysMenu - add a windows system menu[br] - Minimize - add a minimize button for the sysmenu style[br] - Maximize - add a maximixe button for the sysmenu style[br] + TopLevel - indicates that this widget is a top-level widget[br] + Dialog - indicates that this widget is a top-level window that should be decorated as a dialog[br] + Desktop - indicates that this widget is the desktop[br] + Popup - indicates that this widget is a popup top-level window[br] + Title - gives the window a title bar[br] + StaysOnTop - window stays on top [br] + SysMenu - add a windows system menu[br] + Minimize - add a minimize button for the sysmenu style[br] + Maximize - add a maximize button for the sysmenu style[br] [/pre] !fn: $centerToScreen() Centers the window on the screen (useful only for toplevel widgets).[br] @@ -432,48 +433,48 @@ const char * const widgettypes_tbl[] = { Sets the way the widget accepts keyboard focus.[br] Valid parameters are: [pre] - - TabFocus; (widget accepts keyboard focus by tabbing)[br] - - ClickFocus; (widget accepts keyboard focus by clicking)[br] - - StrongFocus; (widget accepts both tabbing/clicking)[br] - - No Focus; (widget does not accept focus at all; this is the default value)[br] + - TabFocus; (widget accepts keyboard focus by tabbing)[br] + - ClickFocus; (widget accepts keyboard focus by clicking)[br] + - StrongFocus; (widget accepts both tabbing/clicking)[br] + - No Focus; (widget does not accept focus at all; this is the default value)[br] [/pre] !fn: $keyPressEvent(<key>) If widget accepts keyboard focus (see [classfnc]$setFocusPolicy[/classfnc] ) this function handles for keys; In its argument the key pressed.[br] Special keys are: [pre] - - Return [br] - - Enter [br] - - Down (cursor arrow down) [br] - - Up (cursor arrow up) [br] - - Left (cursor arrow left) [br] - - Right (cursor arrow right) [br] - - Shift [br] - - Ctrl [br] - - Alt [br] - - CapsLock [br] - - Backspace [br] - - Del [br] - - Esc [br] - - 0 [br] - - 1 [br] - - 2 [br] - - 3 [br] - - 4 [br] - - 5 [br] - - 6 [br] - - 7 [br] - - 8 [br] - - 9 [br] - - + [br] - - - [br] - - * [br] - - / [br] - - ( [br] - - ) [br] - - = [br] - - . [br] - - ^ [br] + - Return [br] + - Enter [br] + - Down (cursor arrow down) [br] + - Up (cursor arrow up) [br] + - Left (cursor arrow left) [br] + - Right (cursor arrow right) [br] + - Shift [br] + - Ctrl [br] + - Alt [br] + - CapsLock [br] + - Backspace [br] + - Del [br] + - Esc [br] + - 0 [br] + - 1 [br] + - 2 [br] + - 3 [br] + - 4 [br] + - 5 [br] + - 6 [br] + - 7 [br] + - 8 [br] + - 9 [br] + - + [br] + - - [br] + - * [br] + - / [br] + - ( [br] + - ) [br] + - = [br] + - . [br] + - ^ [br] [/pre] !fn: $mapFromGlobal(<x>,<y>) Translates the global screen coordinate pos to widget coordinates. @@ -485,40 +486,42 @@ const char * const widgettypes_tbl[] = { Return the y coordinate of the mo>use pointer global position. !fn: <tip:string> $maybeTipEvent(<x_tip_pos:integer>,<y_tip_pos:integer>) This event handler is called when an eventual tip is going to be show. - You can be reimplement this event and set a dynamic tool tip by using "[cmd]return[/cmd] <tooltip_string>". - If a tooltip has setted with [classfnc]$setTooltip[/classfnc] the dynamic tooltip will be ignored. + You can be reimplement this event and set a dynamic tool tip by using [i][cmd]return[/cmd] <tooltip_string>[/i]. + If a tooltip was set with [classfnc]$setTooltip[/classfnc] the dynamic tooltip will be ignored. The default implementation does nothing. !fn: 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. + Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.[br] + Valid attributes are:[br] + [pre] + 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. + [/pre] !fn: $setStyleSheet(<string>) Set a style sheet for this widget. !fn: $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. !fn: $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. + Returns the color in color_group(disabled, active or inactive), used for color_role.[br] 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. - + [pre] + 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. + [/pre] !fn: <short_cut_id:integer> $setKeyShortCut(<key:char>) Adds a shortcut with key. A [classfnc]$shortCutEvent[/classfnc] will be triggered when the user will press alt+key. !fn: $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. - !fn: $insertIntoStatusBar(<index:unsigned integer>) Insert the widget into the statusbar at the given index. If index is out of range, the widget is appended. @@ -528,7 +531,7 @@ const char * const widgettypes_tbl[] = { @examples: [example] %widget = $new(widget) - # This is the main container for other elements. + [comment]# This is the main container for other elements.[/comment] %widget->$setWindowTitle("This is the widget title") @@ -572,9 +575,6 @@ const char * const widgettypes_tbl[] = { [/example] */ - - - // // If you never call c->error(), c->warning() (your function never fails) // and never call a function that can call c->error() or c->warning() @@ -605,10 +605,6 @@ const char * const widgettypes_tbl[] = { // return no errors and results that have to be assumed // as invalid (this allows the minimum overhead: if widget() -//============================================================================================================= - - - KVSO_BEGIN_REGISTERCLASS(KvsObject_widget,"widget","object") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,setParent) // apparence diff --git a/src/modules/objects/KvsObject_window.cpp b/src/modules/objects/KvsObject_window.cpp index eb7fab173..2f45829b7 100644 --- a/src/modules/objects/KvsObject_window.cpp +++ b/src/modules/objects/KvsObject_window.cpp @@ -90,16 +90,15 @@ QPixmap * KviKvsScriptWindowWindow::myIconPtr() @description: This class represents a window in a KVIrc frame. Regardless of the parent object passed, the window will be always - a "physical" child of the frame window: you can't embed a window object - inside a widget or another window. The parent object will just "own" this + a [i]physical[/i] child of the frame window: you can't embed a window object + inside a widget or another window. The parent object will just [i]own[/i] this window object and eventually destroy it when it dies. This class can manage only a single central child widget that must be set with $setCentralWidget(). - The central widget MUST be set before you initially call show() + The central widget [b]must[/b] be set before you initially call show() @functions: */ - KVSO_BEGIN_REGISTERCLASS(KvsObject_window,"window","widget") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_window,setWindowTitle) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_window,setIcon) diff --git a/src/modules/objects/KvsObject_workspace.cpp b/src/modules/objects/KvsObject_workspace.cpp index 52ece77fb..3ec7346fa 100644 --- a/src/modules/objects/KvsObject_workspace.cpp +++ b/src/modules/objects/KvsObject_workspace.cpp @@ -72,101 +72,99 @@ !fn: $activateNextWindow() Activates the next window in the child window chain. !fn: $activatePrevWindow() - Activates the previous window in the child window chain.[br] + Activates the previous window in the child window chain. @examples: [example] - [comment] - //Let's start. - //We start the main class creation, in the constructor we do the - //widget's showing, to give a particular pop-up - //creation appearance. - [/comment] - class (ws,widget)[br] - {[br] - constructor[br] - {[br] - $$->$setGeometry(%X,%Y,100,100)[br](KviKvsObjectFunctionCall *c - $$->%label=$new(label,$$)[br] - $$->%label->$settext("Another class by N\&G")[br] - $$->%label->$setautoresize(1)[br] - $$->$show()[br] - }[br] - }[br] - [comment]//We create the new workspace, and we set a 640x480 size with widget $resize command[/comment][br] - %Workspace=$new(workspace)[br] - %Workspace->$resize(640,480)[br] - [comment] - //Now we make a cycling construction of the widgets(look at the class), - //and give to the widgets a random X and Y coordinates. - //It takes few seconds to show the effects, be patient. - [/comment] - %I=0[br] - while (%I<100)[br] - {[br] - %X=$rand(500)[br] - %Y=$rand(480)[br] - %Widget=$new(ws,%Workspace)[br] - %I++[br] - }[br] - [comment]//Let's show the fireworks! EnJoY![/comment] - %Workspace->$show()[br] + [comment]# Let's start. + # We start the main class creation, in the constructor we do the + # widget's showing, to give a particular popup + # creation appearance. + [/comment] + class (ws,widget) + { + constructor + { + $$->$setGeometry(%X,%Y,100,100)[br](KviKvsObjectFunctionCall *c + $$->%label=$new(label,$$) + $$->%label->$settext("Another class by N\&G") + $$->%label->$setautoresize(1) + $$->$show() + } + } + [comment]# We create the new workspace, and we set a 640x480 size with widget $resize command[/comment] + %Workspace=$new(workspace) + %Workspace->$resize(640,480) + [comment]# Now we make a cycling construction of the widgets (look at the class), + # and give to the widgets a random X and Y coordinates. + # It takes few seconds to show the effects, be patient. + [/comment] + %I=0 + while (%I<100) + + %X=$rand(500) + %Y=$rand(480) + %Widget=$new(ws,%Workspace) + %I++ + } + [comment]# Let's show the fireworks! EnJoY![/comment] + %Workspace->$show() [/example] + [b]Example 2:[/b] [example] - [b]Example 2:[/b] - [comment]//This is like the first example but it has a particular animation effect.[/comment] - %Hex[]=$array(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)[br] - class (ws,widget)[br] - {[br] - constructor[br] - {[br] - $$->$setGeometry(%X,%Y,100,100)[br] - $$->%lay=$new(layout,$$)[br] - %i=0[br] - while (%i<10)[br] - {[br] - $$->%label=$new(label,$$)[br] - $$->%label->$settext("Another class by N\&G")[br] - %color=%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)][br] - $$->%label->$setforegroundcolor(%color)[br] - $$->%label->$setautoresize(1)[br] - $$->%lay->$addwidget($$->%label,%i,0)[br] - %i++;[br] - }[br] - $$->$show()[br] - }[br] - mousepressevent[br] - {[br] - if ($istimer(cycle) == 1) killtimer cycle[br] - }[br] - }[br] - %Workspace=$new(workspace)[br] - %Workspace->$resize(640,480)[br] - %Workspace->$setWindowTitle("Hit the mouse to stop cycling windows...")[br] - %I=0[br] - %Cycle=1[br] - while (%I<20)[br] - {[br] - %X=$rand(500)[br] - %Y=$rand(480)[br] - %Widget=$new(ws,%Workspace)[br] - %I++[br] - }[br] - %Workspace->$show[br] - timer (cycle,3000)[br] - {[br] - if (%Cycle==1) %Workspace->$tile()[br] - if (%Cycle==2)[br] - {[br] - %Workspace->$cascade()[br] - %Cycle=1[br] - return[br] - }[br] - %Cycle++[br] - }[br] - privateimpl(%Workspace,mousepressevent)[br] - {[br] - if ($istimer(cycle) == 1) killtimer cycle[br] - }[br] + [comment]# This is like the first example but it has a particular animation effect.[/comment] + %Hex[]=$array(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) + class (ws,widget) + { + constructor + { + $$->$setGeometry(%X,%Y,100,100) + $$->%lay=$new(layout,$$) + %i=0 + while (%i<10) + { + $$->%label=$new(label,$$) + $$->%label->$settext("Another class by N\&G") + %color=%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)]%Hex[$rand(15)] + $$->%label->$setforegroundcolor(%color) + $$->%label->$setautoresize(1) + $$->%lay->$addwidget($$->%label,%i,0) + %i++; + } + $$->$show() + } + mousepressevent + { + if ($istimer(cycle) == 1) killtimer cycle + } + } + %Workspace=$new(workspace) + %Workspace->$resize(640,480) + %Workspace->$setWindowTitle("Hit the mouse to stop cycling windows...") + %I=0 + %Cycle=1 + while (%I<20) + { + %X=$rand(500) + %Y=$rand(480) + %Widget=$new(ws,%Workspace) + %I++ + } + %Workspace->$show + timer (cycle,3000) + { + if (%Cycle==1) %Workspace->$tile() + if (%Cycle==2) + { + %Workspace->$cascade() + %Cycle=1 + return + } + %Cycle++ + } + privateimpl(%Workspace,mousepressevent) + { + if ($istimer(cycle) == 1) killtimer cycle + } [/example] */ diff --git a/src/modules/objects/KvsObject_wrapper.cpp b/src/modules/objects/KvsObject_wrapper.cpp index 0faaed22b..2e73a61a1 100644 --- a/src/modules/objects/KvsObject_wrapper.cpp +++ b/src/modules/objects/KvsObject_wrapper.cpp @@ -35,7 +35,6 @@ #include "KviApplication.h" #include "KviMainWindow.h" - /* @doc: wrapper @keyterms: @@ -50,144 +49,112 @@ [class]object[/class] [class]widget[/class] @description: - [p] This class "wraps" existing KVIrc widgets and allows using the [class]widget[/class] class API to manipulate them. You can use it, for example, to set the geometry of the - KVIrc main window or to apply some crazy graphical changes to the UI. - [/p] - [p] + KVIrc main window or to apply some crazy graphical changes to the UI.[br] The KVIrc Qt widgets are arranged in trees (just as the objects). The difference is that there can be more than one - toplevel widget and so more than one tree. You can use [fnc]$objects.dump()[/fnc] to take a look at the KVIrc Qt objects tree. - [/p] - [p] + toplevel widget and so more than one tree. You can use [fnc]$objects.dump()[/fnc] to take a look at the KVIrc Qt objects tree.[br] Here is a part of the tree: - [/p] [example] - Ptr 23786128: top level object: kvirc_frame, class KviMainWindow, visible, rect = 1678, -3, 1680, 1030 - >Ptr 23496976: object: qt_rubberband, class QRubberBand - >Ptr 23536608: object: main_frame_splitter, class QSplitter - >>Ptr 23795232: object: mdi_manager, class KviWindowStack - >>>Ptr 23863200: object: qt_scrollarea_hcontainer, class QWidget - >>>>Ptr 23418224: object: , class QScrollBar - >>>Ptr 23864832: object: qt_scrollarea_vcontainer, class QWidget - >>>>Ptr 22383424: object: , class QScrollBar - >>Ptr 25750832: object: mdi_manager, class KviWindowStack - >>>Ptr 26112928: object: , class QWidget - >>>>Ptr 45381568: object: , class Oxygen::MdiWindowShadow - >>>>Ptr 45952496: object: mdi_child_Azzurra_#kvirc, class KviMdiChild - >>>>>Ptr 43714656: object: #kvirc, class KviChannelWindow - >Ptr 18004432: object: , class KviStatusBar - >>Ptr 18007408: object: msgstatuslabel, class QLabel - >>>Ptr 24067088: object: , class Oxygen::TransitionWidget - >Ptr 24503248: object: windowlist, class KviTreeWindowList - >>Ptr 24459744: object: qt_dockwidget_floatbutton, class QDockWidgetTitleButton - >>Ptr 24498560: object: qt_dockwidget_closebutton, class QDockWidgetTitleButton - >>Ptr 23996288: object: tree_windowlist, class KviTreeWindowListTreeWidget + Ptr 23786128: top level object: kvirc_frame, class KviMainWindow, visible, rect = 1678, -3, 1680, 1030 + >Ptr 23496976: object: qt_rubberband, class QRubberBand + >Ptr 23536608: object: main_frame_splitter, class QSplitter + >>Ptr 23795232: object: mdi_manager, class KviWindowStack + >>>Ptr 23863200: object: qt_scrollarea_hcontainer, class QWidget + >>>>Ptr 23418224: object: , class QScrollBar + >>>Ptr 23864832: object: qt_scrollarea_vcontainer, class QWidget + >>>>Ptr 22383424: object: , class QScrollBar + >>Ptr 25750832: object: mdi_manager, class KviWindowStack + >>>Ptr 26112928: object: , class QWidget + >>>>Ptr 45381568: object: , class Oxygen::MdiWindowShadow + >>>>Ptr 45952496: object: mdi_child_Azzurra_#kvirc, class KviMdiChild + >>>>>Ptr 43714656: object: #kvirc, class KviChannelWindow + >Ptr 18004432: object: , class KviStatusBar + >>Ptr 18007408: object: msgstatuslabel, class QLabel + >>>Ptr 24067088: object: , class Oxygen::TransitionWidget + >Ptr 24503248: object: windowlist, class KviTreeWindowList + >>Ptr 24459744: object: qt_dockwidget_floatbutton, class QDockWidgetTitleButton + >>Ptr 24498560: object: qt_dockwidget_closebutton, class QDockWidgetTitleButton + >>Ptr 23996288: object: tree_windowlist, class KviTreeWindowListTreeWidget [/example] - [p] As you can see the objects are identified by their names (for example "mdi_manager") and - by their class names (for example KviChannelWindow). - To wrap a specific widget you must provide a path in the tree composed of search specifiers. - Each search specifier can have one of the following forms: - [/p] + by their class names (for example KviChannelWindow).[br] + To wrap a specific widget you must provide a path in the tree composed of search specifiers.[br] + Each search specifier can have one of the following forms:[br] [example] - (1) <class> - (2) <class>::<name> - (3) ::<name> - (4) !Window::<window_identifier> - (5) !Parent::N + (1) <class> + (2) <class>::<name> + (3) ::<name> + (4) !Window::<window_identifier> + (5) !Parent::N [/example] - [p] - The first three forms may be preceded by the prefix '*' which will tell KVS to perform - a recursive search from this point. Let's see some examples. - [/p] - [p] - The form (1) matches the first widget with the specified class name. For instance: - [/p] + The first three forms may be preceded by the prefix [b]*[/b] which will tell KVS to perform + a recursive search from this point. Let's see some examples.[br] + The form (1) matches the first widget with the specified class name.[br] + For instance:[br] [example] - %Frame = $new(wrapper,0,test,KviMainWindow) + %Frame = $new(wrapper,0,test,KviMainWindow) [/example] - [p] This will wrap the first top level object with class KviMainWindow. Now you can use - any [class]widget[/class] or [class]object[/class] methods on it. - [/p] + any [class]widget[/class] or [class]object[/class] methods on it.[br] [example] - %Frame = $new(wrapper,0,test,KviMainWindow) - %Frame->$setGeometry(20,20,400,400); + %Frame = $new(wrapper,0,test,KviMainWindow) + %Frame->$setGeometry(20,20,400,400); [/example] - [p] - If you want to wrap the KVIrc status bar you can use a composite path: - [/p] + If you want to wrap the KVIrc status bar you can use a composite path:[br] [example] - %StatusBar = $new(wrapper,0,test,KviMainWindow,KviStatusBar) - %StatusBar->$setProperty(autoFillBackground,1) - %StatusBar->$setBackgroundColor(80,80,0) + %StatusBar = $new(wrapper,0,test,KviMainWindow,KviStatusBar) + %StatusBar->$setProperty(autoFillBackground,1) + %StatusBar->$setBackgroundColor(80,80,0) [/example] - [p] The form (2) matches both the class and the widget name. In this way you can differentiate - between children that have the same class. For instance: - [/p] + between children that have the same class.[br] + For instance:[br] [example] - %VerticalScrollBar = $new(wrapper,0,test,KviMainWindow,QSplitter,KviWindowStack,QWidget::qt_scrollarea_vcontainer,QScrollBar) - %VerticalScrollBar->$setProperty(invertedAppearance,1); + %VerticalScrollBar = $new(wrapper,0,test,KviMainWindow,QSplitter,KviWindowStack,QWidget::qt_scrollarea_vcontainer,QScrollBar) + %VerticalScrollBar->$setProperty(invertedAppearance,1); [/example] - [p] In this way KVS was able to pick the vertical scrollbar instead of the horizontal one (which comes first in the list). - (Now try to move a window out of the MDI area: the vertical scroll bar will be inverted!). - [/p] - [p] - The form (3) matches only the name and ignores the class. In our sample tree the following example is equivalent to the previous one. - [/p] + (Now try to move a window out of the MDI area: the vertical scroll bar will be inverted!).[br] + The form (3) matches only the name and ignores the class.[br] + In our sample tree the following example is equivalent to the previous one. [example] - %VerticalScrollBar = $new(wrapper,0,test,KviMainWindow,QSplitter,KviWindowStack,::qt_scrollarea_vcontainer,QScrollBar) - %VerticalScrollBar->$setProperty(invertedAppearance,1); + %VerticalScrollBar = $new(wrapper,0,test,KviMainWindow,QSplitter,KviWindowStack,::qt_scrollarea_vcontainer,QScrollBar) + %VerticalScrollBar->$setProperty(invertedAppearance,1); [/example] - [p] If you don't want to specify the full path to the widget you can try to use a recursive search which may skip some levels. - Keep in mind that the recursive search is breadth-first and will return the first widget that matches. - In our sample tree the following would match the first widget with class KviChannelWindow. - [/p] + Keep in mind that the recursive search is breadth-first and will return the first widget that matches.[br] + In our sample tree the following would match the first widget with class KviChannelWindow.[br] [example] - %Chan = $new(wrapper,0,test,*KviChannelWindow) - %Chan->$setBackgroundColor(80,0,0); + %Chan = $new(wrapper,0,test,*KviChannelWindow) + %Chan->$setBackgroundColor(80,0,0); [/example] - [p] - The following would match the first widget with name #kvirc - [/p] + The following would match the first widget with name #kvirc[br] [example] - %Chan = $new(wrapper,0,test,*::#kvirc) - %Chan->$setBackgroundColor(80,0,0); + %Chan = $new(wrapper,0,test,*::#kvirc) + %Chan->$setBackgroundColor(80,0,0); [/example] - [p] The recursive search can start at any level, so if starting from the root does not work properly you might try - specifying a part of the path and then searching recursively. - [/p] + specifying a part of the path and then searching recursively.[br] [example] - %Chan = $new(wrapper,0,test,KviMainWindow,*::#kvirc) - %Chan->$setBackgroundColor(80,0,0); + %Chan = $new(wrapper,0,test,KviMainWindow,*::#kvirc) + %Chan->$setBackgroundColor(80,0,0); [/example] - [p] The form (4) allows you to jump directly to a specific KVIrc channel/query/console window, - without the need of looking it up in the tree. - [/p] + without the need of looking it up in the tree.[br] [example] - %Win = $new(wrapper,0,test,!Window::$window) - %Win->$setBackgroundColor(80,0,0); + %Win = $new(wrapper,0,test,!Window::$window) + %Win->$setBackgroundColor(80,0,0); [/example] - [p] - Finally the last form allows you to jump N levels up in the tree. If N is omitted it is assumed to be 1. - [/p] + Finally the last form allows you to jump N levels up in the tree.[br] + If N is omitted it is assumed to be 1. [example] - %Win = $new(wrapper,0,test,!Window::$window,!Parent::3) - %Win->$setGeometry(10,10,40,40) + %Win = $new(wrapper,0,test,!Window::$window,!Parent::3) + %Win->$setGeometry(10,10,40,40) [/example] - [p] Experiment with it :) - [/p] */ - - KVSO_BEGIN_REGISTERCLASS(KvsObject_wrapper,"wrapper","widget") KVSO_END_REGISTERCLASS(KvsObject_wrapper) diff --git a/src/modules/objects/libkviobjects.cpp b/src/modules/objects/libkviobjects.cpp index c862eed37..caf3f8a04 100644 --- a/src/modules/objects/libkviobjects.cpp +++ b/src/modules/objects/libkviobjects.cpp @@ -624,32 +624,32 @@ static bool objects_kvs_cmd_disconnect(KviKvsModuleCommandCall * c) static bool objects_kvs_fnc_listObjects(KviKvsModuleFunctionCall * cmd) { -/* - @doc: objects.dump - @type: - function - @title: - $objects.dump - @keyterms: - dump objects - @short: - Dump the KVIrc widgets. - @syntax: - <array> $objects.dump(<print:boolean>) - @description: - This function return an array containing a representation of the widgets tree in KVIrc;[br] - If the <print> flag is enabled, the array will be printed in the current window, too. - @examples: - [example] - %A[]=$objects.dump(0) - %i=0 - while (%i != %A[]#) - { - echo %A[%i] - %i++ - } - [/example] -*/ + /* + @doc: objects.dump + @type: + function + @title: + $objects.dump + @keyterms: + dump objects + @short: + Dump the KVIrc widgets. + @syntax: + <array> $objects.dump(<print:boolean>) + @description: + This function return an array containing a representation of the widgets tree in KVIrc;[br] + If the <print> flag is enabled, the array will be printed in the current window, too. + @examples: + [example] + %A[]=$objects.dump(0) + %i=0 + while (%i != %A[]#) + { + echo %A[%i] + %i++ + } + [/example] + */ bool bFlag; |
