X11workbench Toolkit  1.0
__WBChildFrameUI__ Struct Reference

Structure that defines a Child Frame's UI, mainly for a 'superclass'. More...

#include <frame_window.h>

Data Fields

unsigned int ulTag
 tag indicating I'm a 'Child Frame UI' structure
 
void(* do_char )(WBChildFrame *, XClientMessageEvent *)
 handler for regular WB_CHAR Client Messages (typed-in characters). More...
 
void(* scancode )(WBChildFrame *, XClientMessageEvent *)
 handler for 'other scan code' WB_CHAR Client Messages. More...
 
void(* bkspace )(WBChildFrame *, int iACS)
 'backspace' delete character (backspace equivalent), or perform related 'backspace' operation via ctrl/alt/shift. More...
 
void(* del )(WBChildFrame *, int iACS)
 'delete' char under cursor (delete equivalent), or perform related 'delete' operation via ctrl/alt/shift. More...
 
void(* tab )(WBChildFrame *, int iACS)
 'tab' char, or tab navigation. More...
 
void(* enter )(WBChildFrame *, int iACS)
 'enter' char, or 'enter' for navigation. More...
 
void(* properties )(WBChildFrame *)
 display the property sheet for the displayed document (optional)
 
void(* uparrow )(WBChildFrame *, int iACS)
 'up' arrow navigation. More...
 
void(* downarrow )(WBChildFrame *, int iACS)
 'down' arrow navigation. More...
 
void(* leftarrow )(WBChildFrame *, int iACS)
 'left' arrow navigation. More...
 
void(* rightarrow )(WBChildFrame *, int iACS)
 'right' arrow navigation. More...
 
void(* home )(WBChildFrame *, int iACS)
 'home' arrow navigation. More...
 
void(* end )(WBChildFrame *, int iACS)
 'end' arrow navigation. More...
 
void(* pgup )(WBChildFrame *, int iACS)
 'page up' navigation. More...
 
void(* pgdown )(WBChildFrame *, int iACS)
 'page down' navigation. More...
 
void(* pgleft )(WBChildFrame *, int iACS)
 'page left' navigation. More...
 
void(* pgright )(WBChildFrame *, int iACS)
 'page right' navigation. More...
 
void(* help )(WBChildFrame *, int iACS)
 'help' context (F1). More...
 
void(* hover_notify )(WBChildFrame *, int x, int y)
 'mouse hover' notification More...
 
void(* hover_cancel )(WBChildFrame *)
 'mouse hover' cancel notification More...
 
int(* is_ins_mode )(WBChildFrame *)
 Use this to determine whether you are in 'insert' or 'overwrite' mode. More...
 
void(* toggle_ins_mode )(WBChildFrame *)
 toggles insert mode on or off More...
 
void(* copy_to_cb )(WBChildFrame *)
 copy selection to clipboard More...
 
void(* paste_from_cb )(WBChildFrame *)
 paste from clipboard More...
 
void(* cut_to_cb )(WBChildFrame *)
 delete selection, copying to clipboard first More...
 
void(* delete_sel )(WBChildFrame *)
 delete selection only More...
 
void(* select_all )(WBChildFrame *)
 select all More...
 
void(* select_none )(WBChildFrame *)
 select none More...
 
void(* save )(WBChildFrame *, const char *szFileName)
 save to specified file name More...
 
WB_PCSTR(* get_file_name )(WBChildFrame *)
 get a (const) pointer to the file name string More...
 
void(* mouse_click )(WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)
 'mouse click' notification. More...
 
void(* mouse_dblclick )(WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)
 'mouse double click' notification. More...
 
void(* mouse_drag )(WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)
 'mouse drag' (begin) notification. More...
 
void(* mouse_drop )(WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)
 'mouse drop' (drag end) notification. More...
 
void(* mouse_move )(WBChildFrame *, int iX, int iY)
 'mouse motion' notification. More...
 
void(* scroll_vert )(WBChildFrame *, int iMode, int iValue)
 'scroll vertical' notification. More...
 
void(* scroll_horiz )(WBChildFrame *, int iMode, int iValue)
 'scroll vertical' notification. More...
 
void(* mouse_cancel )(WBChildFrame *)
 'mouse cancel' notification (cancel 'drag', etc.). More...
 
