Commit e456b56

mo <email@solidware.ca>
2011-03-27 00:41:13
cleanup button bar, button expression and add null Icon.
1 parent 6ca0d92
product/desktop.ui/views/icons/UIIcon.cs
@@ -14,18 +14,19 @@ namespace solidware.financials.windows.ui.views.icons
         static public readonly UIIcon Refresh = new UIIcon("refresh.png");
         static public readonly UIIcon Running = new UIIcon("running.gif");
         static public readonly UIIcon Success = new UIIcon("success.png");
+        static public readonly UIIcon Null = new NullUIIcon();
 
-        UIIcon(string path)
+        protected UIIcon(string path)
         {
             this.path = path;
         }
 
-        public Stream ImageStream()
+        public virtual Stream ImageStream()
         {
             return IconMarker.GetImage(path);
         }
 
-        public ImageSource BitmapFrame()
+        public virtual ImageSource BitmapFrame()
         {
             return System.Windows.Media.Imaging.BitmapFrame.Create(ImageStream());
         }
@@ -36,5 +37,20 @@ namespace solidware.financials.windows.ui.views.icons
         }
 
         string path;
+
+        class NullUIIcon : UIIcon
+        {
+            public NullUIIcon() : base(string.Empty) {}
+
+            public override Stream ImageStream()
+            {
+                return null;
+            }
+
+            public override ImageSource BitmapFrame()
+            {
+                return null;
+            }
+        }
     }
 }
\ No newline at end of file
product/desktop.ui/views/ButtonBar.xaml
@@ -1,7 +1,7 @@
 <UserControl x:Class="solidware.financials.windows.ui.views.ButtonBar" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-<DockPanel Name="DockPanel" Background="Silver">
+<DockPanel Name="DockPanel" LastChildFill="False">
     <ComboBox ItemsSource="{Binding family_members}" SelectedItem="{Binding SelectedMember}" Width="150"></ComboBox>
-    <Label Content="{Binding Path=SelectedMember.first_name, Mode=OneWay}"/>
-    <Label Content="{Binding Path=SelectedMember.last_name, Mode=OneWay}"/>
+    <!--<Label Content="{Binding Path=SelectedMember.first_name, Mode=OneWay}"/>-->
+    <!--<Label Content="{Binding Path=SelectedMember.last_name, Mode=OneWay}"/>-->
 </DockPanel>
 </UserControl>
product/desktop.ui/views/ButtonBar.xaml.cs
@@ -14,29 +14,9 @@ namespace solidware.financials.windows.ui.views
             InitializeComponent();
         }
 
-        public void AddCommand(string text, Action action)
-        {
-            DockPanel.Add<Button>(x =>
-            {
-                x.VerticalAlignment = VerticalAlignment.Stretch;
-                x.Content = text;
-                x.Click += action.ToRoutedHandler();
-                x.Height = 30;
-                x.Margin = new Thickness(5, 0, 5, 0);
-                x.HorizontalAlignment = HorizontalAlignment.Right;
-            });
-        }
-
         public void AddCommand(string text, Action action, UIIcon icon)
         {
-            DockPanel.Add<Button>(x =>
-            {
-                x.ToIconButton(icon, new SimpleCommand(action)).Text(text);
-                x.VerticalAlignment = VerticalAlignment.Stretch;
-                x.Height = 30;
-                x.Margin = new Thickness(5, 0, 5, 0);
-                x.HorizontalAlignment = HorizontalAlignment.Right;
-            });
+            AddCommand(text, new SimpleCommand(action), icon);
         }
 
         public void AddCommand(string text, ICommand command, UIIcon icon)
@@ -45,8 +25,6 @@ namespace solidware.financials.windows.ui.views
             {
                 x.ToIconButton(icon, command).Text(text);
                 x.VerticalAlignment = VerticalAlignment.Stretch;
-                x.Height = 30;
-                x.Margin = new Thickness(5, 0, 5, 0);
                 x.HorizontalAlignment = HorizontalAlignment.Right;
             });
         }
product/desktop.ui/views/ButtonExpression.cs
@@ -6,7 +6,7 @@ namespace solidware.financials.windows.ui.views
 {
     public class ButtonExpression
     {
-        readonly ButtonBase button;
+        ButtonBase button;
 
         public ButtonExpression(ButtonBase button)
         {
@@ -27,19 +27,5 @@ namespace solidware.financials.windows.ui.views
                                    Content = text
                                });
         }
-
-        public ButtonExpression SmallerImages()
-        {
-            var image = button.Content as Image ?? button.Content.downcast_to<StackPanel>().Children[0].downcast_to<Image>();
-            image.Width = image.Height = 16;
-
-            return this;
-        }
-
-        public ButtonExpression DoesNotAcceptTab()
-        {
-            button.TabIndex = int.MaxValue;
-            return this;
-        }
     }
 }
\ No newline at end of file
product/desktop.ui/views/Shell.xaml
@@ -14,7 +14,7 @@
       <ad:ResizingPanel Orientation="Vertical">
         <ad:ResizingPanel Orientation="Horizontal">
           <ad:DockablePane ad:ResizingPanel.ResizeWidth="150">
-            <ad:DockableContent x:Name="classesContent" Title="Classes">
+            <ad:DockableContent x:Name="historyContent" Title="History">
               <TreeView>
                 <TreeViewItem Header="2011">
                     <TreeViewItem Header="January"></TreeViewItem>
product/desktop.ui/views/WPFExtensions.cs
@@ -43,7 +43,6 @@ namespace solidware.financials.windows.ui.views
             {
                 image = new Image();
                 button.Content = image;
-
                 image.Width = 25;
                 image.Height = 25;
             }