Use macro to minimise code for border buttons

Allow this to make other groups for each icon
This means the menu code can load the theme data to make icons :) :) :)


SVN revision: 13760
This commit is contained in:
handyande 2005-03-16 23:20:13 +00:00 committed by handyande
parent f9425a13c5
commit 575948cebd
5 changed files with 343 additions and 503 deletions

1
TODO
View File

@ -38,7 +38,6 @@ ISSUES:
* virtual desktops need an overhaul. hacked in waay too quickly.
* virtual desktops need fixing to work with zones properly
* gadman gadget menu needs icons :)
* window menu needs icons :)
* ibar right click context menu needs config items in it as in the module config menu
* any known segv's must go

View File

@ -1,3 +1,169 @@
#define BUTTON(NAME, TYPE, REL1X, REL1Y, OFF1X, OFF1Y, TO1, REL2X, REL2Y, OFF2X, OFF2Y, TO2) \
part { \
name: NAME"_shadow2"; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
visible: 1; \
rel1 { \
relative: 0.0 0.0; \
offset: 0 0; \
to: NAME"_bg"; \
} \
rel2 { \
relative: 1.0 1.0; \
offset: -1 -1; \
to: NAME"_bg"; \
} \
image { \
normal: "e17_mini_button_shadow2.png"; \
border: 8 8 8 8; \
} \
color: 255 255 255 255; \
} \
description { \
state: "active" 0.0; \
visible: 0; \
rel1 { \
relative: 0.0 0.0; \
offset: 0 0; \
to: NAME"_bg"; \
} \
rel2 { \
relative: 1.0 1.0; \
offset: -1 -1; \
to: NAME"_bg"; \
} \
image { \
normal: "e17_mini_button_shadow2.png"; \
border: 8 8 8 8; \
} \
color: 255 255 255 0; \
} \
} \
part { \
name: NAME"_shadow1"; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
visible: 1; \
rel1 { \
relative: 0.0 0.0; \
offset: 0 0; \
to: NAME"_bg"; \
} \
rel2 { \
relative: 1.0 1.0; \
offset: -1 -1; \
to: NAME"_bg"; \
} \
image { \
normal: "e17_mini_button_shadow1.png"; \
border: 8 8 8 8; \
} \
color: 255 255 255 255; \
} \
description { \
state: "active" 0.0; \
visible: 0; \
rel1 { \
relative: 0.0 0.0; \
offset: 0 0; \
to: NAME"_bg"; \
} \
rel2 { \
relative: 1.0 1.0; \
offset: -1 -1; \
to: NAME"_bg"; \
} \
image { \
normal: "e17_mini_button_shadow1.png"; \
border: 8 8 8 8; \
} \
color: 255 255 255 0; \
} \
} \
part { \
name: NAME"_bg"; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
rel1 { \
relative: 0.0 0.0; \
offset: 0 0; \
to: NAME; \
} \
rel2 { \
relative: 1.0 1.0; \
offset: -1 -1; \
to: NAME; \
} \
image { \
normal: "e17_mini_button.png"; \
border: 8 8 8 8; \
} \
} \
description { \
state: "active" 0.0; \
rel1 { \
relative: 0.0 0.0; \
offset: 1 1; \
to: NAME; \
} \
rel2 { \
relative: 1.0 1.0; \
offset: 0 0; \
to: NAME; \
} \
image { \
normal: "e17_mini_button.png"; \
border: 8 8 8 8; \
} \
} \
} \
part { \
name: NAME"_detail"; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
max: 16 16; \
rel1 { \
relative: 0.0 0.0; \
offset: 4 4; \
to: NAME"_bg"; \
} \
rel2 { \
relative: 1.0 1.0; \
offset: -5 -5; \
to: NAME"_bg"; \
} \
image { \
normal: "e17_button_detail_"TYPE".png"; \
} \
} \
} \
part { \
name: NAME; \
type: RECT; \
description { \
state: "default" 0.0; \
align: 1.0 0.0; \
aspect: 1.0 1.0; \
aspect_preference: VERTICAL; \
rel1 { \
relative: REL1X REL1Y; \
offset: OFF1X OFF1Y; \
to: TO1; \
} \
rel2 { \
relative: REL2X REL2Y; \
offset: OFF2X OFF2Y; \
to: TO2; \
} \
color: 0 0 0 0; \
} \
}
images {
image: "e17_border1.png" COMP;
image: "e17_border2.png" COMP;
@ -16,6 +182,8 @@ images {
image: "e17_button_detail_close.png" COMP;
image: "e17_button_detail_maximize.png" COMP;
image: "e17_button_detail_minimize.png" COMP;
image: "e17_button_detail_shade.png" COMP;
image: "e17_button_detail_stick.png" COMP;
image: "e17_mini_button.png" COMP;
image: "e17_mini_button_shadow1.png" COMP;
image: "e17_mini_button_shadow2.png" COMP;
@ -26,6 +194,22 @@ group {
// item: "client_inset" "4 4 24 4";
}
parts {
part {
name: "whole";
type: RECT;
description {
state: "default" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
part {
name: "title2";
type: TEXT;
@ -579,445 +763,6 @@ group {
color: 255 255 255 255;
}
}
part {
name: "button_0_shadow2";
mouse_events: 0;
description {
state: "default" 0.0;
visible: 1;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_0_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_0_bg";
}
image {
normal: "e17_mini_button_shadow2.png";
border: 8 8 8 8;
}
color: 255 255 255 255;
}
description {
state: "active" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_0_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_0_bg";
}
image {
normal: "e17_mini_button_shadow2.png";
border: 8 8 8 8;
}
color: 255 255 255 0;
}
}
part {
name: "button_1_shadow2";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_1_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_1_bg";
}
image {
normal: "e17_mini_button_shadow2.png";
border: 8 8 8 8;
}
}
description {
state: "active" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_1_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_1_bg";
}
image {
normal: "e17_mini_button_shadow2.png";
border: 8 8 8 8;
}
color: 255 255 255 0;
}
}
part {
name: "button_2_shadow2";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_2_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_2_bg";
}
image {
normal: "e17_mini_button_shadow2.png";
border: 8 8 8 8;
}
}
description {
state: "active" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_2_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_2_bg";
}
image {
normal: "e17_mini_button_shadow2.png";
border: 8 8 8 8;
}
color: 255 255 255 0;
}
}
part {
name: "button_0_shadow1";
mouse_events: 0;
description {
state: "default" 0.0;
visible: 1;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_0_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_0_bg";
}
image {
normal: "e17_mini_button_shadow1.png";
border: 8 8 8 8;
}
color: 255 255 255 255;
}
description {
state: "active" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_0_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_0_bg";
}
image {
normal: "e17_mini_button_shadow1.png";
border: 8 8 8 8;
}
color: 255 255 255 0;
}
}
part {
name: "button_1_shadow1";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_1_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_1_bg";
}
image {
normal: "e17_mini_button_shadow1.png";
border: 8 8 8 8;
}
}
description {
state: "active" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_1_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_1_bg";
}
image {
normal: "e17_mini_button_shadow1.png";
border: 8 8 8 8;
}
color: 255 255 255 0;
}
}
part {
name: "button_2_shadow1";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_2_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_2_bg";
}
image {
normal: "e17_mini_button_shadow1.png";
border: 8 8 8 8;
}
}
description {
state: "active" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_2_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_2_bg";
}
image {
normal: "e17_mini_button_shadow1.png";
border: 8 8 8 8;
}
color: 255 255 255 0;
}
}
part {
name: "button_0_bg";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_0";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_0";
}
image {
normal: "e17_mini_button.png";
border: 8 8 8 8;
}
}
description {
state: "active" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 1 1;
to: "button_0";
}
rel2 {
relative: 1.0 1.0;
offset: 0 0;
to: "button_0";
}
image {
normal: "e17_mini_button.png";
border: 8 8 8 8;
}
}
}
part {
name: "button_1_bg";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_1";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_1";
}
image {
normal: "e17_mini_button.png";
border: 8 8 8 8;
}
}
description {
state: "active" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 1 1;
to: "button_1";
}
rel2 {
relative: 1.0 1.0;
offset: 0 0;
to: "button_1";
}
image {
normal: "e17_mini_button.png";
border: 8 8 8 8;
}
}
}
part {
name: "button_2_bg";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "button_2";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "button_2";
}
image {
normal: "e17_mini_button.png";
border: 8 8 8 8;
}
}
description {
state: "active" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 1 1;
to: "button_2";
}
rel2 {
relative: 1.0 1.0;
offset: 0 0;
to: "button_2";
}
image {
normal: "e17_mini_button.png";
border: 8 8 8 8;
}
}
}
part {
name: "button_0_detail";
mouse_events: 0;
description {
state: "default" 0.0;
max: 16 16;
rel1 {
relative: 0.0 0.0;
offset: 4 4;
to: "button_0_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -5 -5;
to: "button_0_bg";
}
image {
normal: "e17_button_detail_close.png";
}
}
}
part {
name: "button_1_detail";
mouse_events: 0;
description {
state: "default" 0.0;
max: 16 16;
rel1 {
relative: 0.0 0.0;
offset: 4 4;
to: "button_1_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -5 -5;
to: "button_1_bg";
}
image {
normal: "e17_button_detail_maximize.png";
}
}
}
part {
name: "button_2_detail";
mouse_events: 0;
description {
state: "default" 0.0;
max: 16 16;
rel1 {
relative: 0.0 0.0;
offset: 4 4;
to: "button_2_bg";
}
rel2 {
relative: 1.0 1.0;
offset: -5 -5;
to: "button_2_bg";
}
image {
normal: "e17_button_detail_minimize.png";
}
}
}
part {
name: "client";
type: RECT;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 1.0;
offset: 4 0;
to: "t1";
}
rel2 {
relative: 0.0 0.0;
offset: -1 -1;
to: "b2";
}
color: 0 0 0 0;
}
}
part {
name: "icon_swallow";
type: SWALLOW;
@ -1118,6 +863,29 @@ group {
color: 0 0 0 0;
}
}
part {
name: "client";
type: RECT;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 1.0;
offset: 4 0;
to: "t1";
}
rel2 {
relative: 0.0 0.0;
offset: -1 -1;
to: "b2";
}
color: 0 0 0 0;
}
}
BUTTON("button_0", "close", 0.0, 0.0, 0, 0, "whole", 1.0, 0.0, -1, 23, "whole")
BUTTON("button_1", "maximize", 0.0, 0.0, 3, 0, "button_0", 0.0, 1.0, 3, -1, "button_0")
BUTTON("button_2", "minimize", 0.0, 0.0, 3, 0, "button_1", 0.0, 1.0, 3, -1, "button_1")
part {
name: "icon";
type: RECT;
@ -1132,68 +900,6 @@ group {
color: 0 0 0 0;
}
}
part {
name: "button_0";
type: RECT;
description {
state: "default" 0.0;
align: 1.0 0.0;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1 {
relative: 1.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: 0 5;
to_y: "title2";
}
color: 0 0 0 0;
}
}
part {
name: "button_1";
type: RECT;
description {
state: "default" 0.0;
align: 1.0 0.0;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1 {
relative: 0.0 0.0;
offset: 3 0;
to: "button_0";
}
rel2 {
relative: 0.0 1.0;
offset: 3 -1;
to: "button_0";
}
color: 0 0 0 0;
}
}
part {
name: "button_2";
type: RECT;
description {
state: "default" 0.0;
align: 1.0 0.0;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1 {
relative: 0.0 0.0;
offset: 3 0;
to: "button_1";
}
rel2 {
relative: 0.0 1.0;
offset: 3 -1;
to: "button_1";
}
color: 0 0 0 0;
}
}
part {
name: "title";
type: RECT;
@ -1327,11 +1033,23 @@ group {
action: SIGNAL_EMIT "resize_stop" "mouse,1";
}
program {
name: "menu_action";
name: "menu_action_icon1";
signal: "mouse,clicked,1";
source: "icon";
action: SIGNAL_EMIT "action" "menu";
}
program {
name: "menu_action_icon3";
signal: "mouse,clicked,3";
source: "icon";
action: SIGNAL_EMIT "action" "menu";
}
program {
name: "menu_action_title3";
signal: "mouse,clicked,3";
source: "title";
action: SIGNAL_EMIT "action" "menu";
}
program {
name: "close_action";
signal: "mouse,clicked,1";
@ -1664,3 +1382,120 @@ group {
}
}
group {
name: "widgets/border/default/close";
parts {
part {
name: "whole";
type: RECT;
description {
state: "default" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
BUTTON("button_0", "close", 0.0, 0.0, -3, -3, "whole", 1.0, 1.0, 2, 2, "whole")
}
}
group {
name: "widgets/border/default/iconify";
parts {
part {
name: "whole";
type: RECT;
description {
state: "default" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
BUTTON("button_1", "minimize", 0.0, 0.0, -3, -3, "whole", 1.0, 1.0, 2, 2, "whole")
}
}
group {
name: "widgets/border/default/maximize";
parts {
part {
name: "whole";
type: RECT;
description {
state: "default" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
BUTTON("button_2", "maximize", 0.0, 0.0, -3, -3, "whole", 1.0, 1.0, 2, 2, "whole")
}
}
group {
name: "widgets/border/default/shade";
parts {
part {
name: "whole";
type: RECT;
description {
state: "default" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
BUTTON("button_3", "shade", 0.0, 0.0, -3, -3, "whole", 1.0, 1.0, 2, 2, "whole")
}
}
group {
name: "widgets/border/default/stick";
parts {
part {
name: "whole";
type: RECT;
description {
state: "default" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
}
}
BUTTON("button_2", "stick", 0.0, 0.0, -3, -3, "whole", 1.0, 1.0, 2, 2, "whole")
}
}

Binary file not shown.

Binary file not shown.

View File

@ -3135,10 +3135,12 @@ _e_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y)
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, "Close");
e_menu_item_callback_set(mi, _e_border_menu_cb_close, bd);
e_menu_item_icon_edje_set(mi, e_path_find(path_themes, "default.eet"), "widgets/border/default/close");
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, "Iconify");
e_menu_item_callback_set(mi, _e_border_menu_cb_iconify, bd);
e_menu_item_icon_edje_set(mi, e_path_find(path_themes, "default.eet"), "widgets/border/default/iconify");
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
@ -3148,18 +3150,21 @@ _e_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y)
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, (bd->shaded ? 1 : 0));
e_menu_item_callback_set(mi, _e_border_menu_cb_shade, bd);
e_menu_item_icon_edje_set(mi, e_path_find(path_themes, "default.eet"), "widgets/border/default/shade");
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, "Maximized");
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, (bd->maximized ? 1 : 0));
e_menu_item_callback_set(mi, _e_border_menu_cb_maximize, bd);
e_menu_item_icon_edje_set(mi, e_path_find(path_themes, "default.eet"), "widgets/border/default/maximize");
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, "Sticky");
e_menu_item_check_set(mi, 1);
e_menu_item_toggle_set(mi, (bd->sticky ? 1 : 0));
e_menu_item_callback_set(mi, _e_border_menu_cb_stick, bd);
e_menu_item_icon_edje_set(mi, e_path_find(path_themes, "default.eet"), "widgets/border/default/stick");
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
@ -3172,6 +3177,7 @@ _e_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y)
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, "Edit Icon");
e_menu_item_callback_set(mi, _e_border_menu_cb_icon_edit, a->path);
e_menu_item_icon_edje_set(mi, a->path, "icon");
}
else if (bd->client.icccm.class) /* icons with no class useless to borders */
{