void(* get_row_col )(WBChildFrame *, int *piR, int *piC)
 Obtain the current row/column cursor locationfor UI notification. More...
 
int(* has_selection )(WBChildFrame *)
 returns non-zero value if there is a selection More...
 
void(* undo )(WBChildFrame *)
 perform an undo operation More...
 
void(* redo )(WBChildFrame *)
 perform a re-do More...
 
int(* can_undo )(WBChildFrame *)
 returns non-zero value if 'can undo' More...
 
int(* can_redo )(WBChildFrame *)
 returns non-zero value if 'can redo' More...
 
int(* is_empty )(WBChildFrame *)
 returns non-zero value if contents are 'empty' More...
 

Detailed Description

Structure that defines a Child Frame's UI, mainly for a 'superclass'.

The base user interface for a child frame does very little except interact with tabs and the Frame Window. To make it really do something, you need some kind of interface. This function table defines the UI interface for a Child Frame that will allow it to perform basic editing and navigation functions. If you need additional capabilities, you can hook the messages with the assigned callback function. Otherwise, most of the work will already be done for your custom child frame.

typedef struct __WBChildFrameUI__
{
unsigned int ulTag;
// tag indicating I'm a 'Child Frame UI' structure
void (*do_char)(WBChildFrame *, XClientMessageEvent *);
// handler for regular WB_CHAR Client Messages (typed-in characters).
// NOT called for 'special' characters.
void (*scancode)(WBChildFrame *, XClientMessageEvent *);
// handler for 'other scan code' WB_CHAR Client Messages (typed-in characters)
void (*bkspace)(WBChildFrame *, int iACS);
// 'backspace' delete character (backspace equivalent).
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*del)(WBChildFrame *, int iACS);
// 'delete' char under cursor (delete equivalent).
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*tab)(WBChildFrame *, int iACS);
// 'tab' char, or tab navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*enter)(WBChildFrame *, int iACS);
// 'enter' char, or 'enter' for navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
// display the property sheet for the displayed document
void (*uparrow)(WBChildFrame *, int iACS);
// 'up' arrow navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*downarrow)(WBChildFrame *, int iACS);
// 'down' arrow navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*leftarrow)(WBChildFrame *, int iACS);
// 'left' arrow navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*rightarrow)(WBChildFrame *, int iACS);
// 'right' arrow navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*home)(WBChildFrame *, int iACS);
// 'home' arrow navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*end)(WBChildFrame *, int iACS);
// 'end' arrow navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*pgup)(WBChildFrame *, int iACS);
// 'page up' navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*pgdown)(WBChildFrame *, int iACS);
// 'page down' navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*pgleft)(WBChildFrame *, int iACS);
// 'page left' navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*pgright)(WBChildFrame *, int iACS);
// 'page right' navigation.
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*help)(WBChildFrame *, int iACS);
// 'help' context (F1).
// 'iACS' is the Alt/Ctrl/Shift flags. See Also: aWB_CHAR
void (*hover_notify)(WBChildFrame *, int x, int y);
// 'mouse hover' notification (x and y are pixel coords with respect to upper left corner)
// 'mouse hover' cancel notification (cancel any 'hover' action)
// returns non-zero if in 'insert' mode, 0 for 'overwrite'
// toggles insert mode on/off (press 'INS' key)
// copy selection to clipboard
// paste from clipboard
void (*cut_to_cb)(WBChildFrame *);
// delete selection, copying to clipboard first
// delete selection only
// select all
// select none
void (*save)(WBChildFrame *, const char *szFileName);
// save to specified file name (NULL to keep same file name)
// get (const) pointer to file name string
void (*mouse_click)(WBChildFrame *, int iX, int iY,
int iButtonMask, int iACS);
// 'mouse click' notification. See Also: aWB_POINTER
void (*mouse_dblclick)(WBChildFrame *, int iX, int iY,
int iButtonMask, int iACS);
// 'mouse double click' notification. See Also: aWB_POINTER
void (*mouse_drag)(WBChildFrame *, int iX, int iY,
int iButtonMask, int iACS);
// 'mouse drag' (begin) notification. See Also: aWB_POINTER
void (*mouse_drop)(WBChildFrame *, int iX, int iY,
int iButtonMask, int iACS);
// 'mouse drop' (drag end) notification. See Also: aWB_POINTER
void (*mouse_move)(WBChildFrame *, int iX, int iY);
// 'mouse motion' notification. See Also: aWB_POINTER
void (*scroll_vert)(WBChildFrame *, int iMode, int iValue);
// 'scroll vertical' notification. See Also: aSCROLL_NOTIFY
void (*scroll_horiz)(WBChildFrame *, int iMode, int iValue);
// 'scroll horizontal' notification. See Also: aSCROLL_NOTIFY
// 'mouse cancel' notification (cancel 'drag', etc.).
// See Also: aWB_POINTER , WBMouseCancel()
void (*get_row_col)(WBChildFrame *, int *piR, int *piC);
// Obtain the current row/column cursor location for UI notification.
// 'piR' points to an integer to get the row, and
// 'piC' points to an integer to get the column.
// Both are 1-based values (<= 0 is 'error' or 'NA')
// returns non-zero value if there is a selection
void (*undo)(WBChildFrame *);
// perform an undo
void (*redo)(WBChildFrame *);
// perform a re-do
// returns non-zero value if 'can undo'
// returns non-zero value if 'can redo'
// returns non-zero value if contents are 'empty' (cannot select anything)

