Detailed docs, examples and explanations for the elm_theme set of funtions

SVN revision: 60603
This commit is contained in:
Iván Briano 2011-06-22 19:06:01 +00:00
parent 8ebb08abd6
commit f553e3e878
10 changed files with 8511 additions and 285 deletions

View File

@ -698,6 +698,109 @@
* @ref general_functions_example_c "here".
*/
/**
* @page theme_example_01 Theme - Using extensions
*
* @dontinclude theme_example_01.c
*
* Using extensions is extremely easy, discarding the part where you have to
* write the theme for them.
*
* In the following example we'll be creating two buttons, one to load or
* unload our extension theme and one to cycle around three possible styles,
* one of which we created.
*
* After including our one and only header we'll jump to the callback for
* the buttons. First one takes care of loading or unloading our extension
* file, relative to the default theme set (thus the @c NULL in the
* functions first parameter).
* @skipline Elementary.h
* @skip static void
* @until }
* @until }
* @until }
*
* The second button, as we said before, will just switch around different
* styles. In this case we have three of them. The first one is our custom
* style, named after something very unlikely to find in the default theme.
* The other two styles are the standard and one more, anchor, which exists
* in the default and is similar to the default, except the button vanishes
* when the mouse is not over it.
* @skip static void
* @until }
* @until }
*
* So what happens if the style switches to our custom one when the
* extension is loaded? Elementary falls back to the default for the
* widget.
*
* And the main function, simply enough, will create the window, set the
* buttons and their callbacks, and just to begin with our button styled
* we're also loading our extension at the beginning.
* @skip int
* @until ELM_MAIN
*
* In this case we wanted to easily remove extensions, but all adding an
* extension does is tell Elementary where else it should look for themes
* when it can't find them in the default theme. Another way to do this
* is to set the theme search order using elm_theme_set(), but this requires
* that the developer is careful not to override any user configuration.
* That can be helped by adding our theme to the end of whatver is already
* set, like in the following snippet.
* @code
* char buf[4096];
* snprintf(buf, sizeof(buf), "%s:./theme_example.edj", elme_theme_get(NULL);
* elm_theme_set(NULL, buf);
* @endcode
*
* If we were using overlays instead of extensions, the same thing applies,
* but the custom theme must be added to the front of the search path.
*
* In the end, we should be looking at something like this:
* @image html screenshots/theme_example_01.png
* @image latex screenhots/theme_example_01.eps
*
* That's all. Boringly simple, and the full code in one piece can be found
* @ref theme_example_01.c "here".
*
* And the code for our extension is @ref theme_example.edc "here".
*
* @example theme_example_01.c
* @example theme_example.edc
*/
/**
* @page theme_example_02 Theme - Using overlays
*
* @dontinclude theme_example_02.c
*
* Overlays are like extensions in that you tell Elementary that some other
* theme contains the styles you need for your program. The difference is that
* they will be look in first, so they can override the default style of any
* widget.
*
* There's not much to say about them that hasn't been said in our previous
* example about @ref theme_example_01 "extensions", so going quickly through
* the code we have a function to load or unload the theme, which will be
* called when we click any button.
* @skipline Elementary.h
* @skip static void
* @until }
*
* And the main function, creating the window and adding some buttons to it.
* We load our theme as an overlay and nothing else. Notice there's no style
* set for any button there, which means they should be using the default
* that we override.
* @skip int
* @until ELM_MAIN
*
* That's pretty much it. The full code is @ref theme_example_02.c "here" and
* the definition of the theme is the same as before, and can be found in
* @ref theme_example.edc "here".
*
* @example theme_example_02.c
*/
/**
* @page bg_example_01_c bg_example_01.c
* @include bg_example_01.c

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -20,6 +20,12 @@ LDADD = \
@ELEMENTARY_LIBS@ \
$(top_builddir)/src/lib/libelementary.la
EDJE_CC = @edje_cc@
EDJE_FLAGS_VERBOSE_ =
EDJE_FLAGS_VERBOSE_0 =
EDJE_FLAGS_VERBOSE_1 = -v
EDJE_FLAGS = $(EDJE_FLAGS_$(V))
SRCS = \
actionslider_example_01.c \
anchorblock_example_01.c \
@ -31,7 +37,10 @@ SRCS = \
bg_example_01.c \
bg_example_02.c \
bg_example_03.c \
general_funcs_example.c
general_funcs_example.c \
theme_example_01.c \
theme_example_02.c \
theme_example.edc
pkglib_PROGRAMS =
@ -41,6 +50,14 @@ files_DATA = $(SRCS)
endif
if EFL_BUILD_EXAMPLES
theme_example.edj: Makefile theme_example.edc
$(EDJE_CC) $(EDJE_FLAGS) \
$(top_srcdir)/src/examples/theme_example.edc \
$(top_builddir)/src/examples/theme_example.edj
clean-local:
rm -f *.edj
pkglib_PROGRAMS += \
actionslider_example_01 \
anchorblock_example_01 \
@ -52,7 +69,10 @@ pkglib_PROGRAMS += \
bg_example_01 \
bg_example_02 \
bg_example_03 \
general_funcs_example
general_funcs_example \
theme_example_01 \
theme_example_02 \
theme_example.edj
# This variable will hold the list of screenshots that will be made
# by "make screenshots". Each item in the list is of the form:
@ -62,7 +82,8 @@ SCREENSHOTS = \
bg_example_02:bg_01.png:0.0 \
animator_example_01:animator_example_01.png:0.2 \
animator_example_01:animator_example_02.png:0.5 \
animator_example_01:animator_example_03.png:0.9
animator_example_01:animator_example_03.png:0.9 \
theme_example_01:theme_example_01.png:0.0
screenshots: all
@mkdir -p $(top_srcdir)/doc/img/screenshots

View File

@ -0,0 +1,192 @@
collections {
group { name: "elm/button/base/chucknorris";
alias: "elm/button/base/default";
parts {
part { name: "border";
type: RECT;
description { state: "default" 0.0;
color: 0 0 0 255;
}
description { state: "in" 0.0;
color: 50 180 180 255;
}
}
part { name: "base";
type: RECT;
mouse_events: 1;
description { state: "default" 0.0;
rel1.to: "border";
rel1.offset: 1 1;
rel2.to: "border";
rel2.offset: -2 -2;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 230 230 230 255;
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
mouse_events: 0;
description { state: "default" 0.0;
fixed: 1 0;
visible: 0;
align: 0.0 0.5;
rel1.offset: 4 4;
rel2.offset: 3 -5;
rel2.relative: 0.0 1.0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel2.offset: 4 -5;
}
description { state: "icononly" 0.0;
inherit: "default" 0.0;
fixed: 0 0;
visible: 1;
align: 0.5 0.5;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel2.offset: -5 -5;
rel2.relative: 1.0 1.0;
}
}
part { name: "elm.text";
type: TEXT;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
visible: 0;
rel1.to_x: "elm.swallow.content";
rel1.relative: 1.0 0.0;
rel1.offset: 0 4;
rel2.offset: -5 -5;
color: 0 0 0 255;
text {
font: "Sans";
size: 10;
min: 0 0;
text_class: "button";
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
text.min: 1 1;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
}
description { state: "disabled_visible" 0.0;
inherit: "default" 0.0;
visible: 1;
text.min: 1 1;
}
}
programs {
program { name: "button_mouse_in";
signal: "mouse,in";
source: "base";
action: STATE_SET "in" 0.0;
target: "border";
}
program { name: "button_mouse_out";
signal: "mouse,out";
source: "base";
action: STATE_SET "default" 0.0;
target: "border";
}
program { name: "button_unclick";
signal: "mouse,up,1";
source: "base";
action: SIGNAL_EMIT "elm,action,click" "";
}
program { name: "button_click";
signal: "mouse,down,1";
source: "base";
}
program { name: "text_show";
signal: "elm,state,text,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.content", st, 30, vl);
if (!strcmp(st, "icononly"))
set_state(PART:"elm.swallow.content", "visible", 0.0);
set_state(PART:"elm.text", "visible", 0.0);
}
}
program { name: "text_hide";
signal: "elm,state,text,hidden";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.content", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "icononly", 0.0);
set_state(PART:"elm.text", "default", 0.0);
}
}
program { name: "icon_show";
signal: "elm,state,icon,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "visible", 0.0);
else
set_state(PART:"elm.swallow.content", "icononly", 0.0);
}
}
program { name: "icon_hide";
signal: "elm,state,icon,hidden";
source: "elm";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
}
program { name: "disable";
signal: "elm,state,disabled";
source: "elm";
action: STATE_SET "disabled" 0.0;
target: "base";
after: "disable_text";
}
program { name: "disable_text";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.text", "disabled_visible", 0.0);
else
set_state(PART:"elm.text", "disabled", 0.0);
}
}
program { name: "enable";
signal: "elm,state,enabled";
source: "elm";
action: STATE_SET "default" 0.0;
target: "base";
after: "enable_text";
}
program { name: "enable_text";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "disabled_visible"))
set_state(PART:"elm.text", "visible", 0.0);
else
set_state(PART:"elm.text", "default", 0.0);
}
}
}
}
}

View File

@ -0,0 +1,83 @@
/*
* gcc -o theme_example_01 theme_example_01.c `pkg-config --cflags --libs elementary`
*/
#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#else
# define __UNUSED__
#endif
static void
btn_extension_click_cb(void *data __UNUSED__, Evas_Object *btn, void *ev __UNUSED__)
{
const char *lbl = elm_button_label_get(btn);
if (!strncmp(lbl, "Load", 4))
{
elm_theme_extension_add(NULL, "./theme_example.edj");
elm_button_label_set(btn, "Unload extension");
}
else if (!strncmp(lbl, "Unload", 6))
{
elm_theme_extension_del(NULL, "./theme_example.edj");
elm_button_label_set(btn, "Load extension");
}
}
static void
btn_style_click_cb(void *data __UNUSED__, Evas_Object *btn, void *ev __UNUSED__)
{
const char *styles[] = {
"chucknorris",
"default",
"anchor"
};
static int sel_style = 0;
sel_style = (sel_style + 1) % 3;
elm_object_style_set(btn, styles[sel_style]);
}
int
elm_main(int argc __UNUSED__, char *argv[] __UNUSED__)
{
Evas_Object *win, *bg, *box, *btn;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
elm_theme_extension_add(NULL, "./theme_example.edj");
win = elm_win_add(NULL, "Theme example", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
evas_object_resize(win, 300, 320);
evas_object_show(win);
bg = elm_bg_add(win);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
btn = elm_button_add(win);
elm_button_label_set(btn, "Unload extension");
elm_box_pack_end(box, btn);
evas_object_show(btn);
evas_object_smart_callback_add(btn, "clicked", btn_extension_click_cb, NULL);
btn = elm_button_add(win);
elm_button_label_set(btn, "Switch style");
elm_object_style_set(btn, "chucknorris");
elm_box_pack_end(box, btn);
evas_object_show(btn);
evas_object_smart_callback_add(btn, "clicked", btn_style_click_cb, NULL);
elm_run();
return 0;
}
ELM_MAIN();

View File

@ -0,0 +1,74 @@
/*
* gcc -o theme_example_02 theme_example_02.c `pkg-config --cflags --libs elememntaru`
*/
#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#else
# define __UNUSED__
#endif
static void
_btn_clicked_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
{
static int loaded = 1;
if (loaded)
elm_theme_overlay_del(NULL, "./theme_example.edj");
else
elm_theme_overlay_add(NULL, "./theme_example.edj");
loaded = 1 - loaded;
}
int
elm_main(int argc __UNUSED__, char *argv[] __UNUSED__)
{
Evas_Object *win, *bg, *box, *btn;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
elm_theme_overlay_add(NULL, "./theme_example.edj");
win = elm_win_add(NULL, "Theme example", ELM_WIN_BASIC);
elm_win_autodel_set(win, EINA_TRUE);
evas_object_resize(win, 300, 320);
evas_object_show(win);
bg = elm_bg_add(win);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
btn = elm_button_add(win);
elm_button_label_set(btn, "Button 1");
elm_box_pack_end(box, btn);
evas_object_show(btn);
evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL);
btn = elm_button_add(win);
elm_button_label_set(btn, "Button 2");
elm_box_pack_end(box, btn);
evas_object_show(btn);
evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL);
btn = elm_button_add(win);
elm_button_label_set(btn, "Button 3");
elm_box_pack_end(box, btn);
evas_object_show(btn);
evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL);
btn = elm_button_add(win);
elm_button_label_set(btn, "Button 4");
elm_box_pack_end(box, btn);
evas_object_show(btn);
evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL);
elm_run();
return 0;
}
ELM_MAIN();

