public ToolBarConnector(ButtonAction action, ToolBarButton toolBarButton) { this.toolBarButton = toolBarButton; this.toolBarButton.Click += toolBarButton_Click; this.action = action; this.action.EnabledChanged += new EventHandler<EventArgs>(action_EnabledChanged).MakeWeak(e => this.action.EnabledChanged -= e); }
public override ToolBarItem Generate(ActionItem actionItem, ToolBar toolBar) { ToolBarButton tbb = new ToolBarButton(toolBar.Generator); tbb.ID = this.ID; tbb.Enabled = this.Enabled; if (ShowLabel || actionItem.ShowLabel || toolBar.TextAlign != ToolBarTextAlign.Right) tbb.Text = ToolBarText; //Console.WriteLine("Adding toolbar {0}", ToolBarText); if (Icon != null) tbb.Icon = Icon; new ToolBarConnector(this, tbb); return tbb; }
public override ToolBarItem GenerateToolBarItem(ActionItem actionItem, Generator generator, ToolBarTextAlign textAlign) { ToolBarButton tbb = new ToolBarButton(generator); tbb.ID = this.ID; tbb.Enabled = this.Enabled; if (ShowLabel || actionItem.ShowLabel || textAlign != ToolBarTextAlign.Right) tbb.Text = ToolBarText; //Console.WriteLine("Adding toolbar {0}", ToolBarText); if (Image != null) tbb.Image = Image; if (!string.IsNullOrEmpty (ToolBarItemStyle)) tbb.Style = ToolBarItemStyle; new ToolBarConnector(this, tbb); return tbb; }