A window interface derived from 'WBChildFrame' needs a way for the 'abstract class' to invoke the UI functionality. To make this work, the 'superclass' (i.e. derived) window interface can populate a WBChildFrameUI structure with function pointers, as needed, to implement the necessary elements.

For those elements that are NOT implemented, you can use NULL for the function pointer. That way if the derived window interface does not need 'hover' support, you can leave the 'hover_notify' and 'hover_cancel' function pointers as NULL, but populate everything else.

For the 'iACS' parameters, use the 'iACS' information from the aWB_CHAR. This is the 'Alt/Ctrl/Shift' flag that indicates which of those buttons were being held down at the time of the character translation. For more information on THAT, see WB_CHAR.

The basic difference between 'do_char' and 'scancode' is that the 'character' events will be passed along to the 'do_char' callback, but 'scan code' events (NOT processed by one of the other callbacks) will be passed along via the 'scancode' callback. This will allow your custom UI handler to interpret additional 'special' keys as needed. The ones normally processed are: insert, delete, home, end, pgup, pgdown, and the 'F1' key.

NOTE: if a menu defines hotkey combinations, no 'WB_CHAR' event will be generated for any of those. Instead, the menu handler needs to interpret them correctly if the UI callback will need to be invoked. One example in the X11workbench.c handler (for the main edit window UI) is the handling of the 'Edit' sub-menu, which includes hotkey combinations such as 'CTRL+V' for 'paste'. When the 'paste' menu is invoked, the handler will need to grab the WBChildFrameUI structure for the currently active Child Window, and invoke its 'paste_from_cb' callback function directly. Similarly, if 'F1' is invoked, it will need to call the 'help' function directly, passing the correct 'iACS' parameter value.

Definition at line 677 of file frame_window.h.

Field Documentation

◆ bkspace

void(* bkspace) (WBChildFrame *, int iACS)

'backspace' delete character (backspace equivalent), or perform related 'backspace' operation via ctrl/alt/shift.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 682 of file frame_window.h.

◆ can_redo

int(* can_redo) (WBChildFrame *)

returns non-zero value if 'can redo'

Interfaces/Objects that support 're-do' AND have a non-empty re-do buffer will return non-zero.

Definition at line 731 of file frame_window.h.

◆ can_undo

int(* can_undo) (WBChildFrame *)

returns non-zero value if 'can undo'

Interfaces/Objects that support 'undo' AND have a non-empty undo buffer will return non-zero.

Definition at line 730 of file frame_window.h.

◆ copy_to_cb

void(* copy_to_cb) (WBChildFrame *)

copy selection to clipboard

implements 'copy' functionality. The current selection will be copied to the clipboard

Definition at line 702 of file frame_window.h.

◆ cut_to_cb

void(* cut_to_cb) (WBChildFrame *)

delete selection, copying to clipboard first

implements 'cut' functionality

Definition at line 704 of file frame_window.h.

◆ del

void(* del) (WBChildFrame *, int iACS)

'delete' char under cursor (delete equivalent), or perform related 'delete' operation via ctrl/alt/shift.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 683 of file frame_window.h.

