efl: Split Efl.Container and Efl.Content
When I first implemented the Efl.Container interface I made a mistake of mixing "single slot" content API's with "multiple children" content API's. This should fix that, by separating API's that are for a single part and those that deal with a list of children. Efl.Content: Single slot. This will be used a lot by efl_part() objects, and for the default content of widgets (eg. the window content). Efl.Container: Multiple children. Used by lists, boxes, layouts (edje/elm), etc... I didn't see any class that implemented both interfaces (note: Layout implements Container and Button implements Content, so technically Button implements both through inheritance). For now the eo_prefix is not changed in Efl.Container. I wonder if it should be reset (to efl_container) or not. This would only affect the C API. Ref T5328
This commit is contained in:
parent
d267a3beaa
commit
133b49be57
|
@ -1,7 +1,7 @@
|
|||
efl = require('efl');
|
||||
|
||||
function setIcon(widget, icon) {
|
||||
container = widget.part("icon").cast("Efl.Container");
|
||||
container = widget.part("icon").cast("Efl.Content");
|
||||
container.setContent(icon);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ bt = new efl.Efl.Ui.Image(ly);
|
|||
bt.setIcon('chat');
|
||||
bt.setHintMin(20, 20);
|
||||
// elm_layout_icon_set(ly, bt);
|
||||
icon_container = ly.part('elm.swallow.icon').cast('Efl.Container');
|
||||
icon_container = ly.part('elm.swallow.icon').cast('Efl.Content');
|
||||
icon_container.setContent(bt);
|
||||
ly.emitSignal('elm,state,icon,visible', 'elm');
|
||||
|
||||
|
@ -37,7 +37,7 @@ bt = new efl.Efl.Ui.Image(ly);
|
|||
bt.setIcon('close');
|
||||
bt.setHintMin(20, 20);
|
||||
// elm_layout_end_set(ly, bt);
|
||||
end_container = ly.part('elm.swallow.end').cast('Efl.Container');
|
||||
end_container = ly.part('elm.swallow.end').cast('Efl.Content');
|
||||
end_container.setContent(bt);
|
||||
ly.emitSignal('elm,state,end,visible', 'elm');
|
||||
|
||||
|
@ -56,7 +56,7 @@ ly.setVisible(true);
|
|||
bt = new efl.Efl.Ui.Button(ly);
|
||||
bt.setPartText(null, "Button 1");
|
||||
console.log("Will get part");
|
||||
element_container = ly.part('example/custom').cast('Efl.Container');
|
||||
element_container = ly.part('example/custom').cast('Efl.Content');
|
||||
console.log("Will setcontent on part");
|
||||
element_container.setContent(bt);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ popup.on('timeout', function()
|
|||
popup.setVisible(false);
|
||||
});
|
||||
|
||||
content_container = popup.part("elm.swallow.content").cast("Efl.Container");
|
||||
content_container = popup.part("elm.swallow.content").cast("Efl.Content");
|
||||
content_container.setContent(content);
|
||||
|
||||
popup.setPartText("title,text", "Title");
|
||||
|
|
|
@ -21,7 +21,7 @@ radio_g.setStateValue(1);
|
|||
radio_g.setValue(1);
|
||||
ic = new efl.Efl.Ui.Image(win);
|
||||
ic.setIcon("home");
|
||||
radio_g.part("icon").cast("Efl.Container").setContent(ic);
|
||||
radio_g.part("icon").cast("Efl.Content").setContent(ic);
|
||||
bx.packEnd(radio_g);
|
||||
radio_g.setHintWeight(1.0, 1.0);
|
||||
radio_g.setHintAlign(-1.0, -1.0);
|
||||
|
@ -34,7 +34,7 @@ radio.setStateValue(2);
|
|||
radio.addGroup(radio_g);
|
||||
ic = new efl.Efl.Ui.Image(win);
|
||||
ic.setIcon("file");
|
||||
radio.part("icon").cast("Efl.Container").setContent(ic);
|
||||
radio.part("icon").cast("Efl.Content").setContent(ic);
|
||||
bx.packEnd(radio);
|
||||
radio.setHintWeight(1.0, 1.0);
|
||||
radio.setHintAlign(-1.0, -1.0);
|
||||
|
|
|
@ -24,12 +24,12 @@ sl.setPartText("elm.text", "Counter");
|
|||
ic = new efl.Efl.Ui.Image(win);
|
||||
ic.setIcon("home");
|
||||
// ic.setResizable(false, false);
|
||||
sl.part("icon").cast("Efl.Container").setContent(ic);
|
||||
sl.part("icon").cast("Efl.Content").setContent(ic);
|
||||
|
||||
ic = new efl.Efl.Ui.Image(win);
|
||||
ic.setIcon("folder");
|
||||
// ic.setResizable(false, false);
|
||||
sl.part("end").cast("Efl.Container").setContent(ic);
|
||||
sl.part("end").cast("Efl.Content").setContent(ic);
|
||||
|
||||
sl.setHintAlign(-1.0, 0.5);
|
||||
sl.setHintWeight(1.0, 1.0);
|
||||
|
|
|
@ -58,7 +58,7 @@ twit.get('statuses/user_timeline', {screen_name: user_acount, count:10}, functio
|
|||
var entry = new efl.Elm.Entry(win);
|
||||
entry.setPartText("elm.text", text);
|
||||
entry.setEditable(false);
|
||||
part = layout.part("tweet_text").cast("Efl.Container");
|
||||
part = layout.part("tweet_text").cast("Efl.Content");
|
||||
part.setContent(entry);
|
||||
|
||||
layout.setHintMin(127, 96);
|
||||
|
@ -68,7 +68,7 @@ twit.get('statuses/user_timeline', {screen_name: user_acount, count:10}, functio
|
|||
var icon = new efl.Efl.Ui.Image(win);
|
||||
icon.fillInside = true;
|
||||
icon_array.push(icon);
|
||||
user_icon = layout.part("user_icon").cast("Efl.Container");
|
||||
user_icon = layout.part("user_icon").cast("Efl.Content");
|
||||
user_icon.setContent(icon);
|
||||
item = tweet_box.packEnd(layout);
|
||||
layout.setVisible(true);
|
||||
|
|
Loading…
Reference in New Issue