Difference between revisions of "Talk:CudaText API"

From Lazarus wiki
Jump to navigationJump to search
Line 3: Line 3:
 
== toolbar_proc (to do) ==
 
== toolbar_proc (to do) ==
  
  toolbar_proc(id_toolbar, id_action, text="", text2="", command="", index=-1, index2=-1)
+
  toolbar_proc(id_toolbar, id_action, text="", text2="", command=0, index=-1, index2=-1)
  
 
Perform action on some toolbar.  
 
Perform action on some toolbar.  
Line 12: Line 12:
  
 
* TOOLBAR_GET_ICON_SIZES: Get sizes of icons, as 2-tuple (width, height).
 
* TOOLBAR_GET_ICON_SIZES: Get sizes of icons, as 2-tuple (width, height).
* TOOLBAR_SET_ICON_SIZES: Set sizes of icons. Params:  
+
* TOOLBAR_SET_ICON_SIZES: Set sizes of icons. Gets bool: sizes correct (8..128) and changed. Params:  
 
** index - icon width
 
** index - icon width
 
** index2 - icon height
 
** index2 - icon height
  
* TOOLBAR_SET_BUTTON: Change properties of one button. Params:
+
* TOOLBAR_SET_BUTTON: Change properties of one button. Gets bool: params ok and changed. Params:
 
** index - index of button
 
** index - index of button
 
** index2 - new icon index, or -1 for none
 
** index2 - new icon index, or -1 for none
Line 30: Line 30:
 
** text - button caption, use "-" for separator
 
** text - button caption, use "-" for separator
 
** text2 - button hint (tooltip)
 
** text2 - button hint (tooltip)
** command - description of command. Can be: int_command, str(int_command), "py_module,method", "py_module,method,param".
+
** command - description of command: int_command, str(int_command), "py_module,method", "py_module,method,param"
 
** index - button index, >=0 to insert or -1 to append
 
** index - button index, >=0 to insert or -1 to append
 
** index2 - icon index, or -1 for none
 
** index2 - icon index, or -1 for none
  
* TOOLBAR_ENUM: Enumerates buttons. Gets list of dict, each dict item is: {"cap": str; "cmd": str; "hint": str; "icon": int}.
+
* TOOLBAR_ENUM: Enumerates buttons. Gets list of dict, each dict item is: {"cap": str; "hint": str; "cmd": str; "icon": int; "kind": str}. Here "kind" is one of strings: "text", "icon", "text_icon", "text_arrow", "arrow", "sep".

Revision as of 14:21, 30 March 2017

(no text)

toolbar_proc (to do)

toolbar_proc(id_toolbar, id_action, text="", text2="", command=0, index=-1, index2=-1)

Perform action on some toolbar.

Param id_toolbar: currently can be "top" for main toolbar. Function gets None, if id_toolbar not correct.

Param id_action possible values:

  • TOOLBAR_GET_ICON_SIZES: Get sizes of icons, as 2-tuple (width, height).
  • TOOLBAR_SET_ICON_SIZES: Set sizes of icons. Gets bool: sizes correct (8..128) and changed. Params:
    • index - icon width
    • index2 - icon height
  • TOOLBAR_SET_BUTTON: Change properties of one button. Gets bool: params ok and changed. Params:
    • index - index of button
    • index2 - new icon index, or -1 for none
    • text - new button caption, or empty str to not change
    • text2 - new button hint, or empty str to not change
  • TOOLBAR_ADD_ICON: Add an icon (to toolbar's image list) from picture file (png). Params: text - picture filename. Picture sizes must not be equal to toolbar icon sizes. Gets icon index for new icon, or None if cannot add.
  • TOOLBAR_DELETE_ALL: Delete all buttons.
  • TOOLBAR_DELETE_BUTTON: Delete one button. Params: index - button index.
  • TOOLBAR_ADD_BUTTON: Add one button. Params:
    • text - button caption, use "-" for separator
    • text2 - button hint (tooltip)
    • command - description of command: int_command, str(int_command), "py_module,method", "py_module,method,param"
    • index - button index, >=0 to insert or -1 to append
    • index2 - icon index, or -1 for none
  • TOOLBAR_ENUM: Enumerates buttons. Gets list of dict, each dict item is: {"cap": str; "hint": str; "cmd": str; "icon": int; "kind": str}. Here "kind" is one of strings: "text", "icon", "text_icon", "text_arrow", "arrow", "sep".