◆ delete_sel

void(* delete_sel) (WBChildFrame *)

delete selection only

deletes the current selection, but has no effect if there is no selection. To delete a character, see 'del()'

Definition at line 705 of file frame_window.h.

◆ do_char

void(* do_char) (WBChildFrame *, XClientMessageEvent *)

handler for regular WB_CHAR Client Messages (typed-in characters).

The XClientMessageEvent will be interpreted and characters added to the associated document or object. This function should NOT be called for 'special' characters, like cursors, backspace, and so on.

Definition at line 680 of file frame_window.h.

◆ downarrow

void(* downarrow) (WBChildFrame *, int iACS)

'down' arrow navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 688 of file frame_window.h.

◆ end

void(* end) (WBChildFrame *, int iACS)

'end' arrow navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 692 of file frame_window.h.

◆ enter

void(* enter) (WBChildFrame *, int iACS)

'enter' char, or 'enter' for navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 685 of file frame_window.h.

◆ get_file_name

WB_PCSTR(* get_file_name) (WBChildFrame *)

get a (const) pointer to the file name string

Use this function to find out what the currently assigned file name is. The returned pointer is NOT persistent across function calls. If you need a copy, use SBCopyString() or similar

Definition at line 710 of file frame_window.h.

◆ get_row_col

void(* get_row_col) (WBChildFrame *, int *piR, int *piC)

Obtain the current row/column cursor locationfor UI notification.

'piR' points to an integer to get the row, and 'piC' points to an integer to get the column. Both are 1-based values, so a value <\= 0 is considered 'error' or 'NA'

Definition at line 726 of file frame_window.h.

◆ has_selection

int(* has_selection) (WBChildFrame *)

returns non-zero value if there is a selection

Since this affects specific UI behavior, you should use this to control enabling of the 'copy' and 'cut' menus, as an example

Definition at line 727 of file frame_window.h.

◆ help

void(* help) (WBChildFrame *, int iACS)

'help' context (F1).

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 697 of file frame_window.h.

◆ home

void(* home) (WBChildFrame *, int iACS)

'home' arrow navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 691 of file frame_window.h.

◆ hover_cancel

void(* hover_cancel) (WBChildFrame *)

'mouse hover' cancel notification

This will cancel any 'hover' action

Definition at line 699 of file frame_window.h.

◆ hover_notify

void(* hover_notify) (WBChildFrame *, int x, int y)

'mouse hover' notification

x and y are pixel coords with respect to upper left corner

Definition at line 698 of file frame_window.h.

◆ is_empty

int(* is_empty) (WBChildFrame *)

returns non-zero value if contents are 'empty'

If the contents are such that a selection cannot be made, this function will return a non-zero value

Definition at line 732 of file frame_window.h.

◆ is_ins_mode

int(* is_ins_mode) (WBChildFrame *)

Use this to determine whether you are in 'insert' or 'overwrite' mode.

returns non-zero if in 'insert' mode, 0 for 'overwrite'

Definition at line 700 of file frame_window.h.

◆ leftarrow

void(* leftarrow) (WBChildFrame *, int iACS)

'left' arrow navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 689 of file frame_window.h.

◆ mouse_cancel

void(* mouse_cancel) (WBChildFrame *)

'mouse cancel' notification (cancel 'drag', etc.).

This is a notification only (any mouse capture must already have been handled).

See also
aWB_POINTER , WBMouseCancel()

Definition at line 725 of file frame_window.h.

◆ mouse_click

void(* mouse_click) (WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)

'mouse click' notification.

part of the mouse UI handling. 'iX', 'iY', 'iButtonMask', and 'iACS' are copied from the aWB_POINTER Client Message event.

Definition at line 712 of file frame_window.h.

◆ mouse_dblclick

void(* mouse_dblclick) (WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)

'mouse double click' notification.

part of the mouse UI handling. 'iX', 'iY', 'iButtonMask', and 'iACS' are copied from the aWB_POINTER Client Message event.

Definition at line 714 of file frame_window.h.

◆ mouse_drag

void(* mouse_drag) (WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)

'mouse drag' (begin) notification.

part of the mouse UI handling. 'iX', 'iY', 'iButtonMask', and 'iACS' are copied from the aWB_POINTER Client Message event.

