Log:
merge the trunk with the new_state_system branch.
For themers:
Sorry this change will break all ewl themes. I'm going to write a little
article to describe the changes from the view of a programmer, but I haven't
written it so far.
For devs:
The changes only affect internal stuff, as long as you don't use
ewl_widget_state_set(). If you are using it please replace it by
ewl_widget_custom_state_set(). To get more information about the new state
system, take a look at my blog article:
http://pfritz.wordpress.com/2009/07/01/the-new-state-system-of-ewl/
Author: pfritz
Date: 2009-07-11 07:30:47 -0700 (Sat, 11 Jul 2009)
New Revision: 41306
Modified:
trunk/ewl/data/themes/e17/e17.edc trunk/ewl/data/themes/e17/groups/border.edc trunk/ewl/data/themes/e17/groups/button.edc trunk/ewl/data/themes/e17/groups/combo.edc trunk/ewl/data/themes/e17/groups/image.edc trunk/ewl/data/themes/e17/groups/inc/button-parts-helper.edc trunk/ewl/data/themes/e17/groups/inc/button-programs-helper.edc trunk/ewl/data/themes/e17/groups/inc/focus-programs.edc trunk/ewl/data/themes/e17/groups/inc/menu-programs.edc trunk/ewl/data/themes/e17/groups/label.edc trunk/ewl/data/themes/e17/groups/notebook.edc trunk/ewl/data/themes/e17/groups/progress.edc trunk/ewl/data/themes/e17/groups/scroll.edc trunk/ewl/data/themes/e17/groups/spinner.edc trunk/ewl/data/themes/e17/groups/text.edc trunk/ewl/data/themes/e17/groups/toolbar.edc trunk/ewl/data/themes/e17/groups/tree.edc trunk/ewl/src/bin/ewl_simple_test.c trunk/ewl/src/bin/tests/config/ewl_config_unit_test.c trunk/ewl/src/engines/evas/ewl_engine_evas.c trunk/ewl/src/lib/ewl_box.c trunk/ewl/src/lib/ewl_button.c trunk/ewl/src/lib/ewl_cell.c trunk/ewl/src/lib/ewl_cell.h trunk/ewl/src/lib/ewl_check.c trunk/ewl/src/lib/ewl_combo.c trunk/ewl/src/lib/ewl_config.c trunk/ewl/src/lib/ewl_config.h trunk/ewl/src/lib/ewl_container.c trunk/ewl/src/lib/ewl_container.h trunk/ewl/src/lib/ewl_embed.c trunk/ewl/src/lib/ewl_engines.c trunk/ewl/src/lib/ewl_engines.h trunk/ewl/src/lib/ewl_entry.c trunk/ewl/src/lib/ewl_enums.h trunk/ewl/src/lib/ewl_events.h trunk/ewl/src/lib/ewl_expansion.c trunk/ewl/src/lib/ewl_filelist_view.c trunk/ewl/src/lib/ewl_freebox_mvc.c trunk/ewl/src/lib/ewl_list.c trunk/ewl/src/lib/ewl_misc.c trunk/ewl/src/lib/ewl_mvc.c trunk/ewl/src/lib/ewl_notebook.c trunk/ewl/src/lib/ewl_paned.c trunk/ewl/src/lib/ewl_progressbar.c trunk/ewl/src/lib/ewl_row.c trunk/ewl/src/lib/ewl_scrollpane.c trunk/ewl/src/lib/ewl_seeker.c trunk/ewl/src/lib/ewl_spinner.c trunk/ewl/src/lib/ewl_togglebutton.c trunk/ewl/src/lib/ewl_tree.c trunk/ewl/src/lib/ewl_widget.c trunk/ewl/src/lib/ewl_widget.h trunk/ewl/tools/ewl_config/ewl_config.c
Modified: trunk/ewl/data/themes/e17/e17.edc
===================================================================
--- trunk/ewl/data/themes/e17/e17.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/e17.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -176,6 +176,7 @@
item: "/row/group" "ewl/row";
item: "/expansion/group" "ewl/tree/expansion";
+ item: "/nonexpandable/expansion/group" "ewl/tree/nonexpansion";
/* window related groups */
item: "/tooltip/group" "ewl/window";
Modified: trunk/ewl/data/themes/e17/groups/border.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/border.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/border.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -167,20 +167,29 @@
{
program
{
- name: "disble";
+ name: "disbled";
signal: "disabled";
- source: "*";
+ source: "ewl/both";
action: STATE_SET "disabled" 0.0;
transition: LINEAR 0.0;
target: "ewl/label/text";
}
program
{
+ name: "disble";
+ signal: "disable";
+ source: "ewl/both";
+ action: STATE_SET "disabled" 0.0;
+ transition: LINEAR 0.3;
+ target: "ewl/label/text";
+ }
+ program
+ {
name: "enable";
- signal: "enabled";
- source: "*";
+ signal: "enable";
+ source: "ewl/both";
action: STATE_SET "default" 0.0;
- transition: LINEAR 0.0;
+ transition: LINEAR 0.3;
target: "ewl/label/text";
}
}
Modified: trunk/ewl/data/themes/e17/groups/button.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/button.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/button.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -104,8 +104,8 @@
program
{
name: "button,checked";
- signal: "checked";
- source: "EWL";
+ signal: "state,on";
+ source: "ewl/this";
action: STATE_SET "clicked" 0.0;
target: "button_image";
}
@@ -113,8 +113,8 @@
program
{
name: "button,unchecked";
- signal: "default";
- source: "EWL";
+ signal: "state,off";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "button_image";
}
@@ -123,7 +123,7 @@
{
name: "button,click";
signal: "mouse,down,1";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "clicked" 0.0;
target: "button_image";
}
@@ -132,7 +132,7 @@
{
name: "button,unclick";
signal: "mouse,up,1";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "button_image";
}
@@ -140,19 +140,28 @@
program
{
name: "disable";
+ signal: "disable";
+ source: "ewl/*";
+ action: STATE_SET "disabled" 0.0;
+ target: "button_image";
+ target: "button_image2";
+ target: "focus";
+ }
+ program
+ {
+ name: "disabled";
signal: "disabled";
- source: "EWL";
+ source: "ewl/*";
action: STATE_SET "disabled" 0.0;
target: "button_image";
target: "button_image2";
target: "focus";
}
-
program
{
name: "enable";
- signal: "enabled";
- source: "EWL";
+ signal: "enable";
+ source: "ewl/*";
action: STATE_SET "default" 0.0;
target: "button_image";
target: "button_image2";
@@ -162,7 +171,7 @@
{
name: "button,in";
signal: "mouse,in";
- source: "EWL";
+ source: "ewl/this";
script
{
run_program(PROGRAM:"go_active");
@@ -337,6 +346,13 @@
color: 0 0 0 255;
color3: 255 255 255 32;
}
+ description
+ {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 72 72 72 255;
+ }
+
}
part
{
@@ -371,5 +387,32 @@
}
}
}
+ programs
+ {
+ program
+ {
+ name: "disabled";
+ signal: "disabled";
+ source: "ewl/both";
+ action: STATE_SET "disabled" 0.0;
+ target: "ewl/label/text";
+ }
+ program
+ {
+ name: "disable";
+ signal: "disable";
+ source: "ewl/both";
+ action: STATE_SET "disabled" 0.0;
+ target: "ewl/label/text";
+ }
+ program
+ {
+ name: "enable";
+ signal: "enable";
+ source: "ewl/both";
+ action: STATE_SET "default" 0.0;
+ target: "ewl/label/text";
+ }
+ }
}
Modified: trunk/ewl/data/themes/e17/groups/combo.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/combo.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/combo.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -168,7 +168,7 @@
{
name: "button,click";
signal: "mouse,down,1";
- source: "button_image";
+ source: "ewl/this";
action: STATE_SET "clicked" 0.0;
target: "button_image";
}
@@ -177,7 +177,7 @@
{
name: "button,unclick";
signal: "mouse,up,1";
- source: "button_image";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "button_image";
}
@@ -185,8 +185,17 @@
program
{
name: "disable";
+ signal: "disable";
+ source: "ewl/both";
+ action: STATE_SET "disabled" 0.0;
+ target: "button_image";
+ }
+
+ program
+ {
+ name: "disabled";
signal: "disabled";
- source: "EWL";
+ source: "ewl/both";
action: STATE_SET "disabled" 0.0;
target: "button_image";
}
@@ -194,8 +203,8 @@
program
{
name: "enable";
- signal: "enabled";
- source: "EWL";
+ signal: "enable";
+ source: "ewl/both";
action: STATE_SET "default" 0.0;
target: "button_image";
}
@@ -203,8 +212,8 @@
program
{
name: "expand";
- signal: "expanded";
- source: "EWL";
+ signal: "state,on";
+ source: "ewl/both";
action: STATE_SET "expanded" 0.0;
target: "arrow";
}
@@ -212,11 +221,20 @@
program
{
name: "collapse";
- signal: "collapsed";
- source: "EWL";
+ signal: "state,off";
+ source: "ewl/both";
action: STATE_SET "default" 0.0;
target: "arrow";
}
+
+ program
+ {
+ name: "expanded";
+ signal: "on";
+ source: "ewl/both";
+ action: STATE_SET "default" 0.0;
+ target: "arrow";
+ }
}
}
@@ -235,14 +253,6 @@
{
state: "default" 0.0;
visible: 0;
- rel1
- {
- offset: -4 -4;
- }
- rel2
- {
- offset: 3 3;
- }
color: 245 205 109 102;
}
description
@@ -260,7 +270,7 @@
{
name: "highlight";
signal: "mouse,in";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "highlighted" 0.0;
target: "highlight";
}
@@ -268,7 +278,7 @@
{
name: "un-highlight";
signal: "mouse,out";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "highlight";
}
@@ -294,14 +304,6 @@
{
state: "default" 0.0;
visible: 0;
- rel1
- {
- offset: -4 -4;
- }
- rel2
- {
- offset: 3 3;
- }
color: 245 205 109 102;
}
description
@@ -334,7 +336,7 @@
{
name: "highlight";
signal: "mouse,in";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "highlighted" 0.0;
target: "highlight";
}
@@ -342,7 +344,7 @@
{
name: "un-highlight";
signal: "mouse,out";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "highlight";
}
Modified: trunk/ewl/data/themes/e17/groups/image.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/image.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/image.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -35,17 +35,25 @@
{
program
{
- name: "disable";
+ name: "disabled";
signal: "disabled";
- source: "EWL";
+ source: "ewl/both";
action: STATE_SET "disabled" 0.0;
target: "clip";
}
program
{
+ name: "disable";
+ signal: "disable";
+ source: "ewl/both";
+ action: STATE_SET "disabled" 0.0;
+ target: "clip";
+ }
+ program
+ {
name: "enable";
- signal: "enabled";
- source: "EWL";
+ signal: "enable";
+ source: "ewl/both";
action: STATE_SET "default" 0.0;
target: "clip";
}
Modified: trunk/ewl/data/themes/e17/groups/inc/button-parts-helper.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/inc/button-parts-helper.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/inc/button-parts-helper.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -41,7 +41,38 @@
part
{
+ name: "clip";
+ type: RECT;
+ description
+ {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+
+ rel1
+ {
+ to: "outline";
+ relative: 0.0 0.0;
+ offset: 1 1;
+ }
+ rel2
+ {
+ to: "outline";
+ relative: 1.0 1.0;
+ offset: -2 -2;
+ }
+ }
+ description
+ {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 255 255 255 76;
+ }
+}
+
+part
+{
name: "item1";
+ clip_to: "clip";
mouse_events: 0;
description
{
Modified: trunk/ewl/data/themes/e17/groups/inc/button-programs-helper.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/inc/button-programs-helper.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/inc/button-programs-helper.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -1,36 +1,57 @@
program
{
name: "turn,on";
- signal: "checked";
- source: "EWL";
+ signal: "state,on";
+ source: "ewl/this";
action: STATE_SET "active" 0.0;
target: "item1";
}
program
{
+ name: "on";
+ signal: "on";
+ source: "ewl/this";
+ action: STATE_SET "active" 0.0;
+ target: "item1";
+}
+
+program
+{
name: "turn,off";
- signal: "default";
- source: "EWL";
+ signal: "state,off";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "item1";
}
program
{
- name: "disable";
+ name: "disabled";
signal: "disabled";
- source: "EWL";
+ source: "ewl/both";
action: STATE_SET "disabled" 0.0;
target: "outline";
+ target: "clip";
}
program
{
+ name: "disable";
+ signal: "disable";
+ source: "ewl/both";
+ action: STATE_SET "disabled" 0.0;
+ target: "outline";
+ target: "clip";
+}
+
+program
+{
name: "enable";
- signal: "enabled";
- source: "EWL";
+ signal: "enable";
+ source: "ewl/both";
action: STATE_SET "default" 0.0;
target: "outline";
+ target: "clip";
}
Modified: trunk/ewl/data/themes/e17/groups/inc/focus-programs.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/inc/focus-programs.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/inc/focus-programs.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -2,17 +2,26 @@
{
name: "focus,in";
signal: "focus,in";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "focused" 0.0;
transition: DECELERATE 0.2;
target: "focus";
}
+
+program
+{
+ name: "focused";
+ signal: "focused";
+ source: "ewl/this";
+ action: STATE_SET "focused" 0.0;
+ target: "focus";
+}
program
{
name: "focus,out";
signal: "focus,out";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
transition: ACCELERATE 0.5;
target: "focus";
Modified: trunk/ewl/data/themes/e17/groups/inc/menu-programs.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/inc/menu-programs.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/inc/menu-programs.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -1,8 +1,17 @@
program
{
+ name: "focused";
+ signal: "focused";
+ source: "ewl/both";
+ after: "go_active_pre";
+ after: "focus,in";
+}
+
+program
+{
name: "go_active_pre";
signal: "focus,in";
- source: "*";
+ source: "ewl/both";
action: STATE_SET "default" 0.0;
target: "title_outline";
target: "title_bar";
@@ -42,7 +51,7 @@
{
name: "go_passive_pre";
signal: "focus,out";
- source: "*";
+ source: "ewl/both";
action: STATE_SET "active" 0.0;
target: "title_outline";
target: "title_bar";
@@ -82,7 +91,7 @@
{
name: "focus,in";
action: STATE_SET "focused" 0.0;
- source: "EWL";
+ source: "ewl/both";
signal: "focus,in";
target: "focus";
transition: LINEAR 0.1;
@@ -92,7 +101,7 @@
{
name: "focus,out";
action: STATE_SET "default" 0.0;
- source: "EWL";
+ source: "ewl/both";
signal: "focus,out";
target: "focus";
transition: LINEAR 0.1;
Modified: trunk/ewl/data/themes/e17/groups/label.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/label.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/label.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -37,6 +37,12 @@
color: 0 0 0 255;
color3: 255 255 255 32;
}
+ description
+ {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: 72 72 72 255;
+ }
}
part
{
@@ -71,5 +77,32 @@
}
}
}
+ programs
+ {
+ program
+ {
+ name: "disabled";
+ signal: "disabled";
+ source: "ewl/both";
+ action: STATE_SET "disabled" 0.0;
+ target: "ewl/label/text";
+ }
+ program
+ {
+ name: "disable";
+ signal: "disable";
+ source: "ewl/both";
+ action: STATE_SET "disabled" 0.0;
+ target: "ewl/label/text";
+ }
+ program
+ {
+ name: "enable";
+ signal: "enable";
+ source: "ewl/both";
+ action: STATE_SET "default" 0.0;
+ target: "ewl/label/text";
+ }
+ }
}
Modified: trunk/ewl/data/themes/e17/groups/notebook.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/notebook.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/notebook.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -69,7 +69,7 @@
{
name: "visible";
signal: "tabs";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "outline";
}
@@ -77,7 +77,7 @@
{
name: "hidden";
signal: "notabs";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "hidden" 0.0;
target: "outline";
}
@@ -152,15 +152,23 @@
{
name: "selected";
signal: "selected";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "selected" 0.0;
target: "outline";
}
program
{
+ name: "select";
+ signal: "selection,on";
+ source: "ewl/this";
+ action: STATE_SET "selected" 0.0;
+ target: "outline";
+ }
+ program
+ {
name: "de-select";
- signal: "default";
- source: "EWL";
+ signal: "selection,off";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "outline";
}
@@ -224,15 +232,23 @@
{
name: "selected";
signal: "selected";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "selected" 0.0;
target: "outline";
}
program
{
+ name: "select";
+ signal: "selection,on";
+ source: "ewl/this";
+ action: STATE_SET "selected" 0.0;
+ target: "outline";
+ }
+ program
+ {
name: "de-select";
- signal: "default";
- source: "EWL";
+ signal: "selection,off";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "outline";
}
@@ -309,15 +325,23 @@
{
name: "selected";
signal: "selected";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "selected" 0.0;
target: "outline";
}
program
{
+ name: "select";
+ signal: "selection,on";
+ source: "ewl/this";
+ action: STATE_SET "selected" 0.0;
+ target: "outline";
+ }
+ program
+ {
name: "de-select";
- signal: "default";
- source: "EWL";
+ signal: "selection,off";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "outline";
}
@@ -382,15 +406,23 @@
{
name: "selected";
signal: "selected";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "selected" 0.0;
target: "outline";
}
program
{
+ name: "select";
+ signal: "selection,on";
+ source: "ewl/this";
+ action: STATE_SET "selected" 0.0;
+ target: "outline";
+ }
+ program
+ {
name: "de-select";
- signal: "default";
- source: "EWL";
+ signal: "selection,off";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "outline";
}
Modified: trunk/ewl/data/themes/e17/groups/progress.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/progress.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/progress.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -110,7 +110,7 @@
{
name: "unknown-start";
signal: "range-unknown";
- source: "*";
+ source: "ewl/this";
action: STATE_SET "unknown-range" 1.0;
transition: LINEAR 3.0;
after: "unknown-end";
Modified: trunk/ewl/data/themes/e17/groups/scroll.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/scroll.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/scroll.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -202,7 +202,7 @@
{
name: "drag_down";
signal: "mouse,down,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "down" 0.0;
target: "drag";
target: "drag_thumb";
@@ -211,7 +211,7 @@
{
name: "drag_up";
signal: "mouse,up,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "drag";
target: "drag_thumb";
@@ -289,7 +289,7 @@
{
name: "drag_down";
signal: "mouse,down,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "down" 0.0;
target: "drag";
}
@@ -297,7 +297,7 @@
{
name: "drag_up";
signal: "mouse,up,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "drag";
}
@@ -383,7 +383,7 @@
{
name: "drag_down";
signal: "mouse,down,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "down" 0.0;
target: "drag";
target: "drag_thumb";
@@ -392,7 +392,7 @@
{
name: "drag_up";
signal: "mouse,up,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "drag";
target: "drag_thumb";
@@ -470,7 +470,7 @@
{
name: "drag_down";
signal: "mouse,down,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "down" 0.0;
target: "drag";
}
@@ -478,7 +478,7 @@
{
name: "drag_up";
signal: "mouse,up,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "drag";
}
@@ -535,7 +535,7 @@
{
name: "mouse,down";
signal: "mouse,down,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "clicked" 0.0;
target: "button";
}
@@ -543,7 +543,7 @@
{
name: "mouse,up";
signal: "mouse,up,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "button";
}
@@ -600,7 +600,7 @@
{
name: "mouse,down";
signal: "mouse,down,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "clicked" 0.0;
target: "button";
}
@@ -608,7 +608,7 @@
{
name: "mouse,up";
signal: "mouse,up,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "button";
}
@@ -665,7 +665,7 @@
{
name: "mouse,down";
signal: "mouse,down,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "clicked" 0.0;
target: "button";
}
@@ -673,7 +673,7 @@
{
name: "mouse,up";
signal: "mouse,up,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "button";
}
@@ -730,7 +730,7 @@
{
name: "mouse,down";
signal: "mouse,down,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "clicked" 0.0;
target: "button";
}
@@ -738,7 +738,7 @@
{
name: "mouse,up";
signal: "mouse,up,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "button";
}
Modified: trunk/ewl/data/themes/e17/groups/spinner.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/spinner.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/spinner.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -56,7 +56,7 @@
{
name: "mouse,down";
signal: "mouse,down,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "clicked" 0.0;
target: "button";
}
@@ -64,7 +64,7 @@
{
name: "mouse,up";
signal: "mouse,up,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "button";
}
@@ -121,7 +121,7 @@
{
name: "mouse,down";
signal: "mouse,down,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "clicked" 0.0;
target: "button";
}
@@ -129,7 +129,7 @@
{
name: "mouse,up";
signal: "mouse,up,*";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "button";
}
Modified: trunk/ewl/data/themes/e17/groups/text.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/text.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/text.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -89,28 +89,45 @@
{
program
{
- name: "disable";
+ name: "disabled";
signal: "disabled";
- source: "*";
+ source: "ewl/both";
action: STATE_SET "disabled" 0.0;
- transition: DECELERATE 0.2;
target: "entry_disabled";
target: "entry_focus";
}
program
{
+ name: "disable";
+ signal: "disable";
+ source: "ewl/both";
+ action: STATE_SET "disabled" 0.0;
+ transition: DECELERATE 0.5;
+ target: "entry_disabled";
+ target: "entry_focus";
+ }
+ program
+ {
name: "enable";
- signal: "enabled";
- source: "*";
+ signal: "enable";
+ source: "ewl/both";
action: STATE_SET "default" 0.0;
transition: ACCELERATE 0.5;
target: "entry_disabled";
}
program
{
+ name: "focused";
+ signal: "focused";
+ source: "ewl/this";
+ action: STATE_SET "focus" 0.0;
+ target: "entry_focus";
+ }
+ program
+ {
name: "focus,in";
signal: "focus,in";
- source: "*";
+ source: "ewl/this";
action: STATE_SET "focus" 0.0;
transition: DECELERATE 0.2;
target: "entry_focus";
@@ -119,7 +136,7 @@
{
name: "focus,out";
signal: "focus,out";
- source: "*";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
transition: ACCELERATE 0.5;
target: "entry_focus";
@@ -194,7 +211,7 @@
{
name: "no-blink";
signal: "noblink";
- source, "EWL";
+ source, "ewl/this";
action: ACTION_STOP;
target: "blink-hold-on";
target: "blink-hold-off";
Modified: trunk/ewl/data/themes/e17/groups/toolbar.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/toolbar.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/toolbar.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -66,7 +66,7 @@
{
name: "highlight";
signal: "mouse,in";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "highlighted" 0.0;
target: "button_image";
transition: DECELERATE 1.0;
@@ -75,7 +75,7 @@
{
name: "un-highlight";
signal: "mouse,out";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "button_image";
transition: LINEAR 0.01;
@@ -83,8 +83,8 @@
program
{
name: "clicked";
- signal: "mouse,down,*";
- source: "EWL";
+ signal: "mouse,down,1";
+ source: "ewl/this";
action: STATE_SET "pressed" 0.0;
target: "button_image";
transition: LINEAR 0.0;
@@ -92,8 +92,8 @@
program
{
name: "release";
- signal: "mouse,up,*";
- source: "EWL";
+ signal: "mouse,up,1";
+ source: "ewl/this";
action: STATE_SET "highlighted" 0.0;
target: "button_image";
transition: LINEAR 0.01;
Modified: trunk/ewl/data/themes/e17/groups/tree.edc
===================================================================
--- trunk/ewl/data/themes/e17/groups/tree.edc 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/data/themes/e17/groups/tree.edc 2009-07-11 14:30:47 UTC (rev 41306)
@@ -79,26 +79,8 @@
{
part
{
- name: "clip";
- type: RECT;
- mouse_events: 1;
-
- description
- {
- state: "default" 0.0;
- visible: 1;
- }
- description
- {
- state: "hidden" 0.0;
- visible: 0;
- }
- }
- part
- {
name: "expansion";
mouse_events: 1;
- clip_to: "clip";
description
{
state: "default" 0.0;
@@ -124,26 +106,9 @@
{
program
{
- name: "expandable";
- signal: "expandable";
- source: "*";
- action: STATE_SET "default" 0.0;
- target: "clip";
-
- }
- program
- {
- name: "nonexpandable";
- signal: "nonexpandable";
- source: "*";
- action: STATE_SET "hidden" 0.0;
- target: "clip";
- }
- program
- {
name: "collapsed";
- signal: "default";
- source: "*";
+ signal: "state,off";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
transition: LINEAR 0.0;
target: "expansion";
@@ -151,8 +116,8 @@
program
{
name: "expand";
- signal: "checked";
- source: "*";
+ signal: "state,on";
+ source: "ewl/this";
action: STATE_SET "open" 0.0;
transition: LINEAR 0.0;
target: "expansion";
@@ -162,6 +127,12 @@
group
{
+ name: "ewl/tree/nonexpansion";
+ min: 16 16;
+}
+
+group
+{
name: "ewl/tree/header";
data
{
@@ -249,7 +220,7 @@
{
name: "ascending";
signal: "ascending";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "ascending" 0.0;
target: "arrow";
transition: LINEAR 0.0;
@@ -258,7 +229,7 @@
{
name: "descending";
signal: "descending";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "descending" 0.0;
target: "arrow";
transition: LINEAR 0.0;
@@ -267,7 +238,7 @@
{
name: "default";
signal: "default";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "arrow";
transition: LINEAR 0.0;
@@ -301,7 +272,7 @@
}
description
{
- state: "even" 0.0;
+ state: "odd" 0.0;
inherit: "default" 0.0;
color: 221 221 221 100;
}
@@ -362,26 +333,35 @@
{
program
{
- name: "odd";
+ name: "odded";
signal: "odd";
- source: "*";
- action: STATE_SET "default" 0.0;
+ source: "ewl/*";
+ action: STATE_SET "odd" 0.0;
transition: LINEAR 0.0;
target: "bg";
}
program
{
+ name: "odd";
+ signal: "odd,on";
+ source: "ewl/*";
+ action: STATE_SET "odd" 0.0;
+ transition: LINEAR 0.0;
+ target: "bg";
+ }
+ program
+ {
name: "even";
- signal: "even";
- source: "*";
- action: STATE_SET "even" 0.0;
+ signal: "odd,off";
+ source: "ewl/*";
+ action: STATE_SET "default" 0.0;
transition: LINEAR 0.0;
target: "bg";
}
program
{
name: "select";
- signal: "selected";
+ signal: "selection,on";
source: "*";
action: STATE_SET "selected" 0.0;
transition: DECELERATE 0.25;
@@ -389,8 +369,16 @@
}
program
{
+ name: "selected";
+ signal: "selected";
+ source: "*";
+ action: STATE_SET "selected" 0.0;
+ target: "selected";
+ }
+ program
+ {
name: "un-select";
- signal: "deselect";
+ signal: "selection,off";
source: "*";
action: STATE_SET "default" 0.0;
transition: ACCELERATE 0.01;
@@ -400,7 +388,7 @@
{
name: "highlight";
signal: "highlight,on";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "highlighted" 0.0;
transition: LINEAR 0.0;
target: "highlight";
@@ -409,7 +397,7 @@
{
name: "un-highlight";
signal: "highlight,off";
- source: "EWL";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
transition: LINEAR 0.0;
target: "highlight";
@@ -431,14 +419,6 @@
description
{
state: "default" 0.0;
- rel1
- {
- offset: -4 -4;
- }
- rel2
- {
- offset: 3 3;
- }
color: 245 205 109 0;
}
description
@@ -453,17 +433,26 @@
{
program
{
- name: "select";
+ name: "selected";
signal: "selected";
- source: "*";
+ source: "ewl/this";
action: STATE_SET "selected" 0.0;
target: "selected";
}
program
{
+ name: "select";
+ signal: "selection,on";
+ source: "ewl/this";
+ action: STATE_SET "selected" 0.0;
+ transition: DECELERATE 0.5;
+ target: "selected";
+ }
+ program
+ {
name: "un-select";
- signal: "deselect";
- source: "*";
+ signal: "selection,off";
+ source: "ewl/this";
action: STATE_SET "default" 0.0;
target: "selected";
}
Modified: trunk/ewl/src/bin/ewl_simple_test.c
===================================================================
--- trunk/ewl/src/bin/ewl_simple_test.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/bin/ewl_simple_test.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -91,7 +91,7 @@
void *user_data)
{
Ewl_Widget *logo = user_data;
- ewl_widget_state_set(logo, "start_tour", EWL_STATE_PERSISTENT);
+ ewl_widget_custom_state_set(logo, "start_tour", EWL_PERSISTENT);
ewl_widget_disable(w);
}
Modified: trunk/ewl/src/bin/tests/config/ewl_config_unit_test.c
===================================================================
--- trunk/ewl/src/bin/tests/config/ewl_config_unit_test.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/bin/tests/config/ewl_config_unit_test.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -55,7 +55,7 @@
conf = ewl_config_new("unit test");
- ewl_config_string_set(conf, "weather", string, EWL_STATE_TRANSIENT);
+ ewl_config_string_set(conf, "weather", string, EWL_TRANSIENT);
/* first try to get a string that cannot exist */
value = ewl_config_string_get(conf, "climate");
@@ -106,7 +106,7 @@
conf = ewl_config_new("unit test");
- ewl_config_int_set(conf, "number", number, EWL_STATE_TRANSIENT);
+ ewl_config_int_set(conf, "number", number, EWL_TRANSIENT);
/* first try to get a value that cannot exist */
value = ewl_config_int_get(conf, "letter");
@@ -147,7 +147,7 @@
conf = ewl_config_new("unit test");
- ewl_config_float_set(conf, "velocity", number, EWL_STATE_TRANSIENT);
+ ewl_config_float_set(conf, "velocity", number, EWL_TRANSIENT);
/* first try to get a value that cannot exist */
value = ewl_config_float_get(conf, "speed");
@@ -188,7 +188,7 @@
conf = ewl_config_new("unit test");
ewl_config_color_set(conf, "bg_color", 0, 100, 200, 255,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
/* first try to get a value that cannot exist */
ewl_config_color_get(conf, "fg_color", &r, &g, &b, &a);
@@ -239,7 +239,7 @@
const char *value;
ewl_config_string_set(conf, "test key", *string,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
value = ewl_config_string_get(conf, "test key");
if (strcmp(value, *string)) {
@@ -272,7 +272,7 @@
int v = RAND_RANGE(-1000, 1000);
int v_r;
- ewl_config_int_set(conf, "test key", v, EWL_STATE_TRANSIENT);
+ ewl_config_int_set(conf, "test key", v, EWL_TRANSIENT);
v_r = ewl_config_int_get(conf, "test key");
if (v_r != v) {
@@ -304,7 +304,7 @@
float v = rand();
float v_r;
- ewl_config_float_set(conf, "test key", v, EWL_STATE_TRANSIENT);
+ ewl_config_float_set(conf, "test key", v, EWL_TRANSIENT);
v_r = ewl_config_float_get(conf, "test key");
if (v_r != v) {
@@ -340,7 +340,7 @@
int r_r, g_r, b_r, a_r;
ewl_config_color_set(conf, "test key", r, g, b, a,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
ewl_config_color_get(conf, "test key", &r_r, &g_r, &b_r, &a_r);
if (r_r != r || g_r != g || b_r != b || a_r != a) {
Modified: trunk/ewl/src/engines/evas/ewl_engine_evas.c
===================================================================
--- trunk/ewl/src/engines/evas/ewl_engine_evas.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/engines/evas/ewl_engine_evas.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -35,15 +35,20 @@
static Evas_Object *ee_theme_layer_neighbor_find_below(Ewl_Widget *w, Evas_Object *clip);
static Evas_Object *ee_theme_layer_neighbor_find_above(Ewl_Widget *w, Evas_Object *clip);
static unsigned int ee_theme_element_swallow(Evas_Object *obj1, Evas_Object *obj2);
-static void ee_theme_element_state_set(Evas_Object *obj, const char *signal);
+static void ee_theme_element_state_add(Evas_Object *obj, Ewl_State state, unsigned int inherited);
+static void ee_theme_element_state_remove(Evas_Object *obj, Ewl_State state, unsigned int inherited);
+static void ee_theme_element_states_apply(Evas_Object *obj, unsigned int states,
+ unsigned int inherited);
+static void ee_theme_element_custom_state_set(Evas_Object *obj, const char *signal);
+
static void *ee_theme_image_add(Ewl_Embed *embed);
static void ee_theme_image_data_set(void *i, void *data, int w, int h,
Ewl_Colorspace cs);
static void *ee_theme_image_data_get(void *i, int *w, int *h,
Ewl_Image_Data_Mode access);
-static void *canvas_funcs[EWL_ENGINE_CANVAS_MAX] =
+static void *canvas_funcs[] =
{
NULL,
ee_canvas_output_set,
@@ -53,15 +58,17 @@
ee_canvas_damage_add
};
-static void *theme_funcs[EWL_ENGINE_THEME_MAX] =
+DSTATIC_ASSERT(EWL_ENGINE_CANVAS_MAX == ARRAY_COUNT(canvas_funcs));
+
+static void *theme_funcs[] =
{
/* the general functions */
/* FIXME: disable these calls for now. They stop ejde reloading
* the theme object correctly after it was obscured, in some
* cases. If these problems are solved, please activate them
* again. For more information see bug #3, #116 and #456*/
- NULL, //edje_freeze,
- NULL, //edje_thaw,
+ edje_freeze,
+ edje_thaw,
ee_theme_layer_stack_add,
ee_theme_layer_stack_del,
ee_theme_layer_update,
@@ -78,7 +85,10 @@
ee_theme_element_add,
edje_object_file_set,
edje_object_load_error_get,
- ee_theme_element_state_set,
+ ee_theme_element_state_add,
+ ee_theme_element_state_remove,
+ ee_theme_element_states_apply,
+ ee_theme_element_custom_state_set,
edje_object_part_text_set,
edje_object_size_min_get,
edje_object_size_min_calc,
@@ -95,6 +105,8 @@
evas_object_image_data_update_add,
};
+DSTATIC_ASSERT(EWL_ENGINE_THEME_MAX == ARRAY_COUNT(theme_funcs));
+
Ecore_DList *
ewl_engine_dependancies(void)
{
@@ -288,16 +300,146 @@
}
static void
-ee_theme_element_state_set(Evas_Object *obj, const char *signal)
+ee_theme_element_state_add(Evas_Object *obj, Ewl_State state,
+ Ewl_Engine_State_Source so)
{
+ const char *signal;
+ const char *source[] = { "ewl/this", "ewl/parent", "ewl/both" };
+
DENTER_FUNCTION(DLEVEL_STABLE);
- edje_object_signal_emit(obj, signal, "EWL");
+ switch (state)
+ {
+ case EWL_STATE_MOUSE_IN:
+ signal = "mouse,in";
+ break;
+ case EWL_STATE_MOUSE_DOWN:
+ signal = "mouse,down";
+ break;
+ case EWL_STATE_FOCUSED:
+ signal = "focus,in";
+ break;
+ case EWL_STATE_DISABLED:
+ signal = "disable";
+ break;
+ case EWL_STATE_HIGHLIGHTED:
+ signal = "highlight,on";
+ break;
+ case EWL_STATE_SELECTED:
+ signal = "selection,on";
+ break;
+ case EWL_STATE_ON:
+ signal = "state,on";
+ break;
+ case EWL_STATE_ODD:
+ signal = "odd,on";
+ break;
+ case EWL_STATE_DND:
+ signal = "dnd,in";
+ break;
+ default:
+ DRETURN(DLEVEL_STABLE);
+ break;
+ }
+ if (ewl_config_cache.print_signals)
+ printf("\tsignal: %s source: %s\n", signal, source[so]);
+
+ edje_object_signal_emit(obj, signal, source[so]);
+
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
+ee_theme_element_state_remove(Evas_Object *obj, Ewl_State state,
+ Ewl_Engine_State_Source so)
+{
+ const char *signal;
+ const char *source[] = { "ewl/this", "ewl/parent", "ewl/both" };
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ switch (state)
+ {
+ case EWL_STATE_MOUSE_IN:
+ signal = "mouse,out";
+ break;
+ case EWL_STATE_MOUSE_DOWN:
+ signal = "mouse,up";
+ break;
+ case EWL_STATE_FOCUSED:
+ signal = "focus,out";
+ break;
+ case EWL_STATE_DISABLED:
+ signal = "enable";
+ break;
+ case EWL_STATE_HIGHLIGHTED:
+ signal = "highlight,off";
+ break;
+ case EWL_STATE_SELECTED:
+ signal = "selection,off";
+ break;
+ case EWL_STATE_ON:
+ signal = "state,off";
+ break;
+ case EWL_STATE_ODD:
+ signal = "odd,off";
+ break;
+ case EWL_STATE_DND:
+ signal = "dnd,out";
+ break;
+ default:
+ DRETURN(DLEVEL_STABLE);
+ break;
+ }
+
+ if (ewl_config_cache.print_signals)
+ printf("\tsignal: %s source: %s\n", signal, source[so]);
+
+ edje_object_signal_emit(obj, signal, source[so]);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
+ee_theme_element_states_apply(Evas_Object *obj, unsigned int states,
+ Ewl_Engine_State_Source so)
+{
+ const char *source[] = { "ewl/this", "ewl/parent", "ewl/both" };
+ const char *signal[] = { "hovered", "pressed", "focused", "disabled",
+ "highlighted", "selected", "on", "odd", "dnd" };
+ unsigned int i;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ for (i = 0; i < ARRAY_COUNT(signal); i++)
+ {
+ if (states & (1 << i))
+ {
+ if (ewl_config_cache.print_signals)
+ printf("\tsignal: %s source: %s\n", signal[i],
+ source[so]);
+ edje_object_signal_emit(obj, signal[i], source[so]);
+ }
+ }
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
+ee_theme_element_custom_state_set(Evas_Object *obj, const char *signal)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (ewl_config_cache.print_signals)
+ printf("signal: %s source: %s\n", signal, "ewl/this");
+
+ edje_object_signal_emit(obj, signal, "ewl/this");
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
ee_theme_layer_stack_add(Ewl_Widget *w)
{
Evas_Object *smart_parent;
Modified: trunk/ewl/src/lib/ewl_box.c
===================================================================
--- trunk/ewl/src/lib/ewl_box.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_box.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -166,9 +166,6 @@
*/
ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
ewl_box_cb_configure, NULL);
- ewl_callback_del(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_container_cb_container_focus_out, NULL);
/*
* Check if the info structs have been created yet, if not create
Modified: trunk/ewl/src/lib/ewl_button.c
===================================================================
--- trunk/ewl/src/lib/ewl_button.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_button.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -78,10 +78,6 @@
ewl_callback_append(w, EWL_CALLBACK_KEY_DOWN,
ewl_button_cb_key_down, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
- ewl_container_cb_widget_focus_in, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_container_cb_widget_focus_out, NULL);
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Modified: trunk/ewl/src/lib/ewl_cell.c
===================================================================
--- trunk/ewl/src/lib/ewl_cell.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_cell.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -5,8 +5,6 @@
#include "ewl_private.h"
#include "ewl_debug.h"
-static void ewl_cell_cb_state_changed(Ewl_Widget *w, void *ev, void *data);
-
/**
* @return Returns a newly allocated cell on success, NULL on failure.
* @brief Allocate and initialize a new cell
@@ -157,79 +155,3 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
-/**
- * @internal
- * @param cell: The cell to work with
- * @return: Returns no value
- * @brief Adds the callback to send state changes on to the cell's children
- */
-void
-ewl_cell_state_change_cb_add(Ewl_Cell *cell)
-{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cell);
- DCHECK_TYPE(cell, EWL_CELL_TYPE);
-
- ewl_callback_append(EWL_WIDGET(cell), EWL_CALLBACK_STATE_CHANGED,
- ewl_cell_cb_state_changed, NULL);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @param cell: The cell to work with
- * @return: Returns no value
- * @brief Removes the callback to send state changes on to the cell's children
- */
-void
-ewl_cell_state_change_cb_del(Ewl_Cell *cell)
-{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(cell);
- DCHECK_TYPE(cell, EWL_CELL_TYPE);
-
- ewl_callback_del(EWL_WIDGET(cell), EWL_CALLBACK_STATE_CHANGED,
- ewl_cell_cb_state_changed);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
- * @ev: The Ewl_Event_State_Change struct
- * @data: UNUSED
- * @return Returns no value
- * @brief Sends the state on to the cell's children
- */
-void
-ewl_cell_cb_state_changed(Ewl_Widget *w, void *ev, void *data __UNUSED__)
-{
- Ewl_Widget *o;
- Ewl_Event_State_Change *e;
- const char *send_state;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev);
- DCHECK_TYPE(w, EWL_CELL_TYPE);
-
- e = EWL_EVENT_STATE_CHANGE(ev);
-
- /* Only want this for selected signals */
- if (!strcmp(e->state, "selected"))
- send_state = "parent,selected";
- else if (!strcmp(e->state, "deselect"))
- send_state = "parent,deselect";
- else if ((!strcmp(e->state, "parent,selected")) ||
- (!strcmp(e->state, "parent,deselect")))
- send_state = e->state;
- else
- DRETURN(DLEVEL_STABLE);
-
- ewl_container_child_iterate_begin(EWL_CONTAINER(w));
- while ((o = ewl_container_child_next(EWL_CONTAINER(w))))
- ewl_widget_state_set(o, send_state, e->flag);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
Modified: trunk/ewl/src/lib/ewl_cell.h
===================================================================
--- trunk/ewl/src/lib/ewl_cell.h 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_cell.h 2009-07-11 14:30:47 UTC (rev 41306)
@@ -52,8 +52,6 @@
Ewl_Widget *ewl_cell_new(void);
int ewl_cell_init(Ewl_Cell *cell);
-void ewl_cell_state_change_cb_add(Ewl_Cell *cell);
-void ewl_cell_state_change_cb_del(Ewl_Cell *cell);
/*
* Internally used callbacks, override at your own risk.
Modified: trunk/ewl/src/lib/ewl_check.c
===================================================================
--- trunk/ewl/src/lib/ewl_check.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_check.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -149,9 +149,9 @@
cb = EWL_CHECK(w);
if (cb->checked)
- ewl_widget_state_set(w, "checked", EWL_STATE_PERSISTENT);
+ ewl_widget_state_add(w, EWL_STATE_ON);
else
- ewl_widget_state_set(w, "default", EWL_STATE_PERSISTENT);
+ ewl_widget_state_remove(w, EWL_STATE_ON);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Modified: trunk/ewl/src/lib/ewl_combo.c
===================================================================
--- trunk/ewl/src/lib/ewl_combo.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_combo.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -258,10 +258,7 @@
ewl_window_raise(EWL_WINDOW(combo->popup));
ewl_widget_focus_send(EWL_WIDGET(combo->popup));
- ewl_widget_state_set(combo->button, "expanded",
- EWL_STATE_PERSISTENT);
- ewl_widget_state_set(EWL_WIDGET(combo), "expanded",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_add(EWL_WIDGET(combo), EWL_STATE_ON);
if (!ewl_mvc_dirty_get(EWL_MVC(combo)))
DRETURN(DLEVEL_STABLE);
@@ -294,9 +291,7 @@
DCHECK_TYPE(data, EWL_COMBO_TYPE);
combo = EWL_COMBO(data);
- ewl_widget_state_set(combo->button, "collapsed", EWL_STATE_PERSISTENT);
- ewl_widget_state_set(EWL_WIDGET(combo), "collapsed",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_remove(EWL_WIDGET(combo), EWL_STATE_ON);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Modified: trunk/ewl/src/lib/ewl_config.c
===================================================================
--- trunk/ewl/src/lib/ewl_config.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_config.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -51,7 +51,7 @@
static void ewl_config_create_user_hash(Ewl_Config *cfg);
static Ecore_Hash *ewl_config_set_hash_get(Ewl_Config *cfg,
- Ewl_State_Type state);
+ Ewl_Durability state);
static const char *ewl_config_get(Ewl_Config *cfg, const char *key);
static const char *ewl_config_env_get(Ewl_Config *cfg, const char *key);
static char *ewl_config_trim(char *v);
@@ -186,7 +186,7 @@
*/
void
ewl_config_string_set(Ewl_Config *cfg, const char *k, const char *v,
- Ewl_State_Type state)
+ Ewl_Durability state)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(k);
@@ -225,7 +225,7 @@
*/
void
ewl_config_int_set(Ewl_Config *cfg, const char *k, int v,
- Ewl_State_Type state)
+ Ewl_Durability state)
{
char buf[128];
@@ -273,7 +273,7 @@
*/
void
ewl_config_float_set(Ewl_Config *cfg, const char *k, float v,
- Ewl_State_Type state)
+ Ewl_Durability state)
{
char buf[128];
@@ -325,7 +325,7 @@
void
ewl_config_color_set(Ewl_Config *cfg, const char *k, int r, int g,
int b, int a,
- Ewl_State_Type state)
+ Ewl_Durability state)
{
char buf[128];
@@ -1051,14 +1051,14 @@
}
static Ecore_Hash *
-ewl_config_set_hash_get(Ewl_Config *cfg, Ewl_State_Type state)
+ewl_config_set_hash_get(Ewl_Config *cfg, Ewl_Durability state)
{
Ecore_Hash *hash = NULL;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET(cfg, NULL);
- if (state == EWL_STATE_TRANSIENT)
+ if (state == EWL_TRANSIENT)
{
ewl_config_create_instance_hash(cfg);
hash = cfg->data.instance;
Modified: trunk/ewl/src/lib/ewl_config.h
===================================================================
--- trunk/ewl/src/lib/ewl_config.h 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_config.h 2009-07-11 14:30:47 UTC (rev 41306)
@@ -37,21 +37,21 @@
void ewl_config_string_set(Ewl_Config *cfg, const char *k,
const char *v,
- Ewl_State_Type state);
+ Ewl_Durability state);
const char *ewl_config_string_get(Ewl_Config *cfg, const char *k);
void ewl_config_int_set(Ewl_Config *cfg, const char *k, int v,
- Ewl_State_Type state);
+ Ewl_Durability state);
int ewl_config_int_get(Ewl_Config *cfg, const char *k);
void ewl_config_float_set(Ewl_Config *cfg, const char *k,
float v,
- Ewl_State_Type state);
+ Ewl_Durability state);
float ewl_config_float_get(Ewl_Config *cfg, const char *k);
void ewl_config_color_set(Ewl_Config *cfg, const char *k,
int r, int g, int b, int a,
- Ewl_State_Type state);
+ Ewl_Durability state);
void ewl_config_color_get(Ewl_Config *cfg, const char *k,
int *r, int *g,
int *b, int *a);
Modified: trunk/ewl/src/lib/ewl_container.c
===================================================================
--- trunk/ewl/src/lib/ewl_container.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_container.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -84,10 +84,8 @@
ewl_container_cb_unrealize, NULL);
ewl_callback_append(w, EWL_CALLBACK_REPARENT,
ewl_container_cb_reparent, NULL);
- ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE,
- ewl_container_cb_enable, NULL);
- ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE,
- ewl_container_cb_disable, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_STATE_CHANGED,
+ ewl_container_cb_state_change, NULL);
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
@@ -1373,60 +1371,65 @@
* @param ev_data: UNUSED
* @param user_data: UNUSED
* @return Returns no value
- * @brief When enabling a container, pass the signal to the children.
+ * @brief When changing the state of a container pass it to the (internal) children
*/
void
-ewl_container_cb_enable(Ewl_Widget *w, void *ev_data __UNUSED__,
+ewl_container_cb_state_change(Ewl_Widget *w, void *ev_data,
void *user_data __UNUSED__)
{
Ewl_Widget *child;
+ Ewl_Event_State_Change *ev;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(w);
+ DCHECK_PARAM_PTR(ev_data);
DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
+ ev = ev_data;
+
if (!EWL_CONTAINER(w)->children)
DRETURN(DLEVEL_STABLE);
- /*
- * Enable all of the containers children
- */
- ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) {
- ewl_widget_enable(child);
- }
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
- * @param ev_data: UNUSED
- * @param user_data: UNUSED
- * @return Returns no value
- * @brief When enabling a container, pass the signal to the children.
- */
-void
-ewl_container_cb_disable(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- Ewl_Widget *child;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_CONTAINER_TYPE);
-
- if (!EWL_CONTAINER(w)->children)
+ if (ev->custom_state)
DRETURN(DLEVEL_STABLE);
/*
- * Disable all of the containers children
+ * we treat the disable states special here because they are also
+ * propagated to non internal children
*/
ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
- while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)) != NULL) {
- ewl_widget_disable(child);
+ if (ev->normal.state_add == EWL_STATE_DISABLED)
+ {
+ while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)))
+ ewl_widget_inherited_state_add(child,
+ EWL_STATE_DISABLED);
}
+ else if (ev->normal.state_remove == EWL_STATE_DISABLED)
+ {
+ while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)))
+ ewl_widget_inherited_state_remove(child,
+ EWL_STATE_DISABLED);
+ }
+ else if (!ev->normal.state_remove)
+ {
+ while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)))
+ {
+ if (!ewl_widget_internal_is(child))
+ continue;
+ ewl_widget_inherited_state_add(child,
+ ev->normal.state_add);
+ }
+ }
+ else
+ {
+ while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children)))
+ {
+ if (!ewl_widget_internal_is(child))
+ continue;
+ ewl_widget_inherited_state_remove(child,
+ ev->normal.state_remove);
+ }
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -1592,74 +1595,15 @@
/* If its a child or is disabled then don't send a signal */
if ((focus_in) && (!ewl_widget_parent_of(w, focus_in)) &&
(!DISABLED(w)) && (focus_in != w))
- ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
+ {
+ /* XXX is this correct? */
+ ewl_widget_state_remove(w, EWL_STATE_FOCUSED);
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
- * @internal
- * @param w: The widget to work with
- * @param: ev_data: UNUSED
- * @param user_data: UNUSED
- * @return Returns no value
- * @brief A callback to be used with end widgets such as buttons, etc
- */
-void
-ewl_container_cb_widget_focus_out(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- Ewl_Container *c;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
-
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
-
- c = EWL_CONTAINER(w);
- while (c->redirect)
- c = c->redirect;
-
- ecore_dlist_first_goto(c->children);
- while ((w = ecore_dlist_next(c->children)))
- ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
- * @param ev_data: UNUSED
- * @param user_data: UNUSED
- * @return Returns no value
- * @brief A callback to be used with end widgets
- */
-void
-ewl_container_cb_widget_focus_in(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- Ewl_Container *c;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
-
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
-
- c = EWL_CONTAINER(w);
- while (c->redirect)
- c = c->redirect;
-
- ecore_dlist_first_goto(c->children);
- while ((w = ecore_dlist_next(c->children)))
- ewl_widget_state_set(w, "focus,in", EWL_STATE_TRANSIENT);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
* @param c: The container to work with
* @return Returns no value
* @brief A convenience function to recursively show the children of a container
Modified: trunk/ewl/src/lib/ewl_container.h
===================================================================
--- trunk/ewl/src/lib/ewl_container.h 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_container.h 2009-07-11 14:30:47 UTC (rev 41306)
@@ -184,11 +184,8 @@
void ewl_container_cb_configure(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_container_cb_reparent(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_container_cb_unrealize(Ewl_Widget *w, void *ev_data, void *user_data);
-void ewl_container_cb_enable(Ewl_Widget *w, void *ev_data, void *user_data);
-void ewl_container_cb_disable(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_container_cb_state_change(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_container_cb_container_focus_out(Ewl_Widget *w, void *ev_data, void *user_data);
-void ewl_container_cb_widget_focus_out(Ewl_Widget *w, void *ev_data, void *user_data);
-void ewl_container_cb_widget_focus_in(Ewl_Widget *w, void *ev_data, void *user_data);
/**
* @}
Modified: trunk/ewl/src/lib/ewl_embed.c
===================================================================
--- trunk/ewl/src/lib/ewl_embed.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_embed.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -339,10 +339,8 @@
{
Ewl_Widget *temp;
- ewl_widget_state_remove(e->last.clicked,
- EWL_FLAG_STATE_FOCUSED);
- ewl_widget_state_remove(e->last.clicked,
- EWL_FLAG_STATE_PRESSED);
+ ewl_widget_state_remove(e->last.clicked, EWL_STATE_FOCUSED);
+ ewl_widget_state_remove(e->last.clicked, EWL_STATE_MOUSE_DOWN);
ewl_callback_call(e->last.clicked, EWL_CALLBACK_FOCUS_OUT);
@@ -351,7 +349,7 @@
while (temp) {
if (!DISABLED(temp))
ewl_widget_state_remove(temp,
- EWL_FLAG_STATE_PRESSED);
+ EWL_STATE_MOUSE_DOWN);
temp = temp->parent;
}
@@ -595,7 +593,7 @@
temp = widget;
while (temp) {
if (!DISABLED(temp)) {
- ewl_widget_state_add(temp, EWL_FLAG_STATE_PRESSED);
+ ewl_widget_state_add(temp, EWL_STATE_MOUSE_DOWN);
ewl_callback_call_with_event_data(temp,
EWL_CALLBACK_MOUSE_DOWN, &ev);
@@ -622,15 +620,13 @@
*/
if (deselect && !DESTROYED(deselect) &&
!ewl_widget_parent_of(deselect, widget)) {
- ewl_widget_state_remove(deselect,
- EWL_FLAG_STATE_FOCUSED);
+ ewl_widget_state_remove(deselect, EWL_STATE_FOCUSED);
ewl_callback_call_with_event_data(deselect,
EWL_CALLBACK_FOCUS_OUT, widget);
}
if (widget && !DISABLED(widget) && !DESTROYED(widget)) {
- ewl_widget_state_add(widget,
- EWL_FLAG_STATE_FOCUSED);
+ ewl_widget_state_add(widget, EWL_STATE_FOCUSED);
ewl_callback_call_with_event_data(widget,
EWL_CALLBACK_FOCUS_IN, deselect);
}
@@ -681,8 +677,7 @@
temp = embed->last.clicked;
while (temp) {
if (!DISABLED(temp)) {
- ewl_widget_state_remove(temp,
- EWL_FLAG_STATE_PRESSED);
+ ewl_widget_state_remove(temp, EWL_STATE_MOUSE_DOWN);
ewl_callback_call_with_event_data(temp,
EWL_CALLBACK_MOUSE_UP, &ev);
@@ -730,7 +725,7 @@
* focused widget.
*/
check = embed->last.mouse_in;
- if (!check || !ewl_widget_state_has(check, EWL_FLAG_STATE_PRESSED)) {
+ if (!check || !ewl_widget_state_has(check, EWL_STATE_MOUSE_DOWN)) {
widget = ewl_container_child_at_recursive_get(EWL_CONTAINER(embed), x, y);
if (!widget) widget = EWL_WIDGET(embed);
@@ -770,7 +765,7 @@
while (check && (widget != check)
&& !ewl_widget_parent_of(check, widget)) {
- ewl_widget_state_remove(check, EWL_FLAG_STATE_MOUSE_IN);
+ ewl_widget_state_remove(check, EWL_STATE_MOUSE_IN);
ewl_callback_call(check, EWL_CALLBACK_MOUSE_OUT);
check = check->parent;
}
@@ -787,8 +782,8 @@
/*
* First mouse move event in a widget marks it focused.
*/
- if (!(ewl_widget_state_has(check,
- EWL_FLAG_STATE_MOUSE_IN))) {
+ if (!(ewl_widget_state_has(check, EWL_STATE_MOUSE_IN)))
+ {
/* Only set the cursor different if it is non-default */
if (ewl_attach_get(check,
@@ -798,7 +793,7 @@
ewl_embed_mouse_cursor_set(check);
ewl_widget_state_add(check,
- EWL_FLAG_STATE_MOUSE_IN);
+ EWL_STATE_MOUSE_IN);
ewl_callback_call_with_event_data(check,
EWL_CALLBACK_MOUSE_IN, &ev);
}
@@ -820,12 +815,12 @@
* events.
*/
check = embed->last.drag_widget;
- if (check && ewl_widget_state_has(check, EWL_FLAG_STATE_DND))
+ if (check && ewl_widget_state_has(check, EWL_STATE_DND))
ewl_callback_call_with_event_data(check,
EWL_CALLBACK_MOUSE_MOVE, &ev);
check = embed->last.clicked;
- if (check && ewl_widget_state_has(check, EWL_FLAG_STATE_PRESSED))
+ if (check && ewl_widget_state_has(check, EWL_STATE_MOUSE_DOWN))
ewl_callback_call_with_event_data(check,
EWL_CALLBACK_MOUSE_MOVE, &ev);
@@ -1014,14 +1009,14 @@
while (embed->last.mouse_in) {
ewl_widget_state_remove(embed->last.mouse_in,
- EWL_FLAG_STATE_MOUSE_IN);
+ EWL_STATE_MOUSE_IN);
ewl_callback_call_with_event_data(embed->last.mouse_in,
EWL_CALLBACK_MOUSE_OUT, &ev);
embed->last.mouse_in = embed->last.mouse_in->parent;
}
if ((embed->last.drag_widget) && (ewl_widget_state_has
- (embed->last.drag_widget, EWL_FLAG_STATE_DND)))
+ (embed->last.drag_widget, EWL_STATE_DND)))
ewl_dnd_external_drag_start(embed->last.drag_widget);
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -1614,13 +1609,19 @@
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
if (embed->last.focused && (embed->last.focused != w))
+ {
+ ewl_widget_state_remove(embed->last.focused, EWL_STATE_FOCUSED);
ewl_callback_call_with_event_data(embed->last.focused,
EWL_CALLBACK_FOCUS_OUT, w);
+ }
embed->last.focused = w;
if (embed->last.focused)
+ {
+ ewl_widget_state_add(embed->last.focused, EWL_STATE_FOCUSED);
ewl_callback_call(embed->last.focused, EWL_CALLBACK_FOCUS_IN);
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -1677,7 +1678,7 @@
DCHECK_TYPE(e, EWL_EMBED_TYPE);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_widget_state_remove(w, EWL_FLAG_STATE_PRESSED);
+ ewl_widget_state_remove(w, EWL_STATE_MOUSE_DOWN);
if ((w == e->last.focused)
|| (RECURSIVE(w)
@@ -2058,7 +2059,7 @@
/* since we lose focus here, it cannot be a double or triple click,
* hence feed one */
- if (ewl_widget_state_has(emb->last.focused, EWL_FLAG_STATE_PRESSED))
+ if (ewl_widget_state_has(emb->last.focused, EWL_STATE_MOUSE_DOWN))
ewl_embed_mouse_up_feed(emb, 1, 1, 0, 0, ewl_ev_modifiers_get());
DLEAVE_FUNCTION(DLEVEL_STABLE);
Modified: trunk/ewl/src/lib/ewl_engines.c
===================================================================
--- trunk/ewl/src/lib/ewl_engines.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_engines.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -1519,10 +1519,78 @@
* @brief
*/
void
-ewl_engine_theme_element_state_set(Ewl_Embed *embed, void *obj,
+ewl_engine_theme_element_state_add(Ewl_Embed *embed, void *obj, Ewl_State state,
+ Ewl_Engine_State_Source source)
+{
+ Ewl_Engine_Cb_Theme_Element_State_Add state_add;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+
+ state_add = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_ELEMENT_STATE_ADD);
+ if (state_add)
+ state_add(obj, state, source);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @brief
+ */
+void
+ewl_engine_theme_element_state_remove(Ewl_Embed *embed, void *obj,
+ Ewl_State state,
+ Ewl_Engine_State_Source source)
+{
+ Ewl_Engine_Cb_Theme_Element_State_Remove state_remove;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+
+ state_remove = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_ELEMENT_STATE_REMOVE);
+ if (state_remove)
+ state_remove(obj, state, source);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @brief
+ */
+void
+ewl_engine_theme_element_states_apply(Ewl_Embed *embed, void *obj,
+ unsigned int states,
+ unsigned int source)
+{
+ Ewl_Engine_Cb_Theme_Element_States_Apply states_apply;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(embed);
+ DCHECK_TYPE(embed, EWL_EMBED_TYPE);
+
+ states_apply = ewl_engine_hook_get(embed,
+ EWL_ENGINE_HOOK_TYPE_THEME,
+ EWL_ENGINE_THEME_ELEMENT_STATES_APPLY);
+ if (states_apply)
+ states_apply(obj, states, source);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @brief
+ */
+void
+ewl_engine_theme_element_custom_state_set(Ewl_Embed *embed, void *obj,
const char *state)
{
- Ewl_Engine_Cb_Theme_Element_State_Set state_set;
+ Ewl_Engine_Cb_Theme_Element_Custom_State_Set state_set;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(embed);
@@ -1530,7 +1598,7 @@
state_set = ewl_engine_hook_get(embed,
EWL_ENGINE_HOOK_TYPE_THEME,
- EWL_ENGINE_THEME_ELEMENT_STATE_SET);
+ EWL_ENGINE_THEME_ELEMENT_CUSTOM_STATE_SET);
if (state_set)
state_set(obj, state);
Modified: trunk/ewl/src/lib/ewl_engines.h
===================================================================
--- trunk/ewl/src/lib/ewl_engines.h 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_engines.h 2009-07-11 14:30:47 UTC (rev 41306)
@@ -80,7 +80,10 @@
EWL_ENGINE_THEME_ELEMENT_ADD,
EWL_ENGINE_THEME_ELEMENT_FILE_SET,
EWL_ENGINE_THEME_ELEMENT_LOAD_ERROR_GET,
- EWL_ENGINE_THEME_ELEMENT_STATE_SET,
+ EWL_ENGINE_THEME_ELEMENT_STATE_ADD,
+ EWL_ENGINE_THEME_ELEMENT_STATE_REMOVE,
+ EWL_ENGINE_THEME_ELEMENT_STATES_APPLY,
+ EWL_ENGINE_THEME_ELEMENT_CUSTOM_STATE_SET,
EWL_ENGINE_THEME_ELEMENT_TEXT_SET,
EWL_ENGINE_THEME_ELEMENT_MINIMUM_SIZE_GET,
EWL_ENGINE_THEME_ELEMENT_MINIMUM_SIZE_CALC,
@@ -108,10 +111,18 @@
EWL_ENGINE_POINTER_MAX
};
+enum Ewl_Engine_State_Source
+{
+ EWL_ENGINE_STATE_SOURCE_THIS,
+ EWL_ENGINE_STATE_SOURCE_PARENT,
+ EWL_ENGINE_STATE_SOURCE_BOTH
+};
+
typedef enum Ewl_Engine_Window_Hooks Ewl_Engine_Window_Hooks;
typedef enum Ewl_Engine_Theme_Hooks Ewl_Engine_Theme_Hooks;
typedef enum Ewl_Engine_Canvas_Hooks Ewl_Engine_Canvas_Hooks;
typedef enum Ewl_Engine_Pointer_Hooks Ewl_Engine_Pointer_Hooks;
+typedef enum Ewl_Engine_State_Source Ewl_Engine_State_Source;
#define EWL_ENGINE(engine) ((Ewl_Engine *)engine)
@@ -247,8 +258,17 @@
const char *group);
unsigned int ewl_engine_theme_element_load_error_get(Ewl_Embed *emb,
void *obj);
-void ewl_engine_theme_element_state_set(Ewl_Embed *emb, void *obj,
- const char *state);
+void ewl_engine_theme_element_states_apply(Ewl_Embed *emb,
+ void *obj, unsigned int states,
+ Ewl_Engine_State_Source source);
+void ewl_engine_theme_element_state_add(Ewl_Embed *emb,
+ void *obj, Ewl_State state,
+ Ewl_Engine_State_Source source);
+void ewl_engine_theme_element_state_remove(Ewl_Embed *emb,
+ void *obj, Ewl_State state,
+ Ewl_Engine_State_Source source);
+void ewl_engine_theme_element_custom_state_set(Ewl_Embed *emb,
+ void *obj, const char *state);
void ewl_engine_theme_element_text_set(Ewl_Embed *emb, void *obj,
const char *part,
const char *text);
@@ -363,7 +383,16 @@
const char *path,
const char *group);
typedef unsigned int (*Ewl_Engine_Cb_Theme_Element_Load_Error_Get)(void *obj);
-typedef void (*Ewl_Engine_Cb_Theme_Element_State_Set)(void *obj,
+typedef void (*Ewl_Engine_Cb_Theme_Element_State_Add)(void *obj,
+ Ewl_State state,
+ Ewl_Engine_State_Source source);
+typedef void (*Ewl_Engine_Cb_Theme_Element_State_Remove)(void *obj,
+ Ewl_State state,
+ Ewl_Engine_State_Source source);
+typedef void (*Ewl_Engine_Cb_Theme_Element_States_Apply)(void *obj,
+ unsigned int states,
+ Ewl_Engine_State_Source source);
+typedef void (*Ewl_Engine_Cb_Theme_Element_Custom_State_Set)(void *obj,
const char *state);
typedef void (*Ewl_Engine_Cb_Theme_Element_Text_Set)(void *obj,
const char *part,
Modified: trunk/ewl/src/lib/ewl_entry.c
===================================================================
--- trunk/ewl/src/lib/ewl_entry.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_entry.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -185,22 +185,20 @@
ewl_callback_append(EWL_WIDGET(e), EWL_CALLBACK_KEY_DOWN,
ewl_entry_cb_key_down, NULL);
- if (ewl_widget_state_has(EWL_WIDGET(e), EWL_FLAG_STATE_FOCUSED))
+ if (ewl_widget_state_has(EWL_WIDGET(e), EWL_STATE_FOCUSED))
ewl_widget_show(e->cursor);
- ewl_widget_state_set(EWL_WIDGET(e), "enabled",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_add(EWL_WIDGET(e), EWL_STATE_ON);
}
else
{
ewl_callback_del(EWL_WIDGET(e), EWL_CALLBACK_KEY_DOWN,
ewl_entry_cb_key_down);
- if (ewl_widget_state_has(EWL_WIDGET(e), EWL_FLAG_STATE_FOCUSED))
+ if (ewl_widget_state_has(EWL_WIDGET(e), EWL_STATE_FOCUSED))
ewl_widget_hide(e->cursor);
- ewl_widget_state_set(EWL_WIDGET(e), "disabled",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_remove(EWL_WIDGET(e), EWL_STATE_ON);
}
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -381,8 +379,8 @@
sel = EWL_TEXT_TRIGGER(EWL_TEXT(w)->selection);
/* reset the cursor blink */
- ewl_widget_state_set(EWL_WIDGET(e->cursor), "noblink",
- EWL_STATE_PERSISTENT);
+ ewl_widget_custom_state_set(EWL_WIDGET(e->cursor), "noblink",
+ EWL_TRANSIENT);
if ((!event->keyname) || (!event->keyname[0]))
DRETURN(DLEVEL_STABLE);
Modified: trunk/ewl/src/lib/ewl_enums.h
===================================================================
--- trunk/ewl/src/lib/ewl_enums.h 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_enums.h 2009-07-11 14:30:47 UTC (rev 41306)
@@ -224,17 +224,6 @@
EWL_FLAG_QUEUED_PROCESS_CONFIGURE = 0x40000, /**< Configure in progress */
EWL_FLAG_QUEUED_PROCESS_REVEAL = 0x80000, /**< Reveal in progress */
EWL_FLAG_QUEUED_PROCESS_DESTROY = 0x100000,/**< Delete in progress */
-
- /*
- * The state enum specifies the current state of a widget, ie. has it
- * been clicked, does it have the keyboard focus, etc.
- */
- EWL_FLAG_STATE_NORMAL = 0, /**< Widget state normal */
- EWL_FLAG_STATE_MOUSE_IN = 0x200000, /**< Mouse is in the widget */
- EWL_FLAG_STATE_PRESSED = 0x400000, /**< Widget is pressed */
- EWL_FLAG_STATE_FOCUSED = 0x800000, /**< Widget has focus */
- EWL_FLAG_STATE_DISABLED = 0x1000000, /**< Widget is disabled */
- EWL_FLAG_STATE_DND = 0x2000000 /**< Widget is engaged in DND */
};
@@ -431,19 +420,41 @@
typedef enum Ewl_Key_Modifiers Ewl_Key_Modifiers;
/**
- * @enum Ewl_State_Type
+ * @enum Ewl_Durability
+ * The durability type
+ */
+enum Ewl_Durability
+{
+ EWL_TRANSIENT,
+ EWL_PERSISTENT
+};
+
+/**
+ * The Ewl_Durability type
+ */
+typedef enum Ewl_Durability Ewl_Durability;
+
+/**
+ * @enum Ewl_State
* The state type
*/
-enum Ewl_State_Type
+enum Ewl_State
{
- EWL_STATE_TRANSIENT,
- EWL_STATE_PERSISTENT
+ EWL_STATE_MOUSE_IN = 0x1,
+ EWL_STATE_MOUSE_DOWN = 0x2,
+ EWL_STATE_FOCUSED = 0x4,
+ EWL_STATE_DISABLED = 0x8,
+ EWL_STATE_HIGHLIGHTED = 0x10,
+ EWL_STATE_SELECTED = 0x20,
+ EWL_STATE_ON = 0x40,
+ EWL_STATE_ODD = 0x80,
+ EWL_STATE_DND = 0x100
};
/**
- * The Ewl_State_Type type
+ * The Ewl_State type
*/
-typedef enum Ewl_State_Type Ewl_State_Type;
+typedef enum Ewl_State Ewl_State;
/**
* @enum Ewl_Stock_Type
Modified: trunk/ewl/src/lib/ewl_events.h
===================================================================
--- trunk/ewl/src/lib/ewl_events.h 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_events.h 2009-07-11 14:30:47 UTC (rev 41306)
@@ -369,8 +369,21 @@
*/
struct Ewl_Event_State_Change
{
- const char *state;
- Ewl_State_Type flag;
+ union
+ {
+ struct
+ {
+ const char *state;
+ Ewl_Durability durability;
+ } custom;
+ struct
+ {
+ Ewl_State state_add;
+ Ewl_State state_remove;
+ unsigned char inherited:1;
+ } normal;
+ } /* anonymous */;
+ unsigned char custom_state:1;
};
#include <ewl_model.h>
Modified: trunk/ewl/src/lib/ewl_expansion.c
===================================================================
--- trunk/ewl/src/lib/ewl_expansion.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_expansion.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -112,13 +112,12 @@
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(ex);
DCHECK_TYPE(ex, EWL_EXPANSION_TYPE);
-
+
if (ex->expandable)
- ewl_widget_state_set(EWL_WIDGET(ex), "expandable",
- EWL_STATE_TRANSIENT);
+ ewl_widget_appearance_set(EWL_WIDGET(ex), EWL_EXPANSION_TYPE);
else
- ewl_widget_state_set(EWL_WIDGET(ex), "nonexpandable",
- EWL_STATE_TRANSIENT);
+ ewl_widget_appearance_set(EWL_WIDGET(ex), "nonexpandable/"
+ EWL_EXPANSION_TYPE);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Modified: trunk/ewl/src/lib/ewl_filelist_view.c
===================================================================
--- trunk/ewl/src/lib/ewl_filelist_view.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_filelist_view.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -41,7 +41,7 @@
}
/* Watch for changes here */
- if ((icon->theme_state) && (!strcmp(icon->theme_state, "parent,selected")))
+ if (ewl_widget_applied_state_has(icon, EWL_STATE_SELECTED))
{
/* Our icon is selected, so we can just grab a list
* of the selected files from mvc
Modified: trunk/ewl/src/lib/ewl_freebox_mvc.c
===================================================================
--- trunk/ewl/src/lib/ewl_freebox_mvc.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_freebox_mvc.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -171,7 +171,6 @@
Ewl_Widget *o, *cell;
cell = ewl_cell_new();
- ewl_cell_state_change_cb_add(EWL_CELL(cell));
ewl_container_child_append(EWL_CONTAINER(fb_mvc), cell);
ewl_callback_append(cell, EWL_CALLBACK_CLICKED,
ewl_freebox_mvc_cb_item_clicked, fb_mvc);
Modified: trunk/ewl/src/lib/ewl_list.c
===================================================================
--- trunk/ewl/src/lib/ewl_list.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_list.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -104,7 +104,6 @@
Ewl_Widget *o, *cell;
cell = ewl_cell_new();
- ewl_cell_state_change_cb_add(EWL_CELL(cell));
ewl_container_child_append(EWL_CONTAINER(list), cell);
ewl_callback_append(cell, EWL_CALLBACK_CLICKED,
ewl_list_cb_item_clicked, list);
Modified: trunk/ewl/src/lib/ewl_misc.c
===================================================================
--- trunk/ewl/src/lib/ewl_misc.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_misc.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -607,13 +607,13 @@
while (i < *argc) {
if (!strcmp(argv[i], "--ewl-segv")) {
ewl_config_int_set(ewl_config, EWL_CONFIG_DEBUG_SEGV,
- 1, EWL_STATE_TRANSIENT);
+ 1, EWL_TRANSIENT);
matched++;
}
else if (!strcmp(argv[i], "--ewl-backtrace")) {
ewl_config_int_set(ewl_config,
EWL_CONFIG_DEBUG_BACKTRACE, 1,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
matched++;
}
else if (!strcmp(argv[i], "--ewl-theme")) {
@@ -621,7 +621,7 @@
ewl_config_string_set(ewl_config,
EWL_CONFIG_THEME_NAME,
argv[i + 1],
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
matched++;
}
matched++;
@@ -629,41 +629,41 @@
else if (!strcmp(argv[i], "--ewl-print-theme-keys")) {
ewl_config_int_set(ewl_config,
EWL_CONFIG_THEME_PRINT_KEYS, 1,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
matched++;
}
else if (!strcmp(argv[i], "--ewl-print-theme-signals")) {
ewl_config_int_set(ewl_config,
EWL_CONFIG_THEME_PRINT_SIGNALS, 1,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
matched++;
}
else if (!strcmp(argv[i], "--ewl-print-gc-reap")) {
ewl_config_int_set(ewl_config,
EWL_CONFIG_DEBUG_GC_REAP, 1,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
matched++;
}
else if (!strcmp(argv[i], "--ewl-debug")) {
if ((i + 1) < *argc) {
ewl_config_int_set(ewl_config,
EWL_CONFIG_DEBUG_LEVEL, atoi(argv[i + 1]),
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
matched++;
} else {
ewl_config_int_set(ewl_config,
EWL_CONFIG_DEBUG_LEVEL, 1,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
}
ewl_config_int_set(ewl_config,
EWL_CONFIG_DEBUG_ENABLE, 1,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
matched ++;
}
else if (!strcmp(argv[i], "--ewl-debug-paint")) {
ewl_config_int_set(ewl_config,
EWL_CONFIG_DEBUG_EVAS_RENDER, 1,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
matched ++;
}
else if (!strcmp(argv[i], "--ewl-help")) {
@@ -696,7 +696,7 @@
{
ewl_config_string_set(ewl_config,
EWL_CONFIG_ENGINE_NAME, name,
- EWL_STATE_TRANSIENT);
+ EWL_TRANSIENT);
matched ++;
break;
Modified: trunk/ewl/src/lib/ewl_mvc.c
===================================================================
--- trunk/ewl/src/lib/ewl_mvc.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_mvc.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -415,8 +415,8 @@
{
if (w != h)
{
- ewl_widget_state_set(w, "deselect",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_remove(w,
+ EWL_STATE_SELECTED);
}
}
ewl_mvc_selection_free(sel, FALSE);
@@ -1174,7 +1174,7 @@
range->start.column + 1) +
(column - range->start.column);
w = ecore_list_index_goto(EWL_SELECTION(range)->highlight, idx);
- ewl_widget_state_set(w, "deselect", EWL_STATE_PERSISTENT);
+ ewl_widget_state_add(w, EWL_STATE_SELECTED);
/* we have something above, case 1 */
if (range->start.row < row)
@@ -1295,7 +1295,7 @@
DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_widget_state_set(w, "selected", EWL_STATE_PERSISTENT);
+ ewl_widget_state_add(w, EWL_STATE_SELECTED);
ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
ewl_mvc_cb_highlight_destroy, sel);
@@ -1533,8 +1533,8 @@
ewl_mvc_cb_highlight_destroy);
if (set_state)
- ewl_widget_state_set(sel->highlight,
- "deselect",EWL_STATE_PERSISTENT);
+ ewl_widget_state_remove(sel->highlight,
+ EWL_STATE_SELECTED);
}
else
{
@@ -1546,8 +1546,8 @@
ewl_mvc_cb_highlight_destroy);
if (set_state)
- ewl_widget_state_set(w, "deselect",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_remove(w,
+ EWL_STATE_SELECTED);
}
IF_FREE_LIST(sel->highlight);
Modified: trunk/ewl/src/lib/ewl_notebook.c
===================================================================
--- trunk/ewl/src/lib/ewl_notebook.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_notebook.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -236,14 +236,14 @@
if (visible)
{
- ewl_widget_state_set(EWL_WIDGET(n->body.pages), "tabs",
- EWL_STATE_PERSISTENT);
+ ewl_widget_custom_state_set(EWL_WIDGET(n->body.pages), "tabs",
+ EWL_PERSISTENT);
ewl_widget_show(n->body.tabbar);
}
else
{
- ewl_widget_state_set(EWL_WIDGET(n->body.pages), "notabs",
- EWL_STATE_PERSISTENT);
+ ewl_widget_custom_state_set(EWL_WIDGET(n->body.pages), "notabs",
+ EWL_PERSISTENT);
ewl_widget_hide(n->body.tabbar);
}
@@ -291,7 +291,8 @@
Ewl_Widget *w;
t = ewl_attach_widget_association_get(n->cur_page);
- if (t) ewl_widget_state_set(t, "default", EWL_STATE_PERSISTENT);
+ if (t)
+ ewl_widget_state_remove(t, EWL_STATE_SELECTED);
/* make sure we set n->cur_page null first or the hide
* callback won't let us hide */
@@ -305,7 +306,7 @@
t = ewl_attach_widget_association_get(n->cur_page);
if (t)
- ewl_widget_state_set(t, "selected", EWL_STATE_PERSISTENT);
+ ewl_widget_state_add(t, EWL_STATE_SELECTED);
ewl_callback_call(EWL_WIDGET(n), EWL_CALLBACK_VALUE_CHANGED);
@@ -429,7 +430,7 @@
/* if this is the current page set it's tab to selected */
if (n->cur_page == page)
- ewl_widget_state_set(t, "selected", EWL_STATE_PERSISTENT);
+ ewl_widget_state_add(t, EWL_STATE_SELECTED);
ewl_container_child_append(EWL_CONTAINER(t), tab);
Modified: trunk/ewl/src/lib/ewl_paned.c
===================================================================
--- trunk/ewl/src/lib/ewl_paned.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_paned.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -1197,7 +1197,7 @@
ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
ewl_paned_grabber_cb_mouse_move,
INT_TO_INTPTR(ds));
- ewl_widget_state_set(w, "selected", EWL_STATE_PERSISTENT);
+ ewl_widget_state_add(w, EWL_STATE_SELECTED);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -1212,7 +1212,7 @@
ewl_callback_del(w, EWL_CALLBACK_MOUSE_MOVE,
ewl_paned_grabber_cb_mouse_move);
- ewl_widget_state_set(w, "default", EWL_STATE_PERSISTENT);
+ ewl_widget_state_remove(w, EWL_STATE_SELECTED);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Modified: trunk/ewl/src/lib/ewl_progressbar.c
===================================================================
--- trunk/ewl/src/lib/ewl_progressbar.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_progressbar.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -267,8 +267,8 @@
/* FIXME this is not the right place to send this event*/
if (ewl_range_unknown_get(r))
- ewl_widget_state_set(EWL_WIDGET(c), "range-unknown",
- EWL_STATE_PERSISTENT);
+ ewl_widget_custom_state_set(EWL_WIDGET(c), "range-unknown",
+ EWL_PERSISTENT);
ewl_object_preferred_inner_w_set (EWL_OBJECT(c),
ewl_object_preferred_w_get(
Modified: trunk/ewl/src/lib/ewl_row.c
===================================================================
--- trunk/ewl/src/lib/ewl_row.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_row.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -5,8 +5,6 @@
#include "ewl_private.h"
#include "ewl_debug.h"
-static void ewl_row_cb_state_changed(Ewl_Widget *w, void *ev, void *data);
-
/**
* @return Returns a newly allocated row on success, NULL on failure.
* @brief Allocate and initialize a new row
@@ -58,8 +56,6 @@
ewl_callback_append(EWL_WIDGET(row), EWL_CALLBACK_CONFIGURE,
ewl_row_cb_configure, NULL);
- ewl_callback_append(EWL_WIDGET(row), EWL_CALLBACK_STATE_CHANGED,
- ewl_row_cb_state_changed, NULL);
ewl_widget_focusable_set(EWL_WIDGET(row), FALSE);
@@ -370,40 +366,3 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
-/**
- * @internal
- * @param w: The widget to work with
- * @ev: The Ewl_Event_State_Change struct
- * @data: UNUSED
- * @return Returns no value
- * @brief Sends the state on to the row's children
- */
-static void
-ewl_row_cb_state_changed(Ewl_Widget *w, void *ev, void *data __UNUSED__)
-{
- Ewl_Widget *o;
- Ewl_Event_State_Change *e;
- const char *send_state;
-
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_PARAM_PTR(ev);
- DCHECK_TYPE(w, EWL_ROW_TYPE);
-
- e = EWL_EVENT_STATE_CHANGE(ev);
-
- /* Only want this for selected signals */
- if (!strcmp(e->state, "selected"))
- send_state = "parent,selected";
- else if (!strcmp(e->state, "deselect"))
- send_state = "parent,deselect";
- else
- DRETURN(DLEVEL_STABLE);
-
- ewl_container_child_iterate_begin(EWL_CONTAINER(w));
- while ((o = ewl_container_child_next(EWL_CONTAINER(w))))
- ewl_widget_state_set(o, send_state, e->flag);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
Modified: trunk/ewl/src/lib/ewl_scrollpane.c
===================================================================
--- trunk/ewl/src/lib/ewl_scrollpane.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_scrollpane.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -60,12 +60,6 @@
ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
ewl_scrollpane_cb_configure, NULL);
-
- /* Remove the default focus out callback and replace with our own */
- ewl_callback_del(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_container_cb_container_focus_out, NULL);
-
/*
* Create the container to hold the contents and it's configure
* callback to position it's child.
Modified: trunk/ewl/src/lib/ewl_seeker.c
===================================================================
--- trunk/ewl/src/lib/ewl_seeker.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_seeker.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -133,10 +133,6 @@
ewl_seeker_cb_mouse_move, NULL);
ewl_callback_append(w, EWL_CALLBACK_KEY_DOWN,
ewl_seeker_cb_key_down, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
- ewl_container_cb_widget_focus_in, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_container_cb_widget_focus_out, NULL);
/*
* Append a callback for catching mouse movements on the button and
@@ -423,24 +419,22 @@
/*
* If the button is pressed, then continue to calculate it's value.
*/
- if (!ewl_widget_state_has(s->button, EWL_FLAG_STATE_PRESSED)) {
+ if (!ewl_widget_state_has(s->button, EWL_STATE_MOUSE_DOWN)) {
if (s->orientation == EWL_ORIENTATION_HORIZONTAL) {
- if (ewl_widget_state_has(s, EWL_FLAG_STATE_PRESSED))
+ if (ewl_widget_state_has(w, EWL_STATE_MOUSE_DOWN))
s->dragstart = ev->x;
}
else {
- if (ewl_widget_state_has(s, EWL_FLAG_STATE_PRESSED))
+ if (ewl_widget_state_has(w, EWL_STATE_MOUSE_DOWN))
s->dragstart = ev->y;
}
DRETURN(DLEVEL_STABLE);
}
scale = ewl_seeker_mouse_value_map(s, ev->x, ev->y);
-
ewl_range_value_set(r, scale);
-
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -471,7 +465,7 @@
s = EWL_SEEKER(w);
r = EWL_RANGE(w);
- if (ewl_widget_state_has(s->button, EWL_FLAG_STATE_PRESSED))
+ if (ewl_widget_state_has(s->button, EWL_STATE_MOUSE_DOWN))
DRETURN(DLEVEL_STABLE);
ewl_object_current_geometry_get(EWL_OBJECT(s->button),
Modified: trunk/ewl/src/lib/ewl_spinner.c
===================================================================
--- trunk/ewl/src/lib/ewl_spinner.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_spinner.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -80,10 +80,6 @@
ewl_spinner_cb_value_changed, NULL);
ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
ewl_spinner_cb_destroy, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
- ewl_container_cb_widget_focus_in, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
- ewl_container_cb_widget_focus_out, NULL);
ewl_container_show_notify_set(EWL_CONTAINER(w),
ewl_spinner_cb_child_show);
ewl_container_resize_notify_set(EWL_CONTAINER(w),
Modified: trunk/ewl/src/lib/ewl_togglebutton.c
===================================================================
--- trunk/ewl/src/lib/ewl_togglebutton.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_togglebutton.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -77,11 +77,9 @@
cb->checked = !!c;
if (cb->checked)
- ewl_widget_state_set(EWL_WIDGET(cb), "checked",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_add(EWL_WIDGET(cb), EWL_STATE_ON);
else
- ewl_widget_state_set(EWL_WIDGET(cb), "default",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_remove(EWL_WIDGET(cb), EWL_STATE_ON);
ewl_callback_call(EWL_WIDGET(cb), EWL_CALLBACK_VALUE_CHANGED);
Modified: trunk/ewl/src/lib/ewl_tree.c
===================================================================
--- trunk/ewl/src/lib/ewl_tree.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_tree.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -865,7 +865,7 @@
else
state_str = "default";
- ewl_widget_state_set(c, state_str, EWL_STATE_PERSISTENT);
+ ewl_widget_custom_state_set(c, state_str, EWL_PERSISTENT);
ewl_object_fill_policy_set(EWL_OBJECT(c), EWL_FLAG_FILL_SHRINKABLE);
ewl_object_alignment_set(EWL_OBJECT(c), EWL_FLAG_ALIGN_RIGHT);
ewl_widget_show(c);
@@ -891,7 +891,6 @@
DCHECK_TYPE(row, EWL_ROW_TYPE);
cell = ewl_cell_new();
- ewl_cell_state_change_cb_add(EWL_CELL(cell));
ewl_object_fill_policy_set(EWL_OBJECT(cell), EWL_FLAG_FILL_ALL);
ewl_container_child_append(EWL_CONTAINER(row), cell);
ewl_callback_append(cell, EWL_CALLBACK_CLICKED,
@@ -1023,11 +1022,9 @@
if (tree->row_color_alternate)
{
if (colour)
- ewl_widget_state_set(row, "odd",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_add(row, EWL_STATE_ODD);
else
- ewl_widget_state_set(row, "even",
- EWL_STATE_PERSISTENT);
+ ewl_widget_state_remove(row, EWL_STATE_ODD);
}
colour = (colour + 1) % 2;
@@ -1127,7 +1124,7 @@
DCHECK_PARAM_PTR(w);
DCHECK_TYPE(w, EWL_ROW_TYPE);
- ewl_widget_state_set(w, "highlight,on", EWL_STATE_TRANSIENT);
+ ewl_widget_state_add(w, EWL_STATE_HIGHLIGHTED);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -1139,7 +1136,7 @@
DCHECK_PARAM_PTR(w);
DCHECK_TYPE(w, EWL_ROW_TYPE);
- ewl_widget_state_set(w, "highlight,off", EWL_STATE_TRANSIENT);
+ ewl_widget_state_remove(w, EWL_STATE_HIGHLIGHTED);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Modified: trunk/ewl/src/lib/ewl_widget.c
===================================================================
--- trunk/ewl/src/lib/ewl_widget.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_widget.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -76,8 +76,6 @@
if (!ewl_theme_widget_init(w))
DRETURN_INT(FALSE, DLEVEL_STABLE);
- ewl_widget_state_remove(w, EWL_FLAGS_STATE_MASK);
-
/*
* Add the common callbacks that all widgets must perform
*/
@@ -94,18 +92,6 @@
NULL);
ewl_callback_append(w, EWL_CALLBACK_REPARENT, ewl_widget_cb_reparent,
NULL);
- ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE, ewl_widget_cb_enable,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE,
- ewl_widget_cb_disable, NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN, ewl_widget_cb_focus_in,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_IN, ewl_widget_cb_mouse_in,
- NULL);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT, ewl_widget_cb_mouse_out,
- NULL);
ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
ewl_widget_cb_mouse_down, NULL);
ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP, ewl_widget_cb_mouse_up,
@@ -813,10 +799,171 @@
DRETURN_PTR(ret, DLEVEL_STABLE);
}
+void
+ewl_widget_state_add(Ewl_Widget *w, Ewl_State state)
+{
+ Ewl_Embed *emb;
+ Ewl_Event_State_Change ev;
+
+ if (w->states & state)
+ DRETURN(DLEVEL_STABLE);
+
+ w->states |= state;
+
+ emb = ewl_embed_widget_find(w);
+ if (emb && w->theme_object)
+ {
+ /* we print here only the start, the actual signal name
+ * must be printed in the engine */
+ if (ewl_config_cache.print_signals)
+ printf("%p (%s) add:\n", w, w->appearance);
+
+ ewl_engine_theme_element_state_add(emb, w->theme_object, state,
+ EWL_ENGINE_STATE_SOURCE_THIS);
+ /* if this state isn't inherited, send also both */
+ if (!(state & w->inherited_states))
+ ewl_engine_theme_element_state_add(emb, w->theme_object,
+ state, EWL_ENGINE_STATE_SOURCE_BOTH);
+ }
+
+ ev.custom_state = FALSE;
+ ev.normal.state_add = state;
+ ev.normal.state_remove = 0;
+ ev.normal.inherited = FALSE;
+
+ ewl_callback_call_with_event_data(w, EWL_CALLBACK_STATE_CHANGED, &ev);
+}
+
+void
+ewl_widget_state_remove(Ewl_Widget *w, Ewl_State state)
+{
+ Ewl_Embed *emb;
+ Ewl_Event_State_Change ev;
+
+ if (!(w->states & state))
+ DRETURN(DLEVEL_STABLE);
+
+ w->states &= ~state;
+
+ emb = ewl_embed_widget_find(w);
+ if (emb && w->theme_object)
+ {
+ /* we print here only the start, the actual signal name
+ * must be printed in the engine */
+ if (ewl_config_cache.print_signals)
+ printf("%p (%s) remove:\n", w, w->appearance);
+
+ ewl_engine_theme_element_state_remove(emb, w->theme_object,
+ state, EWL_ENGINE_STATE_SOURCE_THIS);
+
+ if (!(state & w->inherited_states))
+ ewl_engine_theme_element_state_remove(emb,
+ w->theme_object, state,
+ EWL_ENGINE_STATE_SOURCE_BOTH);
+ }
+
+ ev.custom_state = FALSE;
+ ev.normal.state_add = 0;
+ ev.normal.state_remove = state;
+ ev.normal.inherited = FALSE;
+
+ ewl_callback_call_with_event_data(w, EWL_CALLBACK_STATE_CHANGED, &ev);
+}
+
+unsigned int
+ewl_widget_state_has(Ewl_Widget *w, Ewl_State state)
+{
+ DRETURN_INT(!!(w->states & state), DLEVEL_STABLE);
+}
+
+void
+ewl_widget_inherited_state_add(Ewl_Widget *w, Ewl_State state)
+{
+ Ewl_Embed *emb;
+ Ewl_Event_State_Change ev;
+
+ if (w->inherited_states & state)
+ DRETURN(DLEVEL_STABLE);
+
+ w->inherited_states |= state;
+ emb = ewl_embed_widget_find(w);
+
+ if (emb && w->theme_object)
+ {
+ /* we print here only the start, the actual signal name
+ * must be printed in the engine */
+ if (ewl_config_cache.print_signals)
+ printf("%p (%s) add:\n", w, w->appearance);
+
+ ewl_engine_theme_element_state_add(emb, w->theme_object, state,
+ EWL_ENGINE_STATE_SOURCE_PARENT);
+
+ if (!(state & w->states))
+ ewl_engine_theme_element_state_add(emb, w->theme_object,
+ state, EWL_ENGINE_STATE_SOURCE_BOTH);
+ }
+
+ ev.custom_state = FALSE;
+ ev.normal.state_add = state;
+ ev.normal.state_remove = 0;
+ ev.normal.inherited = TRUE;
+
+ ewl_callback_call_with_event_data(w, EWL_CALLBACK_STATE_CHANGED, &ev);
+}
+
+void
+ewl_widget_inherited_state_remove(Ewl_Widget *w, Ewl_State state)
+{
+ Ewl_Embed *emb;
+ Ewl_Event_State_Change ev;
+
+ if (!(w->inherited_states & state))
+ DRETURN(DLEVEL_STABLE);
+
+ w->inherited_states &= ~state;
+
+ emb = ewl_embed_widget_find(w);
+ if (emb && w->theme_object)
+ {
+ /* we print here only the start, the actual signal name
+ * must be printed in the engine */
+ if (ewl_config_cache.print_signals)
+ printf("%p (%s) remove:\n", w, w->appearance);
+
+ ewl_engine_theme_element_state_remove(emb, w->theme_object,
+ state,
+ EWL_ENGINE_STATE_SOURCE_PARENT);
+ if (!(state & w->states))
+ ewl_engine_theme_element_state_remove(emb,
+ w->theme_object, state,
+ EWL_ENGINE_STATE_SOURCE_BOTH);
+ }
+
+ ev.custom_state = FALSE;
+ ev.normal.state_add = 0;
+ ev.normal.state_remove = state;
+ ev.normal.inherited = TRUE;
+
+ ewl_callback_call_with_event_data(w, EWL_CALLBACK_STATE_CHANGED, &ev);
+}
+
+unsigned int
+ewl_widget_inherited_state_has(Ewl_Widget *w, Ewl_State state)
+{
+ DRETURN_INT(!!(w->inherited_states & state), DLEVEL_STABLE);
+}
+
+unsigned int
+ewl_widget_applied_state_has(Ewl_Widget *w, Ewl_State state)
+{
+ DRETURN_INT(!!((w->inherited_states | w->states) & state),
+ DLEVEL_STABLE);
+}
+
/**
* @param w: the widget to update the appearance
* @param state: the new state of the widget
- * @param flag: the flag for the state e.g. EWL_STATE_TRANSIENT
+ * @param flag: the flag for the state e.g. EWL_TRANSIENT
* @return Returns no value.
* @brief Update the appearance of the widget to a state
*
@@ -824,7 +971,7 @@
* the state parameter.
*/
void
-ewl_widget_state_set(Ewl_Widget *w, const char *state, Ewl_State_Type flag)
+ewl_widget_custom_state_set(Ewl_Widget *w, const char *state, Ewl_Durability flag)
{
Ewl_Event_State_Change ev;
@@ -837,8 +984,8 @@
* Intentionally lose a reference to the ecore string to keep a
* reference cached for later re-use.
*/
- if (flag == EWL_STATE_PERSISTENT)
- w->theme_state = ecore_string_instance((char *)state);
+ if (flag == EWL_PERSISTENT)
+ w->custom_state = ecore_string_instance(state);
if (w->theme_object)
{
@@ -846,14 +993,15 @@
emb = ewl_embed_widget_find(w);
if (ewl_config_cache.print_signals)
- printf("Emitting: %s to %p (%s)\n", state, w,
- w->appearance);
+ printf("%p (%s) ", w, w->appearance);
- ewl_engine_theme_element_state_set(emb, w->theme_object, state);
+ ewl_engine_theme_element_custom_state_set(emb, w->theme_object,
+ state);
}
- ev.state = state;
- ev.flag = flag;
+ ev.custom_state = TRUE;
+ ev.custom.state = state;
+ ev.custom.durability = flag;
ewl_callback_call_with_event_data(w, EWL_CALLBACK_STATE_CHANGED, &ev);
@@ -1199,8 +1347,7 @@
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
if (DISABLED(w)) {
- ewl_widget_state_remove(w, EWL_FLAGS_STATE_MASK);
- ewl_widget_state_add(w, EWL_FLAG_STATE_NORMAL);
+ ewl_widget_state_remove(w, EWL_STATE_DISABLED);
ewl_callback_call(w, EWL_CALLBACK_WIDGET_ENABLE);
}
@@ -1231,8 +1378,10 @@
/* and now remove us self from the info widget list */
ewl_embed_info_widgets_cleanup(emb, w);
/* finally remove the state flags and set us to disabled*/
- ewl_widget_state_remove(w, EWL_FLAGS_STATE_MASK);
- ewl_widget_state_add(w, EWL_FLAG_STATE_DISABLED);
+ ewl_widget_state_remove(w, EWL_STATE_MOUSE_IN);
+ ewl_widget_state_remove(w, EWL_STATE_MOUSE_DOWN);
+ ewl_widget_state_remove(w, EWL_STATE_FOCUSED);
+ ewl_widget_state_add(w, EWL_STATE_DISABLED);
}
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -1712,6 +1861,13 @@
DCHECK_PARAM_PTR(w);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+ if (REALIZED(w))
+ {
+ DWARNING("It is not possible to set a widget internal"
+ " if it is already realized");
+ DRETURN(DLEVEL_STABLE);
+ }
+
if (val)
ewl_widget_flags_add(w, EWL_FLAG_PROPERTY_INTERNAL,
EWL_FLAGS_PROPERTY_MASK);
@@ -2230,7 +2386,7 @@
IF_RELEASE(w->appearance);
IF_RELEASE(w->inheritance);
- IF_RELEASE(w->theme_state);
+ IF_RELEASE(w->custom_state);
if (w->theme_text.list) {
if (w->theme_text.direct) {
@@ -2354,6 +2510,17 @@
DRETURN(DLEVEL_STABLE);
/*
+ * get the inherited states
+ */
+ if (w->parent && ewl_widget_internal_is(w))
+ w->inherited_states = w->parent->states |
+ w->parent->inherited_states;
+ else if (w->parent)
+ /* the disable state is always inherit */
+ w->inherited_states = (w->parent->states |
+ w->parent->inherited_states) & EWL_STATE_DISABLED;
+
+ /*
* Increment the dnd awareness counter on the embed.
*/
if (ewl_widget_flags_has(w, EWL_FLAG_PROPERTY_DND_TARGET,
@@ -2407,14 +2574,10 @@
/*
* Set the state of the theme object
*/
- if (w->theme_state)
- ewl_widget_state_set(w, (char *)w->theme_state,
- EWL_STATE_TRANSIENT);
+ if (w->custom_state)
+ ewl_widget_custom_state_set(w, w->custom_state,
+ EWL_TRANSIENT);
- if (DISABLED(w))
- ewl_widget_state_set(w, "disabled",
- EWL_STATE_TRANSIENT);
-
/*
* Apply any text overrides
*/
@@ -2469,6 +2632,25 @@
ewl_engine_theme_object_show(emb, w->smart_object);
}
+ /*
+ * Apply the inherited and the direct theme states
+ */
+ if (w->theme_object)
+ {
+ if (ewl_config_cache.print_signals &&
+ (w->states | w->inherited_states))
+ printf("%p (%s) apply:\n", w, w->appearance);
+
+ ewl_engine_theme_element_states_apply(emb, w->theme_object,
+ w->states, EWL_ENGINE_STATE_SOURCE_THIS);
+ ewl_engine_theme_element_states_apply(emb, w->theme_object,
+ w->inherited_states,
+ EWL_ENGINE_STATE_SOURCE_PARENT);
+ ewl_engine_theme_element_states_apply(emb, w->theme_object,
+ w->states | w->inherited_states,
+ EWL_ENGINE_STATE_SOURCE_BOTH);
+ }
+
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -2742,148 +2924,9 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
-
/**
* @internal
* @param w: The widget to work with
- * @param ev_data: UNUSED
- * @param user_data: UNUSED
- * @return Returns no value
- * @brief The enable callback
- */
-void
-ewl_widget_cb_enable(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- ewl_widget_state_set(w, "enabled", EWL_STATE_PERSISTENT);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
- * @param ev_data: UNUSED
- * @param user_data: UNUSED
- * @return Returns no value
- * @brief The disable callback
- */
-void
-ewl_widget_cb_disable(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- ewl_widget_state_set(w, "disabled", EWL_STATE_PERSISTENT);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
- * @param ev_data: UNUSED
- * @param user_data: UNUSED
- * @return Returns no value
- * @brief The focus in callback
- */
-void
-ewl_widget_cb_focus_in(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
-
- ewl_widget_state_set(w, "focus,in", EWL_STATE_TRANSIENT);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
- * @param ev_data: UNUSED
- * @param user_data: UNUSED
- * @return Returns no value
- * @brief The focus out callback
- */
-void
-ewl_widget_cb_focus_out(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
-
- ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
- * @param ev_data: UNUSED
- * @param user_data: UNUSED
- * @return Returns no value
- * @brief The mouse in callback
- */
-void
-ewl_widget_cb_mouse_in(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
-
- ewl_widget_state_set(w, "mouse,in", EWL_STATE_TRANSIENT);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
- * @param ev_data: UNUSED
- * @param user_data: UNUSED
- * @return Returns no value
- * @brief The mouse out callback
- */
-void
-ewl_widget_cb_mouse_out(Ewl_Widget *w, void *ev_data __UNUSED__,
- void *user_data __UNUSED__)
-{
- DENTER_FUNCTION(DLEVEL_STABLE);
- DCHECK_PARAM_PTR(w);
- DCHECK_TYPE(w, EWL_WIDGET_TYPE);
-
- if (DISABLED(w))
- DRETURN(DLEVEL_STABLE);
-
- ewl_widget_state_set(w, "mouse,out", EWL_STATE_TRANSIENT);
-
- DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: The widget to work with
* @param ev_data: The Ewl_Event_Mouse_Down data
* @param user_data: UNUSED
* @return Returns no value
@@ -2904,7 +2947,7 @@
DRETURN(DLEVEL_STABLE);
snprintf(state, sizeof(state), "mouse,down,%i", e->button);
- ewl_widget_state_set(w, state, EWL_STATE_TRANSIENT);
+ ewl_widget_custom_state_set(w, state, EWL_TRANSIENT);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -2931,18 +2974,17 @@
if (DISABLED(w))
DRETURN(DLEVEL_STABLE);
- if (ewl_widget_state_has(w, EWL_FLAG_STATE_DND)) {
- ewl_widget_state_remove(w, EWL_FLAG_STATE_DND);
+ if (ewl_widget_state_has(w, EWL_STATE_DND)) {
+ ewl_widget_state_remove(w, EWL_STATE_DND);
ewl_dnd_drag_drop(w);
}
snprintf(state, sizeof(state), "mouse,up,%i", e->button);
- ewl_widget_state_set(w, state, EWL_STATE_TRANSIENT);
+ ewl_widget_custom_state_set(w, state, EWL_TRANSIENT);
- if (ewl_widget_state_has(w, EWL_FLAG_STATE_MOUSE_IN)) {
+ if (ewl_widget_state_has(w, EWL_STATE_MOUSE_IN)) {
int x, y;
- ewl_widget_state_set(w, "mouse,in", EWL_STATE_TRANSIENT);
x = e->base.x - (CURRENT_X(w) - INSET_LEFT(w));
y = e->base.y - (CURRENT_Y(w) - INSET_TOP(w));
if ((x > 0) && (x < CURRENT_W(w) + INSET_HORIZONTAL(w)) &&
@@ -2960,9 +3002,7 @@
else
ewl_embed_mouse_move_feed(ewl_embed_widget_find(w),
e->base.x, e->base.y, e->base.modifiers);
- } else
- ewl_widget_state_set(w, "mouse,out", EWL_STATE_TRANSIENT);
-
+ }
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -2985,14 +3025,14 @@
DCHECK_PARAM_PTR(w);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
- ewl_widget_state_set(w, "mouse,move", EWL_STATE_TRANSIENT);
- if (ewl_widget_state_has(w, EWL_FLAG_STATE_PRESSED) &&
+ /* FIXME this should go into the embed code */
+ if (ewl_widget_state_has(w, EWL_STATE_MOUSE_DOWN) &&
ewl_widget_flags_has(w, EWL_FLAG_PROPERTY_DND_SOURCE,
EWL_FLAGS_PROPERTY_MASK)) {
embed = ewl_embed_widget_find(w);
- if (!ewl_widget_state_has(w, EWL_FLAG_STATE_DND)) {
- ewl_widget_state_add(w, EWL_FLAG_STATE_DND);
+ if (!ewl_widget_state_has(w, EWL_STATE_DND)) {
+ ewl_widget_state_add(w, EWL_STATE_DND);
embed->last.drag_widget = w;
ewl_dnd_internal_drag_start(w);
}
Modified: trunk/ewl/src/lib/ewl_widget.h
===================================================================
--- trunk/ewl/src/lib/ewl_widget.h 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/src/lib/ewl_widget.h 2009-07-11 14:30:47 UTC (rev 41306)
@@ -148,14 +148,17 @@
const char *theme_path; /**< Path to the file for loading */
const char *theme_group; /**< Group in theme to use */
- const char *theme_state; /**< State of the appearance */
- const char *appearance; /**< Key to lookup appearance in theme */
+ const char *appearance; /**< Key to lookup appearance in theme */
const char *inheritance; /**< Inheritance of path widget */
+ const char *custom_state; /**< custom state */
int layer; /**< the layer relative to the parent */
Ecore_Hash *theme; /**< Overriding theme settings */
Ewl_Pair_List theme_text; /**< Overriding text in theme */
unsigned int flags; /**< the widget flags */
+ unsigned short states; /**< Direct widget states */
+ unsigned short inherited_states; /**< States that are applied to
+ the theme */
unsigned char swallowed:1;
};
@@ -182,8 +185,15 @@
void *ewl_widget_data_del(Ewl_Widget *w, void *k);
void *ewl_widget_data_get(Ewl_Widget *w, void *k);
-void ewl_widget_state_set(Ewl_Widget *w, const char *state,
- Ewl_State_Type flag);
+void ewl_widget_state_add(Ewl_Widget *w, Ewl_State state);
+void ewl_widget_state_remove(Ewl_Widget *w, Ewl_State state);
+unsigned int ewl_widget_state_has(Ewl_Widget *w, Ewl_State state);
+void ewl_widget_inherited_state_add(Ewl_Widget *w, Ewl_State state);
+void ewl_widget_inherited_state_remove(Ewl_Widget *w, Ewl_State state);
+unsigned int ewl_widget_inherited_state_has(Ewl_Widget *w, Ewl_State state);
+unsigned int ewl_widget_applied_state_has(Ewl_Widget *w, Ewl_State state);
+void ewl_widget_custom_state_set(Ewl_Widget *w, const char *cst,
+ Ewl_Durability dur);
void ewl_widget_theme_path_set(Ewl_Widget *w, const char *path);
void ewl_widget_appearance_set(Ewl_Widget *w, const char *appearance);
@@ -328,42 +338,6 @@
(ewl_widget_flags_get(o, EWL_FLAG_PROPERTY_TOPLEVEL))
/**
- * @def ewl_widget_state_add(o, state)
- * @param o: The widget to work with
- * @param state: The state to set into the widget
- * Adds the given state @a state to the widget @a o
- */
-#define ewl_widget_state_add(o, state) \
- ewl_widget_flags_add(o, state, EWL_FLAGS_STATE_MASK)
-
-/**
- * @def ewl_widget_state_remove(o, state)
- * @param o: The widget to work with
- * @param state: The state to remove
- * Removes the given state from the given @a o widget
- */
-#define ewl_widget_state_remove(o, state) \
- ewl_widget_flags_remove(o, state, EWL_FLAGS_STATE_MASK)
-
-/**
- * @def ewl_widget_state_has(o, state)
- * @param o: The widget to check
- * @param state: The state to check
- * Checks if the given state @a state is set on the given widget @a o
- */
-#define ewl_widget_state_has(o, state) \
- ewl_widget_flags_has(o, state, EWL_FLAGS_STATE_MASK)
-
-/**
- * @def ewl_widget_state_get(o, state)
- * @param o: The widget to work with
- * @param state: The state to get
- * Retrives the given state @a state from the widget @a o
- */
-#define ewl_widget_state_get(o, state) \
- ewl_widget_flags_get(o, state, EWL_FLAGS_STATE_MASK)
-
-/**
* @def ewl_widget_queued_add(o, queued)
* @param o: The widget to work with
* @param queued: Add the given queue flag to the widget
@@ -473,7 +447,7 @@
* @def DISABLED(o)
* Used to determine if a widget is disabled
*/
-#define DISABLED(o) (ewl_widget_state_has(EWL_WIDGET(o), EWL_FLAG_STATE_DISABLED))
+#define DISABLED(o) (ewl_widget_applied_state_has(EWL_WIDGET(o), EWL_STATE_DISABLED))
/**
* @def ewl_widget_in_tab_list_get(o)
@@ -513,12 +487,6 @@
void ewl_widget_cb_unrealize(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_widget_cb_configure(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_widget_cb_reparent(Ewl_Widget *w, void *ev_data, void *user_data);
-void ewl_widget_cb_enable(Ewl_Widget *w, void *ev_data, void *user_data);
-void ewl_widget_cb_disable(Ewl_Widget *w, void *ev_data, void *user_data);
-void ewl_widget_cb_focus_in(Ewl_Widget *w, void *ev_data, void *user_data);
-void ewl_widget_cb_focus_out(Ewl_Widget *w, void *ev_data, void *user_data);
-void ewl_widget_cb_mouse_in(Ewl_Widget *w, void *ev_data, void *user_data);
-void ewl_widget_cb_mouse_out(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_widget_cb_mouse_down(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_widget_cb_mouse_up(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_widget_cb_mouse_move(Ewl_Widget *w, void *ev_data, void *user_data);
Modified: trunk/ewl/tools/ewl_config/ewl_config.c
===================================================================
--- trunk/ewl/tools/ewl_config/ewl_config.c 2009-07-11 14:26:53 UTC (rev 41305)
+++ trunk/ewl/tools/ewl_config/ewl_config.c 2009-07-11 14:30:47 UTC (rev 41306)
@@ -84,7 +84,7 @@
val++;
ewl_config_string_set(ewl_config, key, val,
- EWL_STATE_PERSISTENT);
+ EWL_PERSISTENT);
free(t);
did_something = 1;
@@ -716,7 +716,7 @@
ewl_config_int_get(ewl_config, checks[i].key))
ewl_config_int_set(ewl_config, checks[i].key,
ewl_togglebutton_checked_get(EWL_TOGGLEBUTTON(o)),
- EWL_STATE_PERSISTENT);
+ EWL_PERSISTENT);
}
for (i = 0; strings[i].name != NULL; i++)
@@ -730,7 +730,7 @@
{
ewl_config_string_set(ewl_config,
strings[i].key, new,
- EWL_STATE_PERSISTENT);
+ EWL_PERSISTENT);
}
}
@@ -740,7 +740,7 @@
{
ewl_config_int_set(ewl_config, EWL_CONFIG_DEBUG_LEVEL,
ewl_range_value_get(EWL_RANGE(o)),
- EWL_STATE_PERSISTENT);
+ EWL_PERSISTENT);
}
o = ewl_widget_name_find(EC_ICON_SIZE);
@@ -749,7 +749,7 @@
{
ewl_config_int_set(ewl_config,
EWL_CONFIG_THEME_ICON_SIZE, val,
- EWL_STATE_PERSISTENT);
+ EWL_PERSISTENT);
}
o = ewl_widget_name_find(EC_EWL_THEME);
@@ -765,7 +765,7 @@
{
ewl_config_string_set(ewl_config,
EWL_CONFIG_THEME_NAME, v,
- EWL_STATE_PERSISTENT);
+ EWL_PERSISTENT);
}
}
|