Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Statusbar


Detailed Description

A statusbar is a horizontal bar that can display various messages, usually about the status of the program.

statusbar.png
The statusbar is usually placed at the bottom of a window, and can also have a resize-grip (see etk_statusbar_has_resize_grip_set()) which the user can use to resize the window.

The statusbar has an internal stack of messages, and always displays the message on the top of the stack.
To display a message, you need to push it on the stack with etk_statusbar_message_push(), and to hide it, you need to pop it from the stack with etk_statusbar_message_pop().

Each message is also associated to a context-id corresponding to the source of the message. A context-id can be generated from a description of the context, with etk_statusbar_context_id_get().

You can also remove a specific message from its message-id (returned by etk_statusbar_message_push()) using etk_statusbar_message_remove().

Finally, you can get the message currently displayed with etk_statusbar_message_get().

Here is a simple example showing how to use a statusbar:

 //Push a message when a menu item is selected. For example:
 etk_statusbar_message_push(statusbar, "Paste", etk_statusbar_context_id_get("Menu"));

 //Push a message to inform the user of the progress of the current operation
 etk_statusbar_message_push(statusbar, "Looking for the files...", etk_statusbar_context_id_get("Progress"));

 //Pop the message from the menu, when the menu item is unselected
 //Note: it won't change the current message of the statusbar since "Paste" is not on the top of the message-stack
 etk_statusbar_message_pop(statusbar, etk_statusbar_context_id_get("Menu"));


Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Statusbar
Properties:
  • "current-message": The message currently displayed in the statusbar
    • Type: String (char *)
    • Access: Read Only
    • Default Value: NULL
  • "has-resize-grip": Whether or not the resize-grip of the statusbar is visible
    • Type: Boolean
    • Access: Read/Write
    • Default Value: ETK_TRUE;


Data Structures

struct  Etk_Statusbar
 [Widget] A horizontal bar that can display various messages More...

Defines

#define ETK_STATUSBAR_TYPE   (etk_statusbar_type_get())
#define ETK_STATUSBAR(obj)   (ETK_OBJECT_CAST((obj), ETK_STATUSBAR_TYPE, Etk_Statusbar))
#define ETK_IS_STATUSBAR(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_STATUSBAR_TYPE))

Functions

Etk_Widget * etk_statusbar_new (void)
 Creates a new statusbar.
int etk_statusbar_context_id_get (Etk_Statusbar *statusbar, const char *context)
 Gets a context-id corresponding to the context description.
int etk_statusbar_message_push (Etk_Statusbar *statusbar, const char *message, int context_id)
 Pushs a new message on the statusbar's message-stack.
void etk_statusbar_message_pop (Etk_Statusbar *statusbar, int context_id)
 Pops from the statusbar's message-stack the first message whose context-id matchs.
void etk_statusbar_message_remove (Etk_Statusbar *statusbar, int message_id)
 Removes the message corresponding to the message-id from the statusbar.
void etk_statusbar_message_get (Etk_Statusbar *statusbar, const char **message, int *message_id, int *context_id)
 Gets the message currently displayed by the statusbar.
void etk_statusbar_has_resize_grip_set (Etk_Statusbar *statusbar, Etk_Bool has_resize_grip)
 Sets whether the statusbar has a resize-grip. The resize-grip is a small grip at the right of the statusbar that the user can use to resize the window.
Etk_Bool etk_statusbar_has_resize_grip_get (Etk_Statusbar *statusbar)
 Gets whether the statusbar has a resize-grip.


Define Documentation

#define ETK_STATUSBAR_TYPE   (etk_statusbar_type_get())

Gets the type of a status bar

#define ETK_STATUSBAR ( obj   )     (ETK_OBJECT_CAST((obj), ETK_STATUSBAR_TYPE, Etk_Statusbar))

Casts the object to an Etk_Statusbar

#define ETK_IS_STATUSBAR ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_STATUSBAR_TYPE))

Checks if the object is an Etk_Statusbar


Function Documentation

Etk_Widget * etk_statusbar_new ( void   ) 

Creates a new statusbar.

Returns:
Returns the new statusbar widget

int etk_statusbar_context_id_get ( Etk_Statusbar *  statusbar,
const char *  context 
)

Gets a context-id corresponding to the context description.

Parameters:
statusbar a statusbar
context the description of the context
Returns:
Returns the context-id corresponding to the context description, or -1 on failure

int etk_statusbar_message_push ( Etk_Statusbar *  statusbar,
const char *  message,
int  context_id 
)

Pushs a new message on the statusbar's message-stack.

Parameters:
statusbar a statusbar
message the message to push
context_id the context-id to associate to the message. You can generate a context-id with etk_statusbar_context_id_get()
Returns:
Returns the message-id of the message, or -1 on failure

void etk_statusbar_message_pop ( Etk_Statusbar *  statusbar,
int  context_id 
)

Pops from the statusbar's message-stack the first message whose context-id matchs.

Parameters:
statusbar a statusbar
context_id the context-id of the message to pop

void etk_statusbar_message_remove ( Etk_Statusbar *  statusbar,
int  message_id 
)

Removes the message corresponding to the message-id from the statusbar.

Parameters:
statusbar a statusbar
message_id the message-id of the message to remove. It has been returned when you pushed the message with etk_statusbar_push()

void etk_statusbar_message_get ( Etk_Statusbar *  statusbar,
const char **  message,
int *  message_id,
int *  context_id 
)

Gets the message currently displayed by the statusbar.

Parameters:
statusbar a statusbar
message the location where to store the message
message_id the location where to store the id of the message
context_id the location where to store the context-id of the message

void etk_statusbar_has_resize_grip_set ( Etk_Statusbar *  statusbar,
Etk_Bool  has_resize_grip 
)

Sets whether the statusbar has a resize-grip. The resize-grip is a small grip at the right of the statusbar that the user can use to resize the window.

Parameters:
statusbar a statusbar
has_resize_grip if has_resize_grip is ETK_TRUE to make the statusbar have a resize-grip

Etk_Bool etk_statusbar_has_resize_grip_get ( Etk_Statusbar *  statusbar  ) 

Gets whether the statusbar has a resize-grip.

Parameters:
statusbar a statusbar
Returns:
Returns ETK_TRUE if the statusbar has a resize-grip, ETK_FALSE otherwise