From 8b615e6dda3d11a3125106a02cda0ae130ea7841 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sat, 25 Feb 2012 05:14:19 +0000 Subject: [PATCH] actually on reflection - doyoun - indicator mode should be like this. SVN revision: 68432 --- legacy/elementary/src/lib/elm_win.c | 53 ++++++++++++++++++++++++----- legacy/elementary/src/lib/elm_win.h | 34 ++++++++++++++++-- 2 files changed, 77 insertions(+), 10 deletions(-) diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index 96145d4b68..c1fc47bdb4 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -18,6 +18,7 @@ struct _Elm_Win Elm_Win_Type type; Elm_Win_Keyboard_Mode kbdmode; + Elm_Win_Indicator_Mode indmode; struct { const char *info; Ecore_Timer *timer; @@ -863,6 +864,12 @@ _elm_win_xwin_update(Elm_Win *win) } ecore_x_e_virtual_keyboard_state_set (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode); + if (win->indmode == ELM_WIN_INDICATOR_SHOW) + ecore_x_e_illume_indicator_state_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON); + else if (win->indmode == ELM_WIN_INDICATOR_HIDE) + ecore_x_e_illume_indicator_state_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF); } #endif @@ -1560,6 +1567,9 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) } while (0) #define ENGINE_COMPARE(name) (_elm_config->engine && !strcmp(_elm_config->engine, name)) + win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN; + win->indmode = ELM_WIN_INDICATOR_UNKNOWN; + switch (type) { case ELM_WIN_INLINED_IMAGE: @@ -2405,6 +2415,41 @@ elm_win_keyboard_win_get(const Evas_Object *obj) return EINA_FALSE; } +EAPI void +elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; + if (mode == win->indmode) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); +#endif + win->indmode = mode; +#ifdef HAVE_ELEMENTARY_X + if (win->xwin) + { + if (win->indmode == ELM_WIN_INDICATOR_SHOW) + ecore_x_e_illume_indicator_state_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON); + else if (win->indmode == ELM_WIN_INDICATOR_HIDE) + ecore_x_e_illume_indicator_state_set + (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF); + } +#endif +} + +EAPI Elm_Win_Indicator_Mode +elm_win_indicator_mode_get(const Evas_Object *obj) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN; + win = elm_widget_data_get(obj); + if (!win) return ELM_WIN_INDICATOR_UNKNOWN; + return win->indmode; +} + EAPI void elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y) { @@ -2673,14 +2718,6 @@ elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void * case ELM_ILLUME_COMMAND_CLOSE: ecore_x_e_illume_close_send(win->xwin); break; - case ELM_ILLUME_COMMAND_INDICATOR_SHOW: - ecore_x_e_illume_indicator_state_set - (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON); - break; - case ELM_ILLUME_COMMAND_INDICATOR_HIDE: - ecore_x_e_illume_indicator_state_set - (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF); - break; default: break; } diff --git a/legacy/elementary/src/lib/elm_win.h b/legacy/elementary/src/lib/elm_win.h index 67f948598e..a9fda4a252 100644 --- a/legacy/elementary/src/lib/elm_win.h +++ b/legacy/elementary/src/lib/elm_win.h @@ -168,6 +168,22 @@ typedef enum ELM_WIN_KEYBOARD_J2ME /**< J2ME keyboard layout */ } Elm_Win_Keyboard_Mode; +/** + * In some environments, like phones, you may have an indicator that + * shows battery status, reception, time etc. This is the indicator. + * + * Sometimes you don't want it because you provide the same functionality + * inside your app, so this will request that the indicator is hidden in + * this circumstance if you use ELM_ILLUME_INDICATOR_HIDE. The default + * is to have the indicator shown. + */ +typedef enum +{ + ELM_WIN_INDICATOR_UNKNOWN, /**< Unknown indicator state */ + ELM_WIN_INDICATOR_HIDE, /**< Hides the indicator */ + ELM_WIN_INDICATOR_SHOW /**< Shows the indicator */ +} Elm_Win_Indicator_Mode; + /** * Available commands that can be sent to the Illume manager. * @@ -180,8 +196,6 @@ typedef enum ELM_ILLUME_COMMAND_FOCUS_FORWARD, /**< Sends focus to the next window in the list */ ELM_ILLUME_COMMAND_FOCUS_HOME, /**< Hides all windows to show the Home screen */ ELM_ILLUME_COMMAND_CLOSE, /**< Closes the currently active window */ - ELM_ILLUME_COMMAND_INDICATOR_SHOW, /**< Shows the indicator */ - ELM_ILLUME_COMMAND_INDICATOR_HIDE /**< Hides the indicator */ } Elm_Illume_Command; /** @@ -875,6 +889,22 @@ EAPI void elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool */ EAPI Eina_Bool elm_win_keyboard_win_get(const Evas_Object *obj); +/** + * Sets the indicator mode of the window. + * + * @param obj The window object + * @param mode The mode to set, one of #Elm_Win_Indicator_Mode + */ +EAPI void elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode); + +/** + * Gets the indicator mode of the window. + * + * @param obj The window object + * @return The mode, one of #Elm_Win_Indicator_Mode + */ +EAPI Elm_Win_Indicator_Mode elm_win_indicator_mode_get(const Evas_Object *obj); + /** * Get the screen position of a window. *