SWILIB API (X75)    
Loading...
Searching...
No Matches
gui.h File Reference
#include "base.h"
#include "gbs.h"
#include "wstring.h"
#include "image.h"
#include "csm.h"

Go to the source code of this file.

Data Structures

struct  DRWOBJ
 Drawing object. More...
 
struct  RECT
 Rectangle region. More...
 
struct  GUI_MSG
 GUI GBS message for onKey callback. More...
 
struct  GUI_METHODS
 GUI callbacks. More...
 
struct  GUI_RAM
 GUI RAM representation. More...
 
struct  GUI
 GUI description and state. More...
 
struct  LCDLAYER
 LCD drawing layer. More...
 
struct  LCDLAYER_LIST
 LCD drawing layer container. More...
 
struct  RAP_LCDLAYER_LIST
 LCD drawing layer container (RAP). More...
 

Typedefs

typedef struct RECT RECT
 
typedef struct GUI GUI
 
typedef struct GUI WIDGET
 
typedef struct GUI_RAM GUI_RAM
 
typedef struct GUI_MSG GUI_MSG
 
typedef struct GUI_METHODS GUI_METHODS
 
typedef struct DRWOBJ DRWOBJ
 
typedef struct LCDLAYER LCDLAYER
 
typedef struct LCDLAYER_LIST LCDLAYER_LIST
 
typedef struct RAP_LCDLAYER_LIST RAP_LCDLAYER_LIST
 
typedef int(* KeybMsgHookProc) (int submsg, int msg)
 
typedef void(* GUI_TimerProc) (void *gui)
 

Enumerations

enum  ThemePeletteColorID {
  TPC_FOREGROUND = 100 ,
  TPC_BACKGROUND = 101 ,
  TPC_HEADER_FOREGROUND = 102 ,
  TPC_HEADER_BACKGROUND = 103 ,
  TPC_EXTRA_HEADER_FOREGROUND = 104 ,
  TPC_BOTTOM_FOREGROUND = 105 ,
  TPC_DISABLED_TEXT_FOREGROUND = 107 ,
  TPC_SELECT_FOREGROUND = 115 ,
  TPC_SELECT_BACKGROUND = 116 ,
  TPC_SELECT_BORDER = 117 ,
  TPC_SELECT_SHADOW = 118 ,
  TPC_UNSELECT_FOREGOUND = 119 ,
  TPC_LIGHT_TEXT_FOREGROUND = 122 ,
  TPC_LIGHT_TEXT_BACKGROUND = 123 ,
  TPC_SEPARATOR = 125 ,
  TPC_SCROLL_BAR_SLIDER = 127 ,
  TPC_SCROLL_BAR = 128 ,
  TPC_WINDOW_FOREGROUND = 129 ,
  TPC_WINDOW_BACKGROUND = 130 ,
  TPC_WINDOW_HEADER_FOREGROUND = 131 ,
  TPC_BORDER = 133 ,
  TPC_BORDER_SHADOW = 134 ,
  TPC_POPUP_SELECT_FOREGROUD = 135 ,
  TPC_POPUP_SELECT_BACKGROUD = 136 ,
  TPC_PROGRESS_BAR_BACKGROUND = 138 ,
  TPC_PROGRESS_BAR_FOREGROUND = 139 ,
  TPC_PROGRESS_BAR_BORDER = 140 ,
  TPC_CALENDAR_DAY_BACKGROUND = 145 ,
  TPC_CALENDAR_WEEKEND_BACKGROUND = 146 ,
  TPC_CALENDAR_EVENT_BACKGROUND = 147 ,
  TPC_CALENDAR_FOREGROUND = 151 ,
  TPC_EDIT_HEADER_FOREGROUND = 155 ,
  TPC_EDIT_FOREGROUND = 156
}
 Colors indexes in the .col. More...
 
enum  SystemFontID {
  FONT_LARGE = 0 ,
  FONT_LARGE_BOLD = 1 ,
  FONT_LARGE_ITALIC = 0 ,
  FONT_LARGE_ITALIC_BOLD = 1 ,
  FONT_MEDIUM = 2 ,
  FONT_MEDIUM_BOLD = 3 ,
  FONT_MEDIUM_ITALIC = 2 ,
  FONT_MEDIUM_ITALIC_BOLD = 3 ,
  FONT_NUMERIC_SMALL = 4 ,
  FONT_NUMERIC_SMALL_BOLD = 5 ,
  FONT_NUMERIC_XSMALL = 6 ,
  FONT_SMALL = 7 ,
  FONT_SMALL_BOLD = 8 ,
  FONT_SMALL_ITALIC = 7 ,
  FONT_SMALL_ITALIC_BOLD = 8 ,
  FONT_NUMERIC_LARGE = 9 ,
  FONT_NUMERIC_MEDIUM = 10
}
 Font IDs. More...
 