Definition at line 716 of file frame_window.h.

◆ mouse_drop

void(* mouse_drop) (WBChildFrame *, int iX, int iY, int iButtonMask, int iACS)

'mouse drop' (drag end) notification.

part of the mouse UI handling. 'iX', 'iY', 'iButtonMask', and 'iACS' are copied from the aWB_POINTER Client Message event.

Definition at line 718 of file frame_window.h.

◆ mouse_move

void(* mouse_move) (WBChildFrame *, int iX, int iY)

'mouse motion' notification.

part of the mouse UI handling. 'iX' and 'iY' are copied from the aWB_POINTER Client Message event.

Definition at line 720 of file frame_window.h.

◆ paste_from_cb

void(* paste_from_cb) (WBChildFrame *)

paste from clipboard

implements 'paste' functionality. The current clipboard contents will be pasted, either at the cursor location, or replacing the current selection

Definition at line 703 of file frame_window.h.

◆ pgdown

void(* pgdown) (WBChildFrame *, int iACS)

'page down' navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 694 of file frame_window.h.

◆ pgleft

void(* pgleft) (WBChildFrame *, int iACS)

'page left' navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 695 of file frame_window.h.

◆ pgright

void(* pgright) (WBChildFrame *, int iACS)

'page right' navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 696 of file frame_window.h.

◆ pgup

void(* pgup) (WBChildFrame *, int iACS)

'page up' navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 693 of file frame_window.h.

◆ redo

void(* redo) (WBChildFrame *)

perform a re-do

Use 'can_redo()' to determine whether a re-do is possible

Definition at line 729 of file frame_window.h.

◆ rightarrow

void(* rightarrow) (WBChildFrame *, int iACS)

'right' arrow navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 690 of file frame_window.h.

◆ save

void(* save) (WBChildFrame *, const char *szFileName)

save to specified file name

A value of 'NULL' will keep same file name. If the file name is also NULL (or blank), nothing will be saved.

Definition at line 708 of file frame_window.h.

◆ scancode

void(* scancode) (WBChildFrame *, XClientMessageEvent *)

handler for 'other scan code' WB_CHAR Client Messages.

For those characters NOT already processed as actual characters or 'special' characters, call this function. The XClientMessageEvent will be interpreted, and characters may be added to the associated document or object. In some cases, there may be additional actions performed. This function should rarely be needed.

Definition at line 681 of file frame_window.h.

◆ scroll_horiz

void(* scroll_horiz) (WBChildFrame *, int iMode, int iValue)

'scroll vertical' notification.

A higher-level scrolling notification. 'iMode' is 0 for absolute, 1 for relative. 'iValue' is the absolute (or relative) new horizontal scroll position to assign

See also
aSCROLL_NOTIFY

Definition at line 723 of file frame_window.h.

◆ scroll_vert

void(* scroll_vert) (WBChildFrame *, int iMode, int iValue)

'scroll vertical' notification.

A higher-level scrolling notification. 'iMode' is 0 for absolute, 1 for relative. 'iValue' is the absolute (or relative) new vertical scroll position to assign

See also
aSCROLL_NOTIFY

Definition at line 722 of file frame_window.h.

◆ select_all

void(* select_all) (WBChildFrame *)

select all

implements the 'select all' functionality

Definition at line 706 of file frame_window.h.

◆ select_none

void(* select_none) (WBChildFrame *)

select none

implements the 'select none' functionality

Definition at line 707 of file frame_window.h.

◆ tab

void(* tab) (WBChildFrame *, int iACS)

'tab' char, or tab navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 684 of file frame_window.h.

◆ toggle_ins_mode

void(* toggle_ins_mode) (WBChildFrame *)

toggles insert mode on or off

You can determine the current insert/overwrite state by calling is_ins_mode()

Definition at line 701 of file frame_window.h.

◆ undo

void(* undo) (WBChildFrame *)

perform an undo operation

Use 'can_undo()' to determine whether an undo is possible

Definition at line 728 of file frame_window.h.

◆ uparrow

void(* uparrow) (WBChildFrame *, int iACS)

'up' arrow navigation.

'iACS' is the Alt/Ctrl/Shift flags.

See also
aWB_CHAR

Definition at line 687 of file frame_window.h.


The documentation for this struct was generated from the following file: