HildonTimeEditor

HildonTimeEditor — A widget used to enter time or duration in hours, minutes, and optional seconds.

Synopsis




enum        HildonDateTimeError;
            HildonTimeEditor;
GtkWidget*  hildon_time_editor_new          (void);
void        hildon_time_editor_set_time     (HildonTimeEditor *editor,
                                             guint hours,
                                             guint minutes,
                                             guint seconds);
void        hildon_time_editor_get_time     (HildonTimeEditor *editor,
                                             guint *hours,
                                             guint *minutes,
                                             guint *seconds);
void        hildon_time_editor_set_duration_range
                                            (HildonTimeEditor *editor,
                                             guint min_seconds,
                                             guint max_seconds);
void        hildon_time_editor_get_duration_range
                                            (HildonTimeEditor *editor,
                                             guint *min_seconds,
                                             guint *max_seconds);
void        hildon_time_editor_set_ticks    (HildonTimeEditor *editor,
                                             guint ticks);
guint       hildon_time_editor_get_ticks    (HildonTimeEditor *editor);
void        hildon_time_editor_set_show_seconds
                                            (HildonTimeEditor *editor,
                                             gboolean show_seconds);
gboolean    hildon_time_editor_get_show_seconds
                                            (HildonTimeEditor *editor);
void        hildon_time_editor_set_show_hours
                                            (HildonTimeEditor *editor,
                                             gboolean show_hours);
gboolean    hildon_time_editor_get_show_hours
                                            (HildonTimeEditor *editor);
void        hildon_time_editor_set_duration_mode
                                            (HildonTimeEditor *editor,
                                             gboolean duration_mode);
gboolean    hildon_time_editor_get_duration_mode
                                            (HildonTimeEditor *editor);
void        hildon_time_editor_set_duration_min
                                            (HildonTimeEditor *editor,
                                             guint duration_min);
guint       hildon_time_editor_get_duration_min
                                            (HildonTimeEditor *editor);
void        hildon_time_editor_set_duration_max
                                            (HildonTimeEditor *editor,
                                             guint duration_max);
guint       hildon_time_editor_get_duration_max
                                            (HildonTimeEditor *editor);
void        hildon_time_editor_get_time_separators
                                            (GtkLabel *hm_sep_label,
                                             GtkLabel *ms_sep_label);

Object Hierarchy


  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----HildonTimeEditor

Implemented Interfaces

HildonTimeEditor implements GtkBuildable and AtkImplementorIface.

Properties


  "duration-max"         guint                 : Read / Write
  "duration-min"         guint                 : Read / Write
  "duration-mode"        gboolean              : Read / Write
  "show-hours"           gboolean              : Read / Write
  "show-seconds"         gboolean              : Read / Write
  "ticks"                guint                 : Read / Write

Signals


"time-error"
            gboolean    user_function      (HildonTimeEditor    *hildontimeeditor,
                                            HildonDateTimeError *arg1,
                                            gpointer             user_data)             : Run last

Description

HildonTimeEditor is used to edit time or duration. Time mode is restricted to normal 24 hour cycle, but Duration mode can select any amount of time up to 99 hours. It consists of entries for hours, minutes and seconds, and pm/am indicator as well as a button which popups a HildonTimePicker dialog.

Example 12. HildonTimePicker example


editor = hildon_time_editor_new();
hildon_time_editor_set_time (editor, h, m, s);

gtk_box_pack_start (..., editor)

hildon_time_editor_get_time (editor, &h, &m, &s);


Details

enum HildonDateTimeError

typedef enum 
{
    HILDON_DATE_TIME_ERROR_NO_ERROR = -1,
    HILDON_DATE_TIME_ERROR_MAX_HOURS,
    HILDON_DATE_TIME_ERROR_MAX_MINS,
    HILDON_DATE_TIME_ERROR_MAX_SECS,
    HILDON_DATE_TIME_ERROR_MAX_DAY,
    HILDON_DATE_TIME_ERROR_MAX_MONTH,
    HILDON_DATE_TIME_ERROR_MAX_YEAR,
    HILDON_DATE_TIME_ERROR_MIN_HOURS,
    HILDON_DATE_TIME_ERROR_MIN_MINS,
    HILDON_DATE_TIME_ERROR_MIN_SECS,
    HILDON_DATE_TIME_ERROR_MIN_DAY,
    HILDON_DATE_TIME_ERROR_MIN_MONTH,
    HILDON_DATE_TIME_ERROR_MIN_YEAR,
    HILDON_DATE_TIME_ERROR_EMPTY_HOURS,
    HILDON_DATE_TIME_ERROR_EMPTY_MINS,
    HILDON_DATE_TIME_ERROR_EMPTY_SECS,
    HILDON_DATE_TIME_ERROR_EMPTY_DAY,
    HILDON_DATE_TIME_ERROR_EMPTY_MONTH,
    HILDON_DATE_TIME_ERROR_EMPTY_YEAR,
    HILDON_DATE_TIME_ERROR_MIN_DURATION,
    HILDON_DATE_TIME_ERROR_MAX_DURATION,
    HILDON_DATE_TIME_ERROR_INVALID_CHAR,
    HILDON_DATE_TIME_ERROR_INVALID_DATE,
    HILDON_DATE_TIME_ERROR_INVALID_TIME
}                                               HildonDateTimeError;


HildonTimeEditor

typedef struct _HildonTimeEditor HildonTimeEditor;


hildon_time_editor_new ()

GtkWidget*  hildon_time_editor_new          (void);

Returns :

hildon_time_editor_set_time ()

void        hildon_time_editor_set_time     (HildonTimeEditor *editor,
                                             guint hours,
                                             guint minutes,
                                             guint seconds);

This function sets the time on an existing time editor. If the time specified by the arguments is invalid, it's fixed. The time is assumed to be in 24h format.

editor : the HildonTimeEditor widget
hours : hours
minutes : minutes
seconds : seconds

hildon_time_editor_get_time ()

void        hildon_time_editor_get_time     (HildonTimeEditor *editor,
                                             guint *hours,
                                             guint *minutes,
                                             guint *seconds);

Gets the time of the HildonTimeEditor widget. The time returned is always in 24h format.

editor : the HildonTimeEditor widget
hours : hours
minutes : minutes
seconds : seconds

hildon_time_editor_set_duration_range ()

void        hildon_time_editor_set_duration_range
                                            (HildonTimeEditor *editor,
                                             guint min_seconds,
                                             guint max_seconds);

Sets the duration editor time range of the HildonTimeEditor widget.

editor : the HildonTimeEditor widget
min_seconds : minimum allowed time in seconds
max_seconds : maximum allowed time in seconds

hildon_time_editor_get_duration_range ()

void        hildon_time_editor_get_duration_range
                                            (HildonTimeEditor *editor,
                                             guint *min_seconds,
                                             guint *max_seconds);

Gets the duration editor time range of the HildonTimeEditor widget.

editor : the HildonTimeEditor widget
min_seconds : pointer to guint
max_seconds : pointer to guint

hildon_time_editor_set_ticks ()

void        hildon_time_editor_set_ticks    (HildonTimeEditor *editor,
                                             guint ticks);

Sets the current duration in seconds. This means seconds from midnight, if not in duration mode. In case of any errors, it tries to fix it.

editor : the HildonTimeEditor widget
ticks : the duration to set, in seconds

hildon_time_editor_get_ticks ()

guint       hildon_time_editor_get_ticks    (HildonTimeEditor *editor);

This function returns the current duration, in seconds. This means seconds from midnight, if not in duration mode.

editor : the HildonTimeEditor widget
Returns : current duration in seconds

hildon_time_editor_set_show_seconds ()

void        hildon_time_editor_set_show_seconds
                                            (HildonTimeEditor *editor,
                                             gboolean show_seconds);

This function shows or hides the seconds field.

editor : the HildonTimeEditor
show_seconds : enable or disable showing of seconds

hildon_time_editor_get_show_seconds ()

gboolean    hildon_time_editor_get_show_seconds
                                            (HildonTimeEditor *editor);

This function returns a boolean indicating the visibility of seconds in the HildonTimeEditor

editor : the HildonTimeEditor widget
Returns : TRUE if the seconds are visible

hildon_time_editor_set_show_hours ()

void        hildon_time_editor_set_show_hours
                                            (HildonTimeEditor *editor,
                                             gboolean show_hours);

This function shows or hides the hours field.

editor : The HildonTimeEditor.
show_hours : Enable or disable showing of hours.

hildon_time_editor_get_show_hours ()

gboolean    hildon_time_editor_get_show_hours
                                            (HildonTimeEditor *editor);

This function returns a boolean indicating the visibility of hours in the HildonTimeEditor

editor : the HildonTimeEditor widget.
Returns : TRUE if hours are visible.

hildon_time_editor_set_duration_mode ()

void        hildon_time_editor_set_duration_mode
                                            (HildonTimeEditor *editor,
                                             gboolean duration_mode);

This function sets the duration editor mode in which the maximum hours is 99.

editor : the HildonTimeEditor
duration_mode : enable or disable duration editor mode

hildon_time_editor_get_duration_mode ()

gboolean    hildon_time_editor_get_duration_mode
                                            (HildonTimeEditor *editor);

This function returns a boolean indicating whether the HildonTimeEditor is in the duration mode.

editor : the HildonTimeEditor widget
Returns : TRUE if the HildonTimeEditor is in duration mode

hildon_time_editor_set_duration_min ()

void        hildon_time_editor_set_duration_min
                                            (HildonTimeEditor *editor,
                                             guint duration_min);

Sets the minimum allowed duration for the duration mode. Note: Has no effect in time mode

editor : the HildonTimeEditor widget
duration_min : mimimum allowed duration

hildon_time_editor_get_duration_min ()

guint       hildon_time_editor_get_duration_min
                                            (HildonTimeEditor *editor);

This function returns the smallest duration the HildonTimeEditor allows in the duration mode.

editor : the HildonTimeEditor widget
Returns : minimum allowed duration in seconds

hildon_time_editor_set_duration_max ()

void        hildon_time_editor_set_duration_max
                                            (HildonTimeEditor *editor,
                                             guint duration_max);

Sets the maximum allowed duration in seconds for the duration mode. Note: Has no effect in time mode

editor : the HildonTimeEditor widget
duration_max : maximum allowed duration in seconds

hildon_time_editor_get_duration_max ()

guint       hildon_time_editor_get_duration_max
                                            (HildonTimeEditor *editor);

This function returns the longest duration the HildonTimeEditor allows in the duration mode.

editor : the HildonTimeEditor widget
Returns : maximum allowed duration in seconds

hildon_time_editor_get_time_separators ()

void        hildon_time_editor_get_time_separators
                                            (GtkLabel *hm_sep_label,
                                             GtkLabel *ms_sep_label);

Gets hour-minute separator and minute-second separator from current locale and sets then to the labels we set as parameters. Both parameters can be NULL if you just want to assing one separator.

hm_sep_label : the label that will show the hour:minutes separator
ms_sep_label : the label that will show the minutes:seconds separator

Property Details

The "duration-max" property

  "duration-max"         guint                 : Read / Write

Largest possible duration value.

Default value: 359999


The "duration-min" property

  "duration-min"         guint                 : Read / Write

Smallest possible duration value.

Allowed values: <= 359999

Default value: 0


The "duration-mode" property

  "duration-mode"        gboolean              : Read / Write

Controls whether the TimeEditor is in duration mode.

Default value: FALSE


The "show-hours" property

  "show-hours"           gboolean              : Read / Write

Controls whether the hours field is shown in the editor.

Default value: TRUE


The "show-seconds" property

  "show-seconds"         gboolean              : Read / Write

Controls whether the seconds are shown in the editor.

Default value: FALSE


The "ticks" property

  "ticks"                guint                 : Read / Write

If editor is in duration mode, contains the duration seconds. If not, contains seconds since midnight.

Default value: 0

Signal Details

The "time-error" signal

gboolean    user_function                  (HildonTimeEditor    *hildontimeeditor,
                                            HildonDateTimeError *arg1,
                                            gpointer             user_data)             : Run last

hildontimeeditor : the object which received the signal.
arg1 :
user_data : user data set when the signal handler was connected.
Returns :

See Also

HildonTimePicker