View File

@ -734,7 +734,36 @@ extern "C" {
EAPI void elm_object_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_object_mirrored_automatic_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic) EINA_ARG_NONNULL(1);
/**
* Set the style to use by a widget
*
* Sets the style name that will define the appearance of a widget. Styles
* vary from widget to widget and may also be defined by other themes
* by means of extensions and overlays.
*
* @param obj The Elementary widget to style
* @param style The style name to use
*
* @see elm_theme_extension_add()
* @see elm_theme_overlay_add()
*
* @ingroup Theme
*/
EAPI void elm_object_style_set(Evas_Object *obj, const char *style) EINA_ARG_NONNULL(1);
/**
* Get the style used by the widget
*
* This gets the style being used for that widget. Note that the string
* pointer is only valid as longas the object is valid and the style doesn't
* change.
*
* @param obj The Elementary widget to query for its style
* @return The style name used
*
* @see elm_object_style_set()
*
* @ingroup Theme
*/
EAPI const char *elm_object_style_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
@ -1104,32 +1133,350 @@ extern "C" {
/* theme */
/**
* @defgroup Theme Theme
*
* Elementary uses Edje to theme its widgets, naturally. But for the most
* part this is hidden behind a simpler interface that lets the user set
* extensions and choose the style of widgets in a much easier way.
*
* Instead of thinking in terms of paths to Edje files and their groups
* each time you want to change the appearance of a widget, Elementary
* works so you can add any theme file with extensions or replace the
* main theme at one point in the application, and then just set the style
* of widgets with elm_object_style_set() and related functions. Elementary
* will then look in its list of themes for a matching group and apply it,
* and when the theme changes midway through the application, all widgets
* will be updated accordingly.
*
* There are three concepts you need to know to understand how Elementary
* theming works: default theme, extensions and overlays.
*
* Default theme, obviously enough, is the one that provides the default
* look of all widgets. End users can change the theme used by Elementary
* by setting the @c ELM_THEME environment variable before running an
* application, or globally for all programs using the @c elementary_config
* utility. Applications can change the default theme using elm_theme_set(),
* but this can go against the user wishes, so it's not an adviced practice.
*
* Ideally, applications should find everything they need in the already
* provided theme, but there may be occasions when that's not enough and
* custom styles are required to correctly express the idea. For this
* cases, Elementary has extensions.
*
* Extensions allow the application developer to write styles of its own
* to apply to some widgets. This requires knowledge of how each widget
* is themed, as extensions will always replace the entire group used by
* the widget, so important signals and parts need to be there for the
* object to behave properly (see documentation of Edje for details).
* Once the theme for the extension is done, the application needs to add
* it to the list of themes Elementary will look into, using
* elm_theme_extension_add(), and set the style of the desired widgets as
* he would normally with elm_object_style_set().
*
* Overlays, on the other hand, can replace the look of all widgets by
* overriding the default style. Like extensions, it's up to the application
* developer to write the theme for the widgets it wants, the difference
* being that when looking for the theme, Elementary will check first the
* list of overlays, then the set theme and lastly the list of extensions,
* so with overlays it's possible to replace the default view and every
* widget will be affected. This is very much alike to setting the whole
* theme for the application and will probably clash with the end user
* options, not to mention the risk of ending up with not matching styles
* across the program. Unless there's a very special reason to use them,
* overlays should be avoided for the resons exposed before.
*
* All these theme lists are handled by ::Elm_Theme instances. Elementary
* keeps one default internally and every function that receives one of
* these can be called with NULL to refer to this default (except for
* elm_theme_free()). It's possible to create a new instance of a
* ::Elm_Theme to set other theme for a specific widget (and all of its
* children), but this is as discouraged, if not even more so, than using
* overlays. Don't use this unless you really know what you are doing.
*
* But to be less negative about things, you can look at the following
* examples:
* @li @ref theme_example_01 "Using extensions"
* @li @ref theme_example_02 "Using overlays"
*
* @{
*/
/**
* @typedef Elm_Theme
*
* Opaque handler for the list of themes Elementary looks for when
* rendering widgets.
*
* Stay out of this unless you really know what you are doing. For most
* cases, sticking to the default is all a developer needs.
*/
typedef struct _Elm_Theme Elm_Theme;
/**
* Create a new specific theme
*
* This creates an empty specific theme that only uses the default theme. A
* specific theme has its own private set of extensions and overlays too
* (which are empty by default). Specific themes do not fall back to themes
* of parent objects. They are not intended for this use. Use styles, overlays
* and extensions when needed, but avoid specific themes unless there is no
* other way (example: you want to have a preview of a new theme you are
* selecting in a "theme selector" window. The preview is inside a scroller
* and should display what the theme you selected will look like, but not
* actually apply it yet. The child of the scroller will have a specific
* theme set to show this preview before the user decides to apply it to all
* applications).
*/
EAPI Elm_Theme *elm_theme_new(void);
/**
* Free a specific theme
*
* @param th The theme to free
*
* This frees a theme created with elm_theme_new().
*/
EAPI void elm_theme_free(Elm_Theme *th);
/**
* Copy the theme fom the source to the destination theme
*
* @param th The source theme to copy from
* @param thdst The destination theme to copy data to
*
* This makes a one-time static copy of all the theme config, extensions
* and overlays from @p th to @p thdst. If @p th references a theme, then
* @p thdst is also set to reference it, with all the theme settings,
* overlays and extensions that @p th had.
*/
EAPI void elm_theme_copy(Elm_Theme *th, Elm_Theme *thdst);
/**
* Tell the source theme to reference the ref theme
*
* @param th The theme that will do the referencing
* @param thref The theme that is the reference source
*
* This clears @p th to be empty and then sets it to refer to @p thref
* so @p th acts as an override to @p thref, but where its overrides
* don't apply, it will fall through to @pthref for configuration.
*/
EAPI void elm_theme_ref_set(Elm_Theme *th, Elm_Theme *thref);
/**
* Return the theme referred to
*
* @param th The theme to get the reference from
* @return The referenced theme handle
*
* This gets the theme set as the reference theme by elm_theme_ref_set().
* If no theme is set as a reference, NULL is returned.
*/
EAPI Elm_Theme *elm_theme_ref_get(Elm_Theme *th);
/**
* Return the default theme
*
* @return The default theme handle
*
* This returns the internal default theme setup handle that all widgets
* use implicitly unless a specific theme is set. This is also often use
* as a shorthand of NULL.
*/
EAPI Elm_Theme *elm_theme_default_get(void);
/**
* Prepends a theme overlay to the list of overlays
*
* @param th The theme to add to, or if NULL, the default theme
* @param item The Edje file path to be used
*
* Use this if your application needs to provide some custom overlay theme
* (An Edje file that replaces some default styles of widgets) where adding
* new styles, or changing system theme configuration is not possible. Do
* NOT use this instead of a proper system theme configuration. Use proper
* configuration files, profiles, environment variables etc. to set a theme
* so that the theme can be altered by simple confiugration by a user. Using
* this call to achieve that effect is abusing the API and will create lots
* of trouble.
*
* @see elm_theme_extension_add()
*/
EAPI void elm_theme_overlay_add(Elm_Theme *th, const char *item);
/**
* Delete a theme overlay from the list of overlays
*
* @param th The theme to delete from, or if NULL, the default theme
* @param item The name of the theme overlay
*
* @see elm_theme_overlay_add()
*/
EAPI void elm_theme_overlay_del(Elm_Theme *th, const char *item);
/**
* Appends a theme extension to the list of extensions.
*
* @param th The theme to add to, or if NULL, the default theme
* @param item The Edje file path to be used
*
* This is intended when an application needs more styles of widgets or new
* widget themes that the default does not provide (or may not provide). The
* application has "extended" usage by coming up with new custom style names
* for widgets for specific uses, but as these are not "standard", they are
* not guaranteed to be provided by a default theme. This means the
* application is required to provide these extra elements itself in specific
* Edje files. This call adds one of those Edje files to the theme search
* path to be search after the default theme. The use of this call is
* encouraged when default styles do not meet the needs of the application.
* Use this call instead of elm_theme_overlay_add() for almost all cases.
*
* @see elm_object_style_set()
*/
EAPI void elm_theme_extension_add(Elm_Theme *th, const char *item);
/**
* Deletes a theme extension from the list of extensions.
*
* @param th The theme to delete from, or if NULL, the default theme
* @param item The name of the theme extension
*
* @see elm_theme_extension_add()
*/
EAPI void elm_theme_extension_del(Elm_Theme *th, const char *item);
/**
* Set the theme search order for the given theme
*
* @param th The theme to set the search order, or if NULL, the default theme
* @param theme Theme search string
*
* This sets the search string for the theme in path-notation from first
* theme to search, to last, delimited by the : character. Example:
*
* "shiny:/path/to/file.edj:default"
*
* See the ELM_THEME environment variable for more information.
*
* @see elm_theme_get()
* @see elm_theme_list_get()
*/
EAPI void elm_theme_set(Elm_Theme *th, const char *theme);
/**
* Return the theme search order
*
* @param th The theme to get the search order, or if NULL, the default theme
* @return The internal search order path
*
* This function returns a colon separated string of theme elements as
* returned by elm_theme_list_get().
*
* @see elm_theme_set()
* @see elm_theme_list_get()
*/
EAPI const char *elm_theme_get(Elm_Theme *th);
/**
* Return a list of theme elements to be used in a theme.
*
* @param th Theme to get the list of theme elements from.
* @return The internal list of theme elements
*
* This returns the internal list of theme elements (will only be valid as
* long as the theme is not modified by elm_theme_set() or theme is not
* freed by elm_theme_free(). This is a list of strings which must not be
* altered as they are also internal. If @p th is NULL, then the default
* theme element list is returned.
*
* A theme element can consist of a full or relative path to a .edj file,
* or a name, without extension, for a theme to be searched in the known
* theme paths for Elemementary.
*
* @see elm_theme_set()
* @see elm_theme_get()
*/
EAPI const Eina_List *elm_theme_list_get(const Elm_Theme *th);
/**
* Return the full patrh for a theme element
*
* @param f The theme element name
* @param in_search_path Pointer to a boolean to indicate if item is in the search path or not
* @return The full path to the file found.
*
* This returns a string you should free with free() on success, NULL on
* failure. This will search for the given theme element, and if it is a
* full or relative path element or a simple searchable name. The returned
* path is the full path to the file, if searched, and the file exists, or it
* is simply the full path given in the element or a resolved path if
* relative to home. The @p in_search_path boolean pointed to is set to
* EINA_TRUE if the file was a searchable file andis in the search path,
* and EINA_FALSE otherwise.
*/
EAPI char *elm_theme_list_item_path_get(const char *f, Eina_Bool *in_search_path);
/**
* Flush the current theme.
*
* @param th Theme to flush
*
* This flushes caches that let elementary know where to find theme elements
* in the given theme. If @p th is NULL, then the default theme is flushed.
* Call this function if source theme data has changed in such a way as to
* make any caches Elementary kept invalid.
*/
EAPI void elm_theme_flush(Elm_Theme *th);
/**
* This flushes all themes (default and specific ones).
*
* This will flush all themes in the current application context, by calling
* elm_theme_flush() on each of them.
*/
EAPI void elm_theme_full_flush(void);
/**
* Set the theme for all elementary using applications on the current display
*
* @param theme The name of the theme to use. Format same as the ELM_THEME
* environment variable.
*/
EAPI void elm_theme_all_set(const char *theme);
/**
* Return a list of theme elements in the theme search path
*
* @return A list of strings that are the theme element names.
*
* This lists all available theme files in the standard Elementary search path
* for theme elements, and returns them in alphabetical order as theme
* element names in a list of strings. Free this with
* elm_theme_name_available_list_free() when you are done with the list.
*/
EAPI Eina_List *elm_theme_name_available_list_new(void);
/**
* Free the list returned by elm_theme_name_available_list_new()
*
* This frees the list of themes returned by
* elm_theme_name_available_list_new(). Once freed the list should no longer
* be used. a new list mys be created.
*/
EAPI void elm_theme_name_available_list_free(Eina_List *list);
/**
* Set a specific theme to be used for this object and its children
*
* @param obj The object to set the theme on
* @param th The theme to set
*
* This sets a specific theme that will be used for the given object and any
* child objects it has. If @p th is NULL then the theme to be used is
* cleared and the object will inherit its theme from its parent (which
* ultimately will use the default theme if no specific themes are set).
*
* Use special themes with great care as this will annoy users and make
* configuration difficult. Avoid any custom themes at all if it can be
* helped.
*/
EAPI void elm_object_theme_set(Evas_Object *obj, Elm_Theme *th) EINA_ARG_NONNULL(1);
/**
* Get the specific theme to be used
*
* @param obj The object to get the specific theme from
* @return The specifc theme set.
*
* This will return a specific theme set, or NULL if no specific theme is
* set on that object. It will not return inherited themes from parents, only
* the specific theme set for that specific object. See elm_object_theme_set()
* for more information.
*/
EAPI Elm_Theme *elm_object_theme_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @}
*/
/* win */
typedef enum _Elm_Win_Type
@ -1582,6 +1929,28 @@ extern "C" {
*/
/* button */
/**
* @defgroup Button Button
*
* This is a push-button. Press it and run some function. It can contain
* a simple label and icon object and it also has an autorepeat feature.
*
* This widgets emits the following signals:
* @li "clicked": the user clicked the button (press/release).
* @li "repeated": the user pressed the button without releasing it.
* @li "unpressed": button was released after being pressed.
* In all three cases, the @c event parameter of the callback will be
* @c NULL.
*
* Also, defined in the default theme, the button has the following styles
* available:
* @li default: a normal button.
* @li anchor: Like default, but the button fades away when the mouse is not
* over it, leaving only the text or icon.
* @li hoversel_vertical: Internally used by @ref Hoversel to give a
* continuous look across its options.
* @li hoversel_vertical_entry: Another internal for @ref Hoversel.
*/
EAPI Evas_Object *elm_button_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
EAPI void elm_button_label_set(Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
EAPI const char *elm_button_label_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
@ -1594,17 +1963,6 @@ extern "C" {
EAPI double elm_button_autorepeat_initial_timeout_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_button_autorepeat_gap_timeout_set(Evas_Object *obj, double t) EINA_ARG_NONNULL(1);
EAPI double elm_button_autorepeat_gap_timeout_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/* available styles:
* default
* anchor
* hoversel_vertical
* hoversel_vertical_entry
*/
/* smart callbacks called:
* "clicked" - the user clicked the button
* "repeated" - the user pressed the button without releasing it
* "unpressed" - when the button is unpressed (released)
*/
/* fileselector */
EAPI Evas_Object *elm_fileselector_button_add(Evas_Object *parent) EINA_ARG_NONNULL(1);

View File

@ -1240,14 +1240,6 @@ elm_scale_all_set(double scale)
#endif
}
/**
* Set the style
*
* This sets the name of the style
* @param obj The object
* @param style The style name to use
* @ingroup Styles
*/
EAPI void
elm_object_style_set(Evas_Object *obj,
const char *style)
@ -1256,17 +1248,6 @@ elm_object_style_set(Evas_Object *obj,
elm_widget_style_set(obj, style);
}
/**
* Get the style
*
* This gets the style being used for that widget. Note that the string
* pointer is only valid as longas the object is valid and the style doesn't
* change.
*
* @param obj The object
* @return The style name
* @ingroup Styles
*/
EAPI const char *
elm_object_style_get(const Evas_Object *obj)
{

View File

@ -242,23 +242,6 @@ _elm_theme_shutdown(void)
_elm_theme_clear(&(theme_default));
}
/**
* Create a new specific theme
*
* This creates an empty specific theme that only uses the default theme. A
* specific theme has its own private set of extensions and overlays too
* (which are empty by default). Specific themes do not fall back to themes
* of parent objects. They are not intended for this use. Use styles, overlays
* and extensions when needed, but avoid specific themes unless there is no
* other way (example: you want to have a preview of a new theme you are
* selecting in a "theme selector" window. The preview is inside a scroller
* and should display what the theme you selected will look like, but not
* actually apply it yet. The child of the scroller will have a specific
* theme set to show this preview before the user decides to apply it to all
* applications).
*
* @ingroup Theme
*/
EAPI Elm_Theme *
elm_theme_new(void)
{
@ -270,15 +253,6 @@ elm_theme_new(void)
return th;
}
/**
* Free a specific theme
*
* @param th The theme to free
*
* This frees a theme created with elm_theme_new().
*
* @ingroup Theme
*/
EAPI void
elm_theme_free(Elm_Theme *th)
{
@ -292,17 +266,6 @@ elm_theme_free(Elm_Theme *th)
}
}
/**
* Copy the theme fom the source to the destination theme
*
* @param th The source theme to copy from
* @param thdst The destination theme to copy data to
*
* This makes a one-time static copy of all the theme config, extensions
* and overlays from @p th to @p thdst. If @p th references a theme, then
* @p thdst is also set to reference it, with all the theme settings,
* overlays and extensions that @p th had.
*/
EAPI void
elm_theme_copy(Elm_Theme *th, Elm_Theme *thdst)
{
@ -338,16 +301,6 @@ elm_theme_copy(Elm_Theme *th, Elm_Theme *thdst)
elm_theme_flush(thdst);
}
/**
* Tell the source theme to reference the ref theme
*
* @param th The theme that will do the referencing
* @param thref The theme that is the reference source
*
* This clears @p th to be empty and then sets it to refer to @p thref
* so @p th acts as an override to @p thdst, but where its overrides
* don't apply, it will fall through to @pthref for configuration.
*/
EAPI void
elm_theme_ref_set(Elm_Theme *th, Elm_Theme *thref)
{
@ -364,15 +317,6 @@ elm_theme_ref_set(Elm_Theme *th, Elm_Theme *thref)
elm_theme_flush(th);
}
/**
* Return the theme referred to
*
* @param th The theme to get the reference from
* @return The referenced theme handle
*
* This gets the theme set as the reference theme by elm_theme_ref_set().
* If no theme is set as a reference, NULL is returned.
*/
EAPI Elm_Theme *
elm_theme_ref_get(Elm_Theme *th)
{
@ -380,38 +324,12 @@ elm_theme_ref_get(Elm_Theme *th)
return th->ref_theme;
}
/**
* Return the default theme
*
* @return The default theme handle
*
* This returns the internal default theme setup handle that all widgets
* use implicitly unless a specific theme is set. This is also often use
* as a shorthand of NULL.
*/
EAPI Elm_Theme *
elm_theme_default_get(void)
{
return &theme_default;
}
/**
* Prepends a theme overlay to the list of overlays
*
* @param th The theme to add to, or if NULL, the default theme
* @param item The Edje file path to be used
*
* Use this if your application needs to provide some custom overlay theme
* (An Edje file that replaces some default styles of widgets) where adding
* new styles, or changing system theme configuration is not possible. Do
* NOT use this instead of a proper system theme configuration. Use proper
* configuration files, profiles, environment variables etc. to set a theme
* so that the theme can be altered by simple confiugration by a user. Using
* this call to achieve that effect is abusing the API and will create lots
* of trouble.
*
* @ingroup Theme
*/
EAPI void
elm_theme_overlay_add(Elm_Theme *th, const char *item)
{
@ -422,16 +340,6 @@ elm_theme_overlay_add(Elm_Theme *th, const char *item)
elm_theme_flush(th);
}
/**
* Delete a theme overlay from the list of overlays
*
* @param th The theme to delete from, or if NULL, the default theme
* @param item The name of the theme overlay
*
* See elm_theme_overlay_add().
*
* @ingroup Theme
*/
EAPI void
elm_theme_overlay_del(Elm_Theme *th, const char *item)
{
@ -451,25 +359,6 @@ elm_theme_overlay_del(Elm_Theme *th, const char *item)
elm_theme_flush(th);
}
/**
* Appends a theme extension to the list of extensions.
*
* @param th The theme to add to, or if NULL, the default theme
* @param item The Edje file path to be used
*
* This is intended when an application needs more styles of widgets or new
* widget themes that the default does not provide (or may not provide). The
* application has "extended" usage by coming up with new custom style names
* for widgets for specific uses, but as these are not "standard", they are
* not guaranteed to be provided by a default theme. This means the
* application is required to provide these extra elements itself in specific
* Edje files. This call adds one of those Edje files to the theme search
* path to be search after the default theme. The use of this call is
* encouraged when default styles do not meet the needs of the application.
* Use this call instead of elm_theme_overlay_add() for almost all cases.
*
* @ingroup Theme
*/
EAPI void
elm_theme_extension_add(Elm_Theme *th, const char *item)
{
@ -480,16 +369,6 @@ elm_theme_extension_add(Elm_Theme *th, const char *item)
elm_theme_flush(th);
}
/**
* Deletes a theme extension from the list of extensions.
*
* @param th The theme to delete from, or if NULL, the default theme
* @param item The name of the theme extension
*
* See elm_theme_extension_add().
*
* @ingroup Theme
*/
EAPI void
elm_theme_extension_del(Elm_Theme *th, const char *item)
{
@ -509,21 +388,6 @@ elm_theme_extension_del(Elm_Theme *th, const char *item)
elm_theme_flush(th);
}
/**
* Set the theme search order for the given theme
*
* @param th The theme to set the search order, or if NULL, the default theme
* @param theme Theme search string
*
* This sets the search string for the theme in path-notation from first
* theme to search, to last, delimited by the : character. Example:
*
* "shiny:/path/to/file.edj:default"
*
* See the ELM_THEME environment variable for more information.
*
* @ingroup Theme
*/
EAPI void
elm_theme_set(Elm_Theme *th, const char *theme)
{
@ -537,16 +401,6 @@ elm_theme_set(Elm_Theme *th, const char *theme)
elm_theme_flush(th);
}
/**
* Return the theme search order
*
* @param th The theme to get the search order, or if NULL, the default theme
* @return The internal search order path
*
* See elm_theme_set() for more information.
*
* @ingroup Theme
*/
EAPI const char *
elm_theme_get(Elm_Theme *th)
{
@ -576,18 +430,6 @@ elm_theme_get(Elm_Theme *th)
return th->theme;
}
/**
* Return a list of theme elements to be used in a theme.
*
* @param th Theme to get the list of theme elements from.
* @return The internal list of theme elements
*
* This returns the internal list of theme elements (will only be valid as
* long as the theme is not modified by elm_theme_set() or theme is not
* freed by elm_theme_free(). This is a list of strings which must not be
* altered as they are also internal. If @p th is NULL, then the default
* theme element list is returned.
*/
EAPI const Eina_List *
elm_theme_list_get(const Elm_Theme *th)
{
@ -595,22 +437,6 @@ elm_theme_list_get(const Elm_Theme *th)
return th->themes;
}
/**
* Return the full patrh for a theme element
*
* @param f The theme element name
* @param in_search_path Pointer to a boolean to indicate if item is in the search path or not
* @return The full path to the file found.
*
* This returns a string you should free with free() on success, NULL on
* failure. This will search for the given theme element, and if it is a
* full or relative path element or a simple searchable name. The returned
* path is the full path to the file, if searched, and the file exists, or it
* is simply the full path given in the element or a resolved path if
* relative to home. The @p in_search_path boolean pointed to is set to
* EINA_TRUE if the file was a searchable file andis in the search path,
* and EINA_FALSE otherwise.
*/
EAPI char *
elm_theme_list_item_path_get(const char *f, Eina_Bool *in_search_path)
{
@ -660,18 +486,6 @@ elm_theme_list_item_path_get(const char *f, Eina_Bool *in_search_path)
return NULL;
}
/**
* Flush the current theme.
*
* @param th Theme to flush
*
* This flushes caches that let elementary know where to find theme elements
* in the given theme. If @p th is NULL, then the default theme is flushed.
* Call this call if source theme data has changed in such a way as to
* make any caches Elementary kept invalid.
*
* @ingroup Theme
*/
EAPI void
elm_theme_flush(Elm_Theme *th)
{
@ -688,14 +502,6 @@ elm_theme_flush(Elm_Theme *th)
}
}
/**
* This flushes all themes (default and specific ones).
*
* This will flush all themes in the current application context, by calling
* elm_theme_flush() on each of them.
*
* @ingroup Theme
*/
EAPI void
elm_theme_full_flush(void)
{
@ -709,14 +515,6 @@ elm_theme_full_flush(void)
elm_theme_flush(&(theme_default));
}
/**
* Set the theme for all elementary using applications on the current display
*
* @param theme The name of the theme to use. Format same as the ELM_THEME
* environment variable.
*
* @ingroup Theme
*/
EAPI void
elm_theme_all_set(const char *theme)
{
@ -730,16 +528,6 @@ elm_theme_all_set(const char *theme)
elm_theme_set(NULL, theme);
}
/**
* Return a list of theme elements in the theme search path
*
* @return A list of strings that are the theme element names.
*
* This lists all available theme files in the standard Elementary search path
* for theme elements, and returns them in alphabetical order as theme
* element names in a list of strings. Free this with
* elm_theme_name_available_list_free() when you are done with the list.
*/
EAPI Eina_List *
elm_theme_name_available_list_new(void)
{
@ -807,13 +595,6 @@ elm_theme_name_available_list_new(void)
return list;
}
/**
* Free the list returned by elm_theme_name_available_list_new()
*
* This frees the list of themes returned by
* elm_theme_name_available_list_new(). Once freed the list should no longer
* be used. a new list mys be created.
*/
EAPI void
elm_theme_name_available_list_free(Eina_List *list)
{
@ -821,23 +602,6 @@ elm_theme_name_available_list_free(Eina_List *list)
EINA_LIST_FREE(list, s) free(s);
}
/**
* Set a specific theme to be used for this object and its children
*
* @param obj The object to set the theme on
* @param th The theme to set
*
* This sets a specific theme that will be used for the given object and any
* child objects it has. If @p th is NULL then the theme to be used is
* cleared and the object will inherit its theme from its parent (which
* ultimately will use the default theme if no specific themes are set).
*
* Use special themes with great care as this will annoy users and make
* configuration difficult. Avoid any custom themes at all if it can be
* helped.
*
* @ingroup Theme
*/
EAPI void
elm_object_theme_set(Evas_Object *obj, Elm_Theme *th)
{
@ -845,19 +609,6 @@ elm_object_theme_set(Evas_Object *obj, Elm_Theme *th)
elm_widget_theme_set(obj, th);
}
/**
* Get the specific theme to be used
*
* @param obj The object to get the specific theme from
* @return The specifc theme set.
*
* This will return a specific theme set, or NULL if no specific theme is
* set on that object. It will not return inherited themes from parents, only
* the specific theme set for that specific object. See elm_object_theme_set()
* for more information.
*
* @ingroup Theme
*/
EAPI Elm_Theme *
elm_object_theme_get(const Evas_Object *obj)
{