enum  UnicodeControlChars {
  UTF16_UNDERLINE = 0xE001 ,
  UTF16_NO_UNDERLINE = 0xE002 ,
  UTF16_BG_INVERTION = 0xE003 ,
  UTF16_BG_INVERTION2 = 0xE005 ,
  UTF16_NO_INVERTION = 0xE004 ,
  UTF16_TEXT_COLOR_RGBA = 0xE006 ,
  UTF16_BG_COLOR_RGBA = 0xE007 ,
  UTF16_TEXT_COLOR = 0xE008 ,
  UTF16_BG_COLOR = 0xE009 ,
  UTF16_FONT_RESET = 0xE010 ,
  UTF16_FONT_SMALL = 0xE012 ,
  UTF16_FONT_SMALL_BOLD = 0xE013 ,
  UTF16_FONT_MEDIUM = 0xE014 ,
  UTF16_FONT_MEDIUM_BOLD = 0xE015 ,
  UTF16_FONT_LARGE_BOLD = 0xE017 ,
  UTF16_FONT_LARGE = 0xE018 ,
  UTF16_FONT_UNK0 = 0xE011 ,
  UTF16_FONT_UNK1 = 0xE016 ,
  UTF16_FONT_UNK2 = 0xE019 ,
  UTF16_FONT_UNK3 = 0xE01A ,
  UTF16_FONT_UNK4 = 0xE01B ,
  UTF16_ALIGN_NONE = 0xE01C ,
  UTF16_ALIGN_RIGHT = 0xE01D ,
  UTF16_ALIGN_LEFT = 0xE01E ,
  UTF16_ALIGN_CENTER = 0xE01F
}
 UTF-16 control chars for DrawString, DrawScrollString and standart UI. More...
 
enum  TextAttributesFlags {
  TEXT_ALIGNLEFT = 1 ,
  TEXT_ALIGNMIDDLE = 2 ,
  TEXT_ALIGNRIGHT = 4 ,
  TEXT_UNDERLINE = 8 ,
  TEXT_INVERT = 16 ,
  TEXT_OUTLINE = 32 ,
  TEXT_PASSWORD = 64 ,
  TEXT_NOFORMAT = 128 ,
  TEXT_INVERT2 = 256
}
 Flags for the DrawString and DrawScrollString. More...
 
enum  LineDrawingFlags {
  LINE_DOTTED = 1 ,
  LINE_DOTTED2 = 2
}
 Flags for the DrawLine. More...
 
enum  RectDrawingFlags {
  RECT_DOT_OUTLINE = 1 ,
  RECT_FILL_WITH_PEN = 2 ,
  RECT_DRAW_INVERT = 4
}
 Flags for the DrawRectangle and others. More...
 
enum  DrwObjRectFillTypeID {
  DRWOBJ_RECT_FILL_TYPE_NONE = 0 ,
  DRWOBJ_RECT_FILL_TYPE_BRUSH = 1 ,
  DRWOBJ_RECT_FILL_TYPE_PEN = 2 ,
  DRWOBJ_RECT_FILL_TYPE_PATTERN = 9
}
 Types of the rectangle filling. More...
 
enum  DrwObjEllipseSectionID {
  DRWOBJ_ELLIPSE_SECTION_UPPER_RIGHT = 1 ,
  DRWOBJ_ELLIPSE_SECTION_UPPER_LEFT ,
  DRWOBJ_ELLIPSE_SECTION_LOWER_LEFT ,
  DRWOBJ_ELLIPSE_SECTION_LOWER_RIGHT
}
 Types of the ellipse sections. More...
 
enum  LcdLayerDepth {
  LCDLAYER_DEPTH_WB = 1 ,
  LCDLAYER_DEPTH_RGB332 = 2 ,
  LCDLAYER_DEPTH_BGRA4444 = 3 ,
  LCDLAYER_DEPTH_RGB565 = 4 ,
  LCDLAYER_DEPTH_ARGB8888 = 5
}
 
enum  GbsKeyEventID {
  KEY_DOWN = 0x193 ,
  KEY_UP = 0x194 ,
  LONG_PRESS = 0x195
}
 Key event types (onKey). More...
 
enum  GbsKeyCodeID {
  LEFT_SOFT = 0x01 ,
  RIGHT_SOFT = 0x04 ,
  GREEN_BUTTON = 0x0B ,
  RED_BUTTON = 0x0C ,
  VOL_UP_BUTTON = 0x14 ,
  VOL_DOWN_BUTTON = 0x15 ,
  UP_BUTTON = 0x3B ,
  DOWN_BUTTON = 0x3C ,
  LEFT_BUTTON = 0x3D ,
  RIGHT_BUTTON = 0x3E ,
  ENTER_BUTTON = 0x1A ,
  INTERNET_BUTTON = 0x11 ,
  PTT_BUTTON = 0x27
}
 Key scancodes (onKey). More...
 
enum  KeyHookReturnCode {
  KEYHOOK_NEXT = 0 ,
  KEYHOOK_NEXT_NOT2GUI = 1 ,
  KEYHOOK_BREAK = 2 ,
  KEYHOOK_ENDQ = 3
}
 Return codes for global KeyHook. More...
 
enum  CsmGuiState {
  CSM_GUI_STATE_CLOSED = 0 ,
  CSM_GUI_STATE_UNFOCUSED = 1 ,
  CSM_GUI_STATE_FOCUSED = 2
}
 GUI state. More...
 

Functions

Information functions
int ScreenW (void)
 Phone screen width.
 
int ScreenH (void)
 Phone screen height.
 
int HeaderH (void)
 Header height (iconbar).
 
int SoftkeyH (void)
 Softkeys height.
 
char * RamPressedKey ()
 Pointer to the last pressed key.
 
void * RamScreenBuffer ()
 Pointer to the current LCD buffer.
 
Color utils
char * GetPaletteAdrByColorIndex (int index)
 Get color from the phone theme.
 
void getRGBcolor (int index, void *color)
 Get color from the phone theme.
 
void getRGBbyPaletteAdr (const void *src_color, void *dst_color)
 Copy color from the theme palette.
 
void setColor (int a, int r, int g, int b, void *dst)
 Initialize color by individual values.
 
int RscMgr_CsSetColor (int id, const uint8_t *color)
 Set a color for a theme color scheme element.
 
void RscMgr_CsUpdate ()
 Update all theme colors.
 
RECT utils
void StoreXYWHtoRECT (RECT *rect, int x, int y, int w, int h)
 Initialize RECT by coordinates and size.
 
void StoreXYXYtoRECT (RECT *rect, int x, int y, int x2, int y2)
 Initialize RECT by two points.
 
General GUI functions
int IsGuiOnTop (int id)
 Check if the GUI is in focus on the screen.
 
int GetCurGuiID ()
 Get current focused GUI.
 
int CreateGUI (void *gui)
 Create new GUI.
 
int CreateGUI_ID (void *gui, int id)
 Create new GUI with specified ID.
 
int CreateGUI_30or2 (void *gui)
 Create new GUI.
 
int CreateGUIWithDummyCSM (void *gui, int flag)
 Create new GUI with dummy CSM.
 
int CreateGUIWithDummyCSM_30or2 (void *gui, int flag)
 Create new GUI with dummy CSM.
 
void GeneralFuncF1 (int cmd)
 Request closing of the focused GUI.
 
void GeneralFuncF0 (int cmd)
 Unknown function.
 
void GeneralFunc_flag1 (int id, int cmd)
 Request closing of the GUI with given ID.
 
void GeneralFunc_flag0 (int id, int cmd)
 Unknown function.
 
GUI * GetTopGUI (void)
 Get pointer to the currently focused GUI.
 
void * FindGUIbyId (int id, CSM_RAM **csm)
 Find GUI by ID.
 
void FocusGUI (int id)
 Focus GUI by ID.
 
void UnfocusGUI (void)
 Unfocus focused GUI.
 
Redrawing
void REDRAW (void)
 Request redraw of the GUI.
 
void DirectRedrawGUI (void)
 Immediate redraw the GUI.
 
void DirectRedrawGUI_ID (int id)
 Immediate redraw the GUI (by ID).
 
void PendedRedrawGUI (void)
 Request redraw of the GUI.
 
Global keyhook
void AddKeybMsgHook (KeybMsgHookProc callback)
 Add global keyhook to the beginning of the list.
 
int AddKeybMsgHook_end (KeybMsgHookProc callback)
 Add global keyhook to the end of the list.
 
void RemoveKeybMsgHook (KeybMsgHookProc callback)
 Remove global keyhook from the list.
 
Fonts
int GetFontYSIZE (int font_id)
 Get a char height in the specified font.
 
int GetSymbolWidth (int character, int font_id)
 Get a char width in the specified font.
 
int Get_WS_width (const WSHDR *text, int font_id)
 Measure string width with the specified font.
 
void Get_WS_extent (WSHDR *ws, int text_flags, int flags, int font_id, int *w, int *h)
 Get the size of a rendered string.
 
Painting
void DrawIMGHDR (int x, int y, const IMGHDR *img)
 Draw image.
 
void DrawCroppedIMGHDR (int x, int y, int offset_x, int offset_y, int w, int h, int flags, const IMGHDR *img)
 Draw cropped image.
 
void DrawImg (int x, int y, int picture)
 Draw image from the PIT table.
 
void DrawImgBW (int x, int y, int picture, const char *pen, const char *brush)
 Draw BW image from the PIT table.
 
void DrawPixel (int x, int y, const char *color)
 Draw single pixel.
 
void DrawTriangle (int x1, int y1, int x2, int y2, int x3, int y3, int flags, const char *pen, const char *brush)
 Draw a triangle polygon.
 
void DrawArc (int x1, int y1, int x2, int y2, int start_angle, int end_start, int flags, const char *pen, const char *brush)
 Draw an arc or pie.
 
void DrawLine (int x1, int y1, int x2, int y2, int flags, const char *pen)
 Draw a single line between two points.
 
void DrawRectangle (int x1, int y1, int x2, int y2, int flags, const char *pen, const char *brush)
 Draw a rectangle.
 
void DrawRoundedFrame (int x1, int y1, int x2, int y2, int x_round, int y_round, int flags, const char *pen, const char *brush)
 Draw a rounded rectangle.
 
void DrawString (WSHDR *text, int x1, int y1, int x2, int y2, int font, int text_flags, const char *pen, const char *brush)
 Draw a multi-line string.
 
void DrawScrollString (WSHDR *text, int x1, int y1, int x2, int y2, int xdisp, int font, int text_flags, const char *pen, const char *brush)
 Draw a one-line string with optional x-scrolling offset.
 
void * BuildCanvas (void)
 Build "Canvas" with IDLE Wallpaper.
 
void DrawCanvas (void *data, int x, int y, int x2, int y2, int flag_one)
 "Canvas" is a really meaning for standard UI background.
 
void DrawObject (DRWOBJ *drwobj)
 Draw DRWOBJ to the screen buffer.
 
DrwObj

Low-level drawing framework.

Use this function for constructing objects which can be drawn with DrawObject.

void DrwObj_InitRect (DRWOBJ *drwobj, const RECT *rect, int flags)
 Init DRWOBJ which draw rectangle.
 
void DrwObj_InitRectEx (DRWOBJ *drwobj, const RECT *rect, int flags, int fill_type, int fill_pattern)
 Init DRWOBJ which draw rectangle with custom filling.
 
void DrwObj_InitText (DRWOBJ *drwobj, const RECT *rect, int flags, const WSHDR *text, int font, int text_flags)
 Init DRWOBJ which draw text.
 
void DrwObj_InitImage (DRWOBJ *drwobj, const RECT *rect, int flags, const IMGHDR *img)
 Init DRWOBJ which draw image.
 
void DrwObj_InitTiledImage (DRWOBJ *drwobj, const RECT *rect, int flags, const IMGHDR *img, int offset_x, int offset_y)
 Init DRWOBJ which draw tiled image.
 
void DrwObj_InitTiledImageEx (DRWOBJ *drwobj, const RECT *rect, int flags, const EIMGHDR *img, int offset_x, int offset_y)
 Init DRWOBJ which draw tiled image (without 255x255 limit).
 
void DrwObj_SetColor (DRWOBJ *drwobj, const char *pen, const char *brush)
 Set color to the DRWOBJ.
 
void DrwObj_GetWH (DRWOBJ *drwobj, int *w, int *h)
 Get WxH of the draw object.
 
void DrwObj_Free (DRWOBJ *drwobj)
 Free draw object internal resources.
 
GUI timers
int GUI_NewTimer (void *gui)
 Create new GUI timer.
 
int GUI_DeleteTimer (void *gui, int id)
 Delete GUI timer.
 
void GUI_StartTimerProc (void *gui, int id, long timeout, GUI_TimerProc callback)
 Schedule GUI timer.
 
LCD layers
LCDLAYER * LCD_GetCurrentLayer ()
 Get an LCD layer which is associated with the current CEPID.
 
void LCD_SetDrawingRegion (int x, int y, int x2, int y2)
 Limit drawing region on current LCDLAYER (selected by current CEPID).
 
void LCD_SetBufferDepth (char depth)
 Set LCDLAYER buffer depth on current LCDLAYER (selected by current CEPID).
 
void LCDLAYER_SetBufferDepth (LCDLAYER *layer, char depth)
 Set LCDLAYER buffer depth.
 
void LCDLAYER_Redraw (LCDLAYER *layer)
 Request redrawing of the given LCDLAYER (delayed).
 
void LCDLAYER_Flush (LCDLAYER *layer)
 Do redrawing of the given LCDLAYER (immediate).
 
void DrawObject2Layer (LCDLAYER *layer, DRWOBJ *drwobj)
 Push DRWOBJ to the given LCDLAYER (with redraw!)
 
int PushDRWOBJOnLAYER (DRWOBJ *drwobj, LCDLAYER *layer)
 Push DRWOBJ to the given LCDLAYER (without redraw!)
 
LCDLAYER_LIST * RamLcdMainLayersList ()
 Pointer to the list of the LCDLAYER's (main).
 
RAP_LCDLAYER_LIST * RamLcdRapLayersList ()
 Pointer to the list of the LCDLAYER's (RAP).
 
LCDLAYER * Ram_LCD_Overlay_Layer ()
 Overlay layer of the display.
 
Deprecated
void SetPixel (int x, int y, const char *color)
 Draw single pixel.
 
void fillTriangle (int x1, int y1, int x2, int y2, int x3, int y3, int flags, const char *pen, const char *brush)
 Draw a triangle polygon.
 
void drawArc (int x1, int y1, int x2, int y2, int start_angle, int end_start, int flags, const char *pen, const char *brush)
 Draw an arc or pie.
 
void SetPropTo_Obj5 (DRWOBJ *drwobj, const RECT *rect, int flags, const IMGHDR *img)
 Init DRWOBJ which draw image.
 
void SetPropTo_Obj1 (DRWOBJ *drwobj, const RECT *rect, int flags, const WSHDR *text, int font, int text_flags)
 Init DRWOBJ which draw text.
 
void SetProp2ImageOrCanvas (DRWOBJ *drwobj, const RECT *rect, int flags, const IMGHDR *img, int offset_x, int offset_y)
 Init DRWOBJ which draw tiled image.
 
void SetPropTo_obj0x17 (DRWOBJ *drwobj, const RECT *rect, int flags, const EIMGHDR *img, int offset_x, int offset_y)
 Init DRWOBJ which draw tiled image (without 255x255 limit).
 
void SetProp2Square_v1 (DRWOBJ *drwobj, const RECT *rect, int flags, int fill_type, int fill_pattern)
 Init DRWOBJ which draw rectangle with custom filling.
 
void SetColor (DRWOBJ *drwobj, const char *pen, const char *brush)
 Set color to the DRWOBJ.
 
void Get_Obj1_WH (DRWOBJ *drwobj, int *w, int *h)
 Get WxH of the draw object.
 
void FreeDrawObject_subobj (DRWOBJ *drwobj)
 Free draw object internal resources.
 
void SetDepthBufferOnLCDLAYER (LCDLAYER *layer, char depth)
 Set LCDLAYER buffer depth.
 
LCDLAYER * GetLCDLAYERByCurCepID ()
 Get an LCD layer which is associated with the current CEPID.
 
void LCDRedrawLAYER (LCDLAYER *layer)
 Request redrawing of the given LCDLAYER (delayed).
 
void SetDrawingCanvas (int x, int y, int x2, int y2)
 Limit drawing region on current LCDLAYER (selected by current CEPID).