Termux:GUI C/C++ Bindings
Loading...
Searching...
No Matches
activity.h File Reference

This file contains all functions related to Activities and Tasks. More...

#include "types.h"

Go to the source code of this file.

Functions

tgui_err tgui_activity_create (tgui_connection c, tgui_activity *a, tgui_activity_type type, tgui_task *t, bool intercept)
 Creates a new Activity. More...
 
tgui_err tgui_activity_task_to_back (tgui_connection c, tgui_activity a)
 Moves to Task of the Activity to the back, making it not visible anymore. More...
 
tgui_err tgui_activity_set_theme (tgui_connection c, tgui_activity a, tgui_color status_bar_color, tgui_color primary_color, tgui_color accent_color, tgui_color window_background, tgui_color text_color)
 Sets the color palette for the Activity. The text color is only changed for Views created after this call. More...
 
tgui_err tgui_activity_set_task_description (tgui_connection c, tgui_activity a, const void *img, size_t img_size, const char *label)
 Sets the label and icon for the Task of the Activity, if the Activity is the first one in the Task. More...
 
tgui_err tgui_activity_set_pip_params (tgui_connection c, tgui_activity a, unsigned int num, unsigned int den)
 Sets the aspect ration for picture-in-picture mode. More...
 
tgui_err tgui_activity_set_pip_mode (tgui_connection c, tgui_activity a, bool pip)
 Causes an Activity to enter or leave picture-in-picture mode. More...
 
tgui_err tgui_activity_set_pip_mode_auto (tgui_connection c, tgui_activity a, bool automatic)
 Sets whether an Activity should automatically go into picture-in-picture mode when the user is leaving. More...
 
tgui_err tgui_activity_set_input_mode (tgui_connection c, tgui_activity a, tgui_activity_input_mode mode)
 Sets how the Activity reacts to the soft keyboard being shown. More...
 
tgui_err tgui_activity_set_keep_screen_on (tgui_connection c, tgui_activity a, bool keep)
 Sets whether the Activity being visible should keep the screen from turning off. More...
 
tgui_err tgui_activity_set_orientation (tgui_connection c, tgui_activity a, tgui_orientation o)
 Sets the orientation for an Activity. More...
 
tgui_err tgui_activity_set_position (tgui_connection c, tgui_activity a, unsigned int x, unsigned int y)
 Sets the position of the Activity on screen if it's an overlay. More...
 
tgui_err tgui_activity_get_configuration (tgui_connection c, tgui_activity a, tgui_activity_configuration *conf)
 Gets the current Activity configuration. More...
 
tgui_err tgui_activity_hide_soft_keyboard (tgui_connection c, tgui_activity a)
 Hides the soft keyboard. More...
 
tgui_err tgui_activity_intercept_back_button (tgui_connection c, tgui_activity a, bool intercept)
 Sets whether the user pressing the back button should finish the Activity (default action) or intercept that and send the TGUI_EVENT_BACK event instead. More...
 
tgui_err tgui_activity_intercept_volume_buttons (tgui_connection c, tgui_activity a, bool intercept_up, bool intercept_down)
 Sets whether the user pressing the volume buttons should change the volume or send an event instead. More...
 
tgui_err tgui_activity_configure_insets (tgui_connection c, tgui_activity a, tgui_inset visible, tgui_inset_behaviour behaviour)
 
tgui_err tgui_activity_set_secure (tgui_connection c, tgui_activity a, bool secure)
 Sets the secure flag for the Activity. Disables screenshots and shows a blank Activity in the task switcher if enabled. More...
 
tgui_err tgui_activity_finish (tgui_connection c, tgui_activity a)
 Finishes the Activity. More...
 
tgui_err tgui_task_to_front (tgui_connection c, tgui_task t)
 Brings the Task to the front (make it visible to the user as if they opened it). More...
 
tgui_err tgui_task_finish (tgui_connection c, tgui_task t)
 Finishes the Task, closing all Activities in it. More...
 

Detailed Description

This file contains all functions related to Activities and Tasks.

Function Documentation

◆ tgui_activity_create()

tgui_err tgui_activity_create ( tgui_connection  c,
tgui_activity a,
tgui_activity_type  type,
tgui_task t,
bool  intercept 
)

Creates a new Activity.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
Parameters
cThe connection to use.
[out]aA pointer to the Activity to be created.
typeThe type the Activity should be.
[in,out]tThe Task in which to put the Activity. Use NULL if you never need the Task. After calling it will contain the Task the Activity was created in. Use -1 as a value to create a new Task and get the new Task as a value. Overlay Activities never have a Task.
interceptWhether or not to intercept back button events. See tgui_activity_intercept_back_button for more information.
Returns
The error code.

◆ tgui_activity_task_to_back()

tgui_err tgui_activity_task_to_back ( tgui_connection  c,
tgui_activity  a 
)

Moves to Task of the Activity to the back, making it not visible anymore.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
Returns
The error code.

◆ tgui_activity_set_theme()

tgui_err tgui_activity_set_theme ( tgui_connection  c,
tgui_activity  a,
tgui_color  status_bar_color,
tgui_color  primary_color,
tgui_color  accent_color,
tgui_color  window_background,
tgui_color  text_color 
)

Sets the color palette for the Activity. The text color is only changed for Views created after this call.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
status_bar_colorThe color for the status bar.
primary_colorThe primary color.
accent_colorThe accent color.
window_backgroundThe Activity background color.
text_colorThe text color.
Returns
The error code.

◆ tgui_activity_set_task_description()

tgui_err tgui_activity_set_task_description ( tgui_connection  c,
tgui_activity  a,
const void *  img,
size_t  img_size,
const char *  label 
)

Sets the label and icon for the Task of the Activity, if the Activity is the first one in the Task.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
[in]imgThe image in PNG or JPEG format.
img_sizeThe size of the image in bytes.
[in]labelThe label for the Task.
Returns
The error code.

◆ tgui_activity_set_pip_params()

tgui_err tgui_activity_set_pip_params ( tgui_connection  c,
tgui_activity  a,
unsigned int  num,
unsigned int  den 
)

Sets the aspect ration for picture-in-picture mode.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
numNumerator of the aspect ratio.
denDenominator of the aspect ratio.
Returns
The error code.

◆ tgui_activity_set_pip_mode()

tgui_err tgui_activity_set_pip_mode ( tgui_connection  c,
tgui_activity  a,
bool  pip 
)

Causes an Activity to enter or leave picture-in-picture mode.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
pipWhether picture-in-picture mode should be enabled or disabled.
Returns
The error code.

◆ tgui_activity_set_pip_mode_auto()

tgui_err tgui_activity_set_pip_mode_auto ( tgui_connection  c,
tgui_activity  a,
bool  automatic 
)

Sets whether an Activity should automatically go into picture-in-picture mode when the user is leaving.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
automaticWhether to automatically go into picture-in-picture mode.
Returns
The error code.

◆ tgui_activity_set_input_mode()

tgui_err tgui_activity_set_input_mode ( tgui_connection  c,
tgui_activity  a,
tgui_activity_input_mode  mode 
)

Sets how the Activity reacts to the soft keyboard being shown.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
modeHow the Activity should react.
Returns
The error code.

◆ tgui_activity_set_keep_screen_on()

tgui_err tgui_activity_set_keep_screen_on ( tgui_connection  c,
tgui_activity  a,
bool  keep 
)

Sets whether the Activity being visible should keep the screen from turning off.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
keepWhether to keep the screen on or not.
Returns
The error code.

◆ tgui_activity_set_orientation()

tgui_err tgui_activity_set_orientation ( tgui_connection  c,
tgui_activity  a,
tgui_orientation  o 
)

Sets the orientation for an Activity.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
oThe new orientation.
Returns
The error code.

◆ tgui_activity_set_position()

tgui_err tgui_activity_set_position ( tgui_connection  c,
tgui_activity  a,
unsigned int  x,
unsigned int  y 
)

Sets the position of the Activity on screen if it's an overlay.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
xThe x position in pixels.
yThe y position in pixels.
Returns
The error code.

◆ tgui_activity_get_configuration()

tgui_err tgui_activity_get_configuration ( tgui_connection  c,
tgui_activity  a,
tgui_activity_configuration conf 
)

Gets the current Activity configuration.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
[out]confThe configuration is put here.
Returns
The error code.

◆ tgui_activity_hide_soft_keyboard()

tgui_err tgui_activity_hide_soft_keyboard ( tgui_connection  c,
tgui_activity  a 
)

Hides the soft keyboard.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
Returns
The error code.

◆ tgui_activity_intercept_back_button()

tgui_err tgui_activity_intercept_back_button ( tgui_connection  c,
tgui_activity  a,
bool  intercept 
)

Sets whether the user pressing the back button should finish the Activity (default action) or intercept that and send the TGUI_EVENT_BACK event instead.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
interceptWhether to intercept the back button press.
Returns
The error code.

◆ tgui_activity_intercept_volume_buttons()

tgui_err tgui_activity_intercept_volume_buttons ( tgui_connection  c,
tgui_activity  a,
bool  intercept_up,
bool  intercept_down 
)

Sets whether the user pressing the volume buttons should change the volume or send an event instead.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
intercept_upWhether to intercept the volume up press.
intercept_downWhether to intercept the volume down press.
Returns
The error code.

◆ tgui_activity_configure_insets()

tgui_err tgui_activity_configure_insets ( tgui_connection  c,
tgui_activity  a,
tgui_inset  visible,
tgui_inset_behaviour  behaviour 
)

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
visibleThe insets that should be visible.
behaviourHow the insets will behave on user input.
Returns
The error code.

◆ tgui_activity_set_secure()

tgui_err tgui_activity_set_secure ( tgui_connection  c,
tgui_activity  a,
bool  secure 
)

Sets the secure flag for the Activity. Disables screenshots and shows a blank Activity in the task switcher if enabled.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
  • TGUI_ERR_ACTIVITY_DESTROYED: The Activity was already closed.
Parameters
cThe connection to use.
aThe Activity.
secureThe secure flag setting.
Returns
The error code.

◆ tgui_activity_finish()

tgui_err tgui_activity_finish ( tgui_connection  c,
tgui_activity  a 
)

Finishes the Activity.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
Parameters
cThe connection to use.
aThe Activity.
Returns
The error code.

◆ tgui_task_to_front()

tgui_err tgui_task_to_front ( tgui_connection  c,
tgui_task  t 
)

Brings the Task to the front (make it visible to the user as if they opened it).

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
Parameters
cThe connection to use.
t
Returns
The error code.

◆ tgui_task_finish()

tgui_err tgui_task_finish ( tgui_connection  c,
tgui_task  t 
)

Finishes the Task, closing all Activities in it.

Errors

  • TGUI_ERR_MESSAGE: Protobuf I/O error.
  • TGUI_ERR_NOMEM: Not enough memory.
  • TGUI_ERR_EXCEPTION: Generic exception triggered.
Parameters
cThe connection to use.
tThe Task.
Returns
The error code.