SWILIB API (X75)    
Loading...
Searching...
No Matches
ui.h File Reference
#include "base.h"
#include "wstring.h"
#include "date.h"
#include "gui.h"

Go to the source code of this file.

Data Structures

struct  HEADER_DESC
 UI header definition. More...
 
struct  SOFTKEY_DESC
 UI softkey definition. More...
 
struct  SOFTKEYSTAB
 List of the softkeys. More...
 
struct  EDITQ
 Linked-list of the EditControl's. More...
 
struct  EDITC_OPTIONS
 Custom options for EditControl. More...
 
struct  EDITCONTROL
 EditControl definition. More...
 
struct  INPUTDIA_DESC
 InputDialog definition. More...
 
struct  USR_MENU_ITEM
 Custom options menu item for InputDialog. More...
 
struct  MENUITEM_DESC
 Menu item. More...
 
struct  MENU_DESC
 Menu definition (single-line). More...
 
struct  ML_MENU_DESC
 Menu definition (multi-line). More...
 
struct  POPUP_DESC
 Popup definition. More...
 
struct  TVIEW_DESC
 Popup definition. More...
 
struct  TABGUI_DESC
 Tabs definition. More...
 
struct  PBAR_DESC
 Progressbar definition. More...
 
struct  SCROLLBAR_DESC
 Scrollbar widget definition. More...
 

Macros

#define SET_SOFT_KEY_N   SET_LEFT_SOFTKEY
 
#define SET_SOFT_KEY_M   SET_MIDDLE_SOFTKEY
 
#define MENU_FLAG3   3
 Magic value.
 
#define MENU_FLAG2   0x578
 Magic value.
 
#define YDISP   (0)
 Iconbar height.
 

Typedefs

typedef struct EDITCONTROL EDITCONTROL
 
typedef struct EDITC_OPTIONS EDITC_OPTIONS
 
typedef struct EDITQ EDITQ
 
typedef struct INPUTDIA_DESC INPUTDIA_DESC
 
typedef struct USR_MENU_ITEM USR_MENU_ITEM
 
typedef struct HEADER_DESC HEADER_DESC
 
typedef struct SOFTKEY_DESC SOFTKEY_DESC
 
typedef struct SOFTKEYSTAB SOFTKEYSTAB
 
typedef struct MENUITEM_DESC MENUITEM_DESC
 
typedef struct MENU_DESC MENU_DESC
 
typedef struct ML_MENU_DESC ML_MENU_DESC
 
typedef struct POPUP_DESC POPUP_DESC
 
typedef struct TABGUI_DESC TABGUI_DESC
 
typedef struct TVIEW_DESC TVIEW_DESC
 
typedef struct PBAR_DESC PBAR_DESC
 
typedef struct SCROLLBAR_DESC SCROLLBAR_DESC
 
typedef void(* MENUITEM_DRAW_PROC) (void *gui, int item_n, void *user_pointer)
 Menu item draw callback.
 
typedef void(* MENUPROCS_DESC) (GUI *gui)
 Menu item select callback.
 
typedef int(* GUI_ONKEY_CALLBACK) (GUI *gui, GUI_MSG *msg)
 GUI keys handler.
 
typedef void(* GUI_GHOOK_CALLBACK) (GUI *gui, int cmd)
 GUI global hook.
 
typedef void(* GUI_LOCRET_CALLBACK) (void)
 GUI locret callback (empty stub).
 
typedef int(* MenuSearchCallBack) (void *gui, WSHDR *search)
 Menu search callback.
 
typedef enum DialogFlags DialogFlags
 Dialog windows style flags.
 
typedef DialogFlags PopupDialogFlags
 Popup dialog flags.
 
typedef DialogFlags MsgBoxFlags
 Flags for ShowMSG.
 

Enumerations

enum  DialogFlags {
  DIALOG_FULLSCREEN = 0x00 ,
  DIALOG_NORMAL = 0x01 ,
  DIALOG_DUMMY_CSM = 0x10
}
 Dialog windows style flags. More...
 
enum  SetSoftKeyID {
  SET_LEFT_SOFTKEY = 1 ,
  SET_RIGHT_SOFTKEY = 0 ,
  SET_MIDDLE_SOFTKEY = 2
}
 Softkey IDs for SetSoftKey. More...
 
enum  EditControlTypeID {
  ECT_READ_ONLY = 0 ,
  ECT_HEADER = 1 ,
  ECT_NUMBER_TYPING = 2 ,
  ECT_NORMAL_TEXT = 3 ,
  ECT_CURSOR_STAY = 4 ,
  ECT_FIXED_STR_NUM = 5 ,
  ECT_NORMAL_NUM = 6 ,
  ECT_COMBO_BOX = 7 ,
  ECT_READ_ONLY_SELECTED = 8 ,
  ECT_LINK = 9 ,
  ECT_CALENDAR = 10 ,
  ECT_TIME = 11
}
 Types of the EditControl. More...
 
enum  EditControlFlags {
  ECF_NORMAL_STR = 0 ,
  ECF_SKIP = 4 ,
  ECF_INVISIBLE_CURSOR = 8 ,
  ECF_PASSW = 0x10 ,
  ECF_DELSTR = 0x20 ,
  ECF_APPEND_EOL = 0x40 ,
  ECF_SET_CURSOR_END = 0x80 ,
  ECF_DISABLE_NUM = 0x100 ,
  ECF_DISABLE_SMALL_LETTERS = 0x200 ,
  ECF_DISABLE_BIG_LETTERS = 0x400 ,
  ECF_DEFAULT_BIG_LETTER = 0x1000 ,
  ECF_DISABLE_T9 = 0x2000 ,
  ECF_DEFAULT_ITAP = 0x4000 ,
  ECF_DEFAULT_DIGIT = 0x8000 ,
  ECF_DISABLE_EOLCHAR = 0x10000 ,
  ECF_DISABLE_MINUS = 0x20000 ,
  ECF_DISABLE_POINT = 0x40000 ,
  ECF_LONGDIEZ_EQ_QUESTION = 0x80000 ,
  ECF_ENABLE_TEXT_FORMAT = 0x800000 ,
  ECF_MARKED = 0x2000000 ,
  ECF_GRAY = 0x4000000
}
 Flags for the EditControl. More...
 
enum  UIDialogCmdID {
  UI_CMD_CREATE = 0x2 ,
  UI_CMD_DESTROY = 0x3 ,
  UI_CMD_REDRAW = 0x7 ,
  UI_CMD_UNFOCUS = 0x9 ,
  UI_CMD_FOCUS = 0xA
}
 Ghook commands. More...
 
enum  TextInputDialogCmdID {
  TI_CMD_CREATE = 2 ,
  TI_CMD_DESTROY = 3 ,
  TI_CMD_REDRAW = 7 ,
  TI_CMD_UNFOCUS = 9 ,
  TI_CMD_FOCUS = 10 ,
  TI_CMD_SUBFOCUS_CHANGE = 12 ,
  TI_CMD_COMBOBOX_FOCUS = 13
}
 TextInputDialog ghook commands. More...
 
enum  InputDialogFlags {
  INPUTDIA_FLAGS_READONLY = 0x00000002 ,
  INPUTDIA_FLAGS_LOCK_CURSOR = 0x00000004 ,
  INPUTDIA_FLAGS_SWAP_SOFTKEYS = 0x40000000
}
 InputDialog options. More...
 
enum  MenuDialogFlags {
  MENU_FLAGS_ENABLE_ICONS = 0x00000001 ,
  MENU_FLAGS_ENABLE_TEXT_SCROLLING = 0x00000010 ,
  MENU_FLAGS_DISABLE_SCROLLBAR = 0x00000040 ,
  MENU_FLAGS_ENABLE_BIG_LETTERS = 0x00000080 ,
  MENU_FLAGS_ALIGN_RIGHT = 0x00000100 ,
  MENU_FLAGS_DISABLE_BREAKLINE = 0x00000400 ,
  MENU_FLAGS_ENABLE_SEARCH = 0x00010000
}
 Menu options. More...
 

Functions

Common UI functions.
void SetHeader (void *gui, const HEADER_DESC *header, const void *malloc_fn)
 Set header to the GUI.
 
void * GetHeaderPointer (void *gui)
 Get pointer to the UI header.
 
void SetHeaderText (void *header, const WSHDR *title, const void *malloc_fn, const void *mfree_fn)
 Set main text to the UI header.
 
void SetHeaderScrollText (void *header, const WSHDR *title, const void *malloc_fn, const void *mfree_fn)
 Set scolled text to the UI header.
 
void SetHeaderExtraText (void *header, const WSHDR *ws, const void *malloc_fn, const void *mfree_fn)
 Set extra text to the UI header.
 
void SetHeaderIcon (void *header, const int *icons, const void *malloc_fn, const void *mfree_fn)
 Set icons of the UI header.
 
void SetSoftKey (void *gui, const SOFTKEY_DESC *softkey, int softkey_id)
 Add softkey to the GUI.
 
void RefreshGUI (void)
 Force refresh current GUI.
 
void SetGUIDefinition (void *gui, const void *definition)
 Set UI definition to the GUI.
 
void * FindItemByID (GUI *gui, int id)
 Find private item in the GUI.
 
void * GetDataOfItemByID (GUI *gui, int id)
 Get data of the private item in the GUI.
 
RECT * GetHeaderRECT (void)
 Size of UI header.
 
RECT * GetOptionsHeaderRECT (void)
 Size of UI options header.
 
RECT * GetMainAreaRECT (void)
 Size of UI main area.
 
void SetWidgetRect (void *widget, int x, int y, int x2, int y2)
 Dynamically set the bounding rectangle for the widget.
 
Iconbar
void AddIconToIconBar (int pic, short *num)
 Push icon to the iconbar (E/EL71).
 
void * GUI_GetUserPointer (void *gui)
 Get custom user pointer from standard GUI, like Menu.
 
void GUI_SetUserPointer (void *gui, void *user_pointer)
 Set custom user pointer to the GUI, like Menu.
 
char * RamIconBar ()
 Pointer to the status of iconbar (EL/E71).
 
int IsIconBarDisabled ()
 Check state of iconbar (EL71/E71).
 
void DisableIconBar (int disable)
 Enable or disable global iconbar on EL/E71.
 
void AttachWidget (void *gui, const void *widget, int id, const void *malloc_fn)
 Attach a widget to the GUI.
 
Popups
int ShowMSG (int flags, int message)
 Show info popup.
 
int MsgBoxError (int flags, int message)
 Show error popup.
 
int MsgBoxYesNo (int flags, int message, void(*callback)(int canceled))
 Confirmation popup with Yes/No.
 
int MsgBoxOkCancel (int flags, int message, void(*callback)(int canceled))
 Confirmation popup with Ok/Cancel.
 
int ShowWaitBox (int flags, int message)
 Wait popup.
 
int ShowPleaseWaitBox (int flags)
 'Please wait' popup.
 
void * GetPBarProc3 ()
 Get pointer for proc3 method of PBAR_DESC struct.
 
int ShowPBarBox (int flags, int message, PBAR_DESC *pbar_desc, int initial_value, WSHDR *initial_ws)
 Progressbar popup.
 
int SetPBarValue (int gui_id, int value)
 Set value to progressbar popup.
 
int SetPBarText (int gui_id, WSHDR *ws)
 Set WSHDR string to progressbar popup.
 
int CreatePopupGUI (int flags, void *user_pointer, const POPUP_DESC *popup, int lgp_id)
 Create custom Popup.
 
int CreatePopupGUI_ws (int flags, void *user_pointer, const POPUP_DESC *popup, const WSHDR *message)
 Create custom Popup.
 
void * GetPopupUserPointer (void *gui)
 Get user pointer from the popup.
 
InputDialog & EditControl
int CreateInputTextDialog (const INPUTDIA_DESC *input_desc, const HEADER_DESC *header_desc, EDITQ *eq, int do_mfree, void *user_pointer)
 Create InputDialog GUI.
 
void * EDIT_GetGUI (const void *malloc_fn, const void *mfree_fn)
 Allocate GUI for the Input.
 
void EDIT_SetDefinition (void *gui, const INPUTDIA_DESC *input_desc)
 Attach the Input definition to the allocated GUI.
 
void EDIT_SetUserPointer (void *gui, void *user_pointer)
 Set custom user pointer to the Input.
 
void * EDIT_GetUserPointer (void *gui)
 Get user pointer from the InputDialog.
 
int EDIT_IsBusy (void *gui)
 Check if InputDialog is busy.
 
int EDIT_OpenOptionMenuWithUserItems (void *gui, void(*itemhandler)(USR_MENU_ITEM *item), void *user_pointer, int to_add)
 
EDITQ * AllocEQueue (const void *malloc_func, const void *mfree_func)
 List of the edit controls.
 
void EDIT_SetEQueue (void *gui, const EDITQ *eq, int do_mfree, const void *malloc_fn)
 Set list of the edit controls to the allocated GUI.
 
EDITCONTROL * PrepareEditControl (EDITCONTROL *ec)
 Pre-initialize EDITCONTROL structure.
 
void ConstructEditControl (EDITCONTROL *ec, int type, int flags, const WSHDR *title, int maxlen)
 Create new edit control.
 
void ConstructComboBox (EDITCONTROL *ec, int type, int flags, WSHDR *title, int maxlen, int unk_zero, int items_count, int selected_item)
 Create new edit control (ComboBox).
 
int ConstructEditTime (EDITCONTROL *ec, const TTime *time)
 Create new edit control (Time).
 
int ConstructEditDate (EDITCONTROL *ec, const TDate *date)
 Create new edit control (Date).
 
void CopyOptionsToEditControl (EDITCONTROL *ec, const EDITC_OPTIONS *options)
 Set options to the edit control.
 
int AddEditControlToEditQend (EDITQ *eq, const EDITCONTROL *ec, const void *malloc_func)
 Add edit control to the end of the list.
 
int EDIT_GetFocus (void *gui)
 Get index of the focused edit control.
 
int EDIT_GetUnFocus (void *gui)
 Get index of the previous focused edit control.
 
void EDIT_SetFocus (void *gui, int n)
 Focus given edit control.
 
void EDIT_RemoveEditControl (void *gui, int n)
 Remove edit control for the InputDialog.
 
void EDIT_InsertEditControl (void *gui, int n, const EDITCONTROL *ec)
 Insert edit control to the InputDialog.
 
int ExtractEditControl (void *gui, int n, EDITCONTROL *ec)
 Get a copy of the edit control in the InputDialog.
 
void EDIT_ExtractFocusedControl (void *gui, EDITCONTROL *ec)
 Get a copy of the focused edit control in the InputDialog.
 
int StoreEditControl (void *gui, int n, const EDITCONTROL *ec)
 Replace the edit control in the InputDialog.
 
int EDIT_StoreControlToFocused (void *gui, const EDITCONTROL *ec)
 Replace focused edit control in the InputDialog.
 
void EDIT_SetTextToFocused (void *gui, const WSHDR *value)
 Set value to the focused edit control.
 
int EDIT_SetTextToEditControl (void *gui, int n, const WSHDR *value)
 Set value to the given edit control.
 
int EDIT_GetItemNumInFocusedComboBox (void *gui)
 Get item index in the focused ComboBox.
 
void EDIT_SetDate (void *gui, int n, const TDate *date)
 Set date value to the edit control.
 
void EDIT_SetTime (void *gui, int n, const TTime *time)
 Set time value to the edit control.
 
void EDIT_GetDate (void *gui, int n, TDate *date)
 Get date value from the edit control.
 
void EDIT_GetTime (void *gui, int n, TTime *time)
 Get time value from the edit control.
 
int EDIT_GetCursorPos (void *gui)
 Get cursor position in text.
 
void EDIT_SetCursorPos (void *gui, int position)
 Set cursor position in text.
 
int EDIT_IsMarkModeActive (void *gui)
 Check if text selection enabled.
 
int EDIT_GetMarkedText (void *gui, WSHDR *selected_text)
 Get value of the selected text.
 
int EDIT_SetTextInvert (void *gui, int position, int len)
 Invert background of the part of text.
 
void EDIT_RemoveTextInvert (void *gui)
 Remove text background ivertion.
 
EditControl options
EDITC_OPTIONS * PrepareEditCOptions (EDITC_OPTIONS *options)
 Initialize EDITC_OPTIONS structure.
 
void SetInvertToEditCOptions (EDITC_OPTIONS *options, int invert)
 Enable background inversion.
 
void SetFontToEditCOptions (EDITC_OPTIONS *options, int font)
 Change text font.
 
void SetTextAttrToEditCOptions (EDITC_OPTIONS *options, int flags)
 Set text attributes.
 
void SetAlignToEditCOptions (EDITC_OPTIONS *options, int flags)
 Set text attributes.
 
void SetPenColorToEditCOptions (EDITC_OPTIONS *options, int pen)
 Set text color.
 
void SetBrushColorToEditCOptions (EDITC_OPTIONS *options, int brush)
 Set background color.
 
Menu
int CreateMenu (int style, int zero, const MENU_DESC *menu, const HEADER_DESC *header, int selected_item, int items_count, void *user_pointer, int *to_remove)
 Create menu (list with items).
 
int CreateMultiLinesMenu (int style, int zero, const ML_MENU_DESC *menu, const HEADER_DESC *header, int selected_item, int items_count)
 Create menu with multiline items (list with items).
 
int GetCurMenuItem (void *gui)
 Get index of the selected item in menu.
 
void SetMenuItemIcon (void *gui, int item_n, int icon)
 Set icon for a menu item.
 
void SetMenuItemIconIMGHDR (void *gui, void *item, IMGHDR *icon)
 Add icon to the list item (IMGHDR).
 
void * AllocMenuItem (void *gui)
 Dynamic allocation of the menu item.
 
void * AllocMLMenuItem (void *gui)
 Dynamic allocation of the menu item.
 
WSHDR * AllocMenuWS (void *gui, int len)
 Allocate WSHDR for using it in SetMenuItemText.
 
void SetMenuItemIconArray (void *gui, void *item, const int *icons)
 Set the icon array used by the menu.
 
void SetMenuItemText (void *gui, void *item, WSHDR *text, int item_n)
 Set text to menu item.
 
void SetMLMenuItemText (void *gui, void *item, WSHDR *text1, WSHDR *text2, int item_n)
 Set text to menu item.
 
int GetMenuItemCount (void *gui)
 Get count of items on the menu.
 
void SetMenuItemCount (void *gui, int items_count)
 Statically set items count in the menu.
 
void Menu_SetItemCountDyn (void *gui, int items_count)
 Dynamically set items count on the menu.
 
void SetCursorToMenuItem (void *gui, int item_n)
 Scroll to the given menu item.
 
void UpdateMenuCursorItem (void *gui, int item_n)
 Scroll to the given menu item and refresh the menu.
 
void SetMenuSearchCallBack (void *gui, const MenuSearchCallBack callback)
 Set callback for the searching in the menu.
 
void SetMenuSoftKey (void *gui, const SOFTKEY_DESC *softkey, int softkey_id)
 Add softkey to the menu.
 
void SetHeaderToMenu (void *gui, const HEADER_DESC *header, const void *malloc_fn)
 Set header to the GUI.
 
void * MenuGetUserPointer (void *gui)
 Get custom user pointer from menu.
 
void MenuSetUserPointer (void *gui, void *user_pointer)
 Set custom user pointer to the menu.
 
void * GetMenuGUI (const void *malloc_fn, const void *mfree_fn)
 Allocate GUI for single-line menu.
 
void * GetMultiLinesMenuGUI (const void *malloc_fn, const void *mfree_fn)
 Allocate GUI for multi-line menu.
 
void SetMenuToGUI (void *gui, const void *menu)
 Attach the menu definition to the allocated GUI (by GetMenuGUI or GetMultiLinesMenuGUI).
 
Tabs
void * GetTabGUI (void *malloc_fn, void *mfree_fn)
 Allocate GUI for tabs.
 
int SetGUIToTabGUI (void *gui, int tab_n, const int *icons, void *content_gui)
 Link content gui with tab.
 
void * GetGuiByTab (void *gui, int tab_n)
 Get GUI of the tab content.
 
int SetCursorTab (void *gui, int tab_n)
 Switch to the given tab.
 
int GetCursorTab (void *gui)
 Get index of the active tab.
 
int UpdateTab1stItem (void *gui, int unk_0)
 Update content of the active tab.
 
TextView
void * TViewGetGUI (const void *malloc_fn, const void *mfree_fn)
 Allocate GUI for TextView.
 
void TViewSetDefinition (void *gui, const TVIEW_DESC *tv)
 Attach the TextView definition to the allocated GUI.
 
void TViewSetText (void *gui, const WSHDR *text, const void *malloc_fn, const void *mfree_fn)
 Set text to the TextView.
 
void TViewSetUserPointer (void *gui, void *user_pointer)
 Set custom user pointer to the TextView.
 
void * TViewGetUserPointer (void *gui)
 Get custom user pointer from TextView.
 
RadioButtonList
int CreateRadioButtonList (const void *items, int num, const int *exclude_ids, int exclude_count, int selected_id, int(*handler)(int item_id, int key, int user1, int user2), int flags, int header_lgp, const int *header_icon, int user1, int user2)
 Create radio button list.
 
Scrollbar
WIDGET * CreateScrollbarWidget (const void *malloc_fn)
 Allocate Scrollbar WIDGET.
 
void Scrollbar_Configure (WIDGET *scrollbar, int limit, int unk1, int unk2)
 Configure the scrollbar's behavior constraints.
 
void Scrollbar_SetValue (WIDGET *scrollbar, int value)
 Set the scrollbar's current position.
 
Hacks
void * RamMenuAnywhere ()
 Key sequence buffer of the "menu anywhere" shortcut (char[4]).