This commit is contained in:
Zihan Chen
2021-07-10 11:35:13 -07:00
parent f4dbaca9e0
commit 3d5758fca8
4 changed files with 34 additions and 28 deletions
@@ -32,15 +32,15 @@
{ {
prop IconColor : Color = (cast Color "#000000") {not observe} prop IconColor : Color = (cast Color "#000000") {not observe}
new(color: Color) { IconColor = color; } new(color: Color) { this.IconColor = color; }
} }
class ColorGroup class ColorGroup
{ {
prop Items : observe ColorItem^[] = null {not observe} prop Items : observe ColorItem^[] = {} {not observe}
prop Name : string = "" {not observe} prop Name : string = "" {not observe}
new(name: string, items: observe ColorItem^[]) { Name = name; Items = items; } new(name: string) { this.Name = name; }
} }
} }
]]></Workflow> ]]></Workflow>
@@ -63,28 +63,33 @@
<Instance name="MainWindowResource"> <Instance name="MainWindowResource">
<Instance ref.Class="sample::MainWindow"> <Instance ref.Class="sample::MainWindow">
<ref.Members><![CDATA[ <ref.Members><![CDATA[
var groups : observe ColorGroup^[] = static func CreateGroups(): (observe ColorGroup^[])
{ {
new ColorGroup^("Group One", var groups : observe ColorGroup^[] = {};
{ {
new sample::ColorItem^(cast Color "#000000"); var group = new ColorGroup^("Group One");
new sample::ColorItem^(cast Color "#FFFFFF"); groups.Add(group);
} as (observe sample::ColorItem^[])); group.Items.Add(new sample::ColorItem^(cast Color "#000000"));
group.Items.Add(new sample::ColorItem^(cast Color "#FFFFFF"));
}
{
var group = new ColorGroup^("Group Two");
groups.Add(group);
group.Items.Add(new sample::ColorItem^(cast Color "#FF0000"));
group.Items.Add(new sample::ColorItem^(cast Color "#00FF00"));
group.Items.Add(new sample::ColorItem^(cast Color "#0000FF"));
}
{
var group = new ColorGroup^("Group Three");
groups.Add(group);
group.Items.Add(new sample::ColorItem^(cast Color "#FFFF00"));
group.Items.Add(new sample::ColorItem^(cast Color "#FF00FF"));
group.Items.Add(new sample::ColorItem^(cast Color "#00FFFF"));
}
return groups;
}
new ColorGroup^("Group Two", var colorGroups : observe ColorGroup^[] = CreateGroups();
{
new sample::ColorItem^(cast Color "#FF0000");
new sample::ColorItem^(cast Color "#00FF00");
new sample::ColorItem^(cast Color "#0000FF");
} as (observe sample::ColorItem^[]));
new ColorGroup^("Group Two",
{
new sample::ColorItem^(cast Color "#FFFF00");
new sample::ColorItem^(cast Color "#FF00FF");
new sample::ColorItem^(cast Color "#00FFFF");
} as (observe sample::ColorItem^[]));
};
]]></ref.Members> ]]></ref.Members>
<Window ref.Name="self" Text="control_ribbon_gallery" ClientSize="x:640 y:480"> <Window ref.Name="self" Text="control_ribbon_gallery" ClientSize="x:640 y:480">
<MessageDialog ref.Name="dialogMessage" Title="You Expanded a Group!" Text="GuiRibbonGroup::ExpandButtonClicked is executed!"/> <MessageDialog ref.Name="dialogMessage" Title="You Expanded a Group!" Text="GuiRibbonGroup::ExpandButtonClicked is executed!"/>
@@ -115,25 +120,25 @@
<RibbonGroup Text="Something" LargeImage-uri="res://ToolbarImages/PasteLarge"> <RibbonGroup Text="Something" LargeImage-uri="res://ToolbarImages/PasteLarge">
<att.Items> <att.Items>
<BindableRibbonGalleryList MinCount="2" MaxCount="5" VisibleItemCount="5" ItemTemplate="sample::ColorItemTemplate" env.ItemType="sample::ColorGroup^"> <BindableRibbonGalleryList MinCount="2" MaxCount="5" VisibleItemCount="5" ItemTemplate="sample::ColorItemTemplate" env.ItemType="sample::ColorGroup^">
<att.ItemSource-bind>self.groups</att.ItemSource-bind> <att.ItemSource-bind>self.colorGroups</att.ItemSource-bind>
<att.GroupTitleProperty>Name</att.GroupTitleProperty> <att.GroupTitleProperty>Name</att.GroupTitleProperty>
<att.GroupChildrenProperty>Items</att.GroupChildrenProperty> <att.GroupChildrenProperty>Items</att.GroupChildrenProperty>
<att.SubMenu-set> <att.SubMenu-set>
<ToolstripGroupContainer> <ToolstripGroupContainer>
<ToolstripGroup> <ToolstripGroup>
<RibbonToolstripHeader Text="Undo / Redo"/> <RibbonToolstripHeader Text="Undo / Redo"/>
<ToolstripButton Command-ref="commandUndo"/> <MenuItemButton Command-ref="commandUndo"/>
<ToolstripButton Command-ref="commandRedo"/> <MenuItemButton Command-ref="commandRedo"/>
</ToolstripGroup> </ToolstripGroup>
<ToolstripGroup> <ToolstripGroup>
<RibbonToolstripHeader Text="Edit"/> <RibbonToolstripHeader Text="Edit"/>
<ToolstripButton Command-ref="commandCut"/> <MenuItemButton Command-ref="commandCut"/>
<ToolstripButton Command-ref="commandCopy"/> <MenuItemButton Command-ref="commandCopy"/>
<ToolstripButton Command-ref="commandPaste"/> <MenuItemButton Command-ref="commandPaste"/>
</ToolstripGroup> </ToolstripGroup>
<ToolstripGroup> <ToolstripGroup>
<RibbonToolstripHeader Text="Delete"/> <RibbonToolstripHeader Text="Delete"/>
<ToolstripButton Command-ref="commandDelete"/> <MenuItemButton Command-ref="commandDelete"/>
</ToolstripGroup> </ToolstripGroup>
</ToolstripGroupContainer> </ToolstripGroupContainer>
</att.SubMenu-set> </att.SubMenu-set>
+1
View File
@@ -9,6 +9,7 @@ https://zhuanlan.zhihu.com/p/39369370
- [ ] `GlobalStringKey` need to remember the `GlobalStringKeyManager` object, and if the global object is changed, it means this key becomes a wild pointer, it should crash. - [ ] `GlobalStringKey` need to remember the `GlobalStringKeyManager` object, and if the global object is changed, it means this key becomes a wild pointer, it should crash.
- [ ] Collection literal `{a b c}` should react to the "receiving type" if the receiving type is a known collection type. - [ ] Collection literal `{a b c}` should react to the "receiving type" if the receiving type is a known collection type.
- So that it is able to do `DealWithObservableList({1 2 3});` - So that it is able to do `DealWithObservableList({1 2 3});`
- [ ] `new(name: string, items: observe X^[]) { this.Name = name; this.Items = items; }` doesn't work for `items`.
- [ ] `let X = Y in (F(X.a.b.c))` reports `X does not exist in the current scope` in binding property value - [ ] `let X = Y in (F(X.a.b.c))` reports `X does not exist in the current scope` in binding property value
- while `F((let X = Y.a.b).c)` works - while `F((let X = Y.a.b).c)` works
- [ ] GacGen reports only "error dumping resource file" while the resource file contains some syntax errors preventing GacGen from reading it - [ ] GacGen reports only "error dumping resource file" while the resource file contains some syntax errors preventing GacGen from reading it