void ToggleButtons(bool btnState) { newMenuToolButton = (MenuToolButton)ui.GetWidget("newMenuToolButton"); newMenuToolButton.Sensitive = btnState; propertiesToolButton = (ToolButton)ui.GetWidget("propertiesToolButton"); propertiesToolButton.Sensitive = btnState; deleteToolButton = (ToolButton)ui.GetWidget("deleteToolButton"); deleteToolButton.Sensitive = btnState; refreshToolButton = (ToolButton)ui.GetWidget("refreshToolButton"); refreshToolButton.Sensitive = btnState; propertiesToolButton.Show(); refreshToolButton.Show(); }
/// <summary> /// Initialization, takes the Addin this gui is attached to. /// </summary> public TaskManagerGui(TaskManagerNoteAddin addin) { this.addin = addin; utils = new TaskNoteUtilities (addin.Buffer); var duedateImage = new Gtk.Image(null, "Tomboy.TaskManager.Icons.duedate-icon22.png"); add_duedate.Image = duedateImage; var priorityImage = new Gtk.Image(null, "Tomboy.TaskManager.Icons.priority-icon22.png"); add_priority.Image = priorityImage; task_menu.Add (add_duedate); task_menu.Add (add_priority); task_menu.Add (show_priority); if (Tomboy.Debugging) { Gtk.MenuItem print_structure = new Gtk.MenuItem (Catalog.GetString ("Print Structure")); print_structure.Activated += OnPrintStructureActivated; task_menu.Add (print_structure); } var todoImage = new Gtk.Image(null, "Tomboy.TaskManager.Icons.todo-icon24.png"); menu_tool_button = new Gtk.MenuToolButton (todoImage, null); menu_tool_button.TooltipText = Catalog.GetString ("Add a new TaskList"); menu_tool_button.ArrowTooltipText = Catalog.GetString ("Set TaskList properties"); menu_tool_button.Menu = task_menu; task_menu.ShowAll (); menu_tool_button.Show (); addin.AddToolItem (menu_tool_button, -1); }
public override void Initialize(NodeBuilder[] builders, TreePadOption[] options, string contextMenuPath) { base.Initialize(builders, options, contextMenuPath); var topToolbar = Window.GetToolbar(PositionType.Top); // Group button buttonGroup = new MenuButton(); buttonGroup.StockImage = MonoDevelop.Ide.Gui.Stock.GroupByCategory; buttonGroup.ArrowType = ArrowType.Down; buttonGroup.TooltipText = GettextCatalog.GetString("Group instruments"); buttonGroup.MenuCreator = delegate { var menu = new Menu(); var mi = new Gtk.RadioMenuItem("Alphabetically"); var g = mi.Group; mi.Active = groupMethod == InstrumentGroupMethod.Alphabetically; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.Alphabetically; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Currency"); mi.Active = groupMethod == InstrumentGroupMethod.ByCurrency; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByCurrency; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Exchange"); mi.Active = groupMethod == InstrumentGroupMethod.ByExchange; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByExchange; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Instrument Type"); mi.Active = groupMethod == InstrumentGroupMethod.ByInstrumentType; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByInstrumentType; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "By Maturity"); mi.Active = groupMethod == InstrumentGroupMethod.ByMaturity; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.ByMaturity; }; menu.Insert(mi, -1); mi = new Gtk.RadioMenuItem(g, "No Group"); mi.Active = groupMethod == InstrumentGroupMethod.NoGroup; mi.Activated += (sender, e) => { groupMethod = InstrumentGroupMethod.NoGroup; }; menu.Insert(mi, -1); menu.ShowAll(); return(menu); }; topToolbar.Add(buttonGroup); // Refresh button buttonrefresh = new Button(); buttonrefresh.Image = new Gtk.Image(Gtk.Stock.Refresh, IconSize.SmallToolbar); buttonrefresh.TooltipText = GettextCatalog.GetString("Refresh instruments"); topToolbar.Add(buttonrefresh); menuTool = new MenuToolButton(Gtk.Stock.Cdrom); topToolbar.Add(menuTool); topToolbar.ShowAll(); // Tree TreeView.Tree.Selection.Mode = SelectionMode.Single; LoadTree(); Control.ShowAll(); var f = Framework.Current; f.EventManager.Dispatcher.InstrumentAdded += OnInstrumentAdded; f.EventManager.Dispatcher.InstrumentDeleted += OnInstrumentDeleted; foreach (var instrument in Framework.Current.InstrumentManager.Instruments) { instrumentNodes.Add(new InstrumentNode(instrument)); } var byExchange = from instrumentNode in instrumentNodes group instrumentNode by instrumentNode.Instrument.CurrencyId; foreach (var customerGroup in byExchange) { Console.WriteLine(customerGroup.Key); foreach (var customer in customerGroup) { Console.WriteLine(" {0}", customer.Instrument.Symbol); } } var byAlpha = from instrumentNode in instrumentNodes group instrumentNode by instrumentNode.Instrument.Symbol[0]; foreach (var customerGroup in byAlpha) { Console.WriteLine(customerGroup.Key); foreach (var customer in customerGroup) { Console.WriteLine(" {0}", customer.Instrument.Symbol); } } var byCurrency = from instrumentNode in instrumentNodes group instrumentNode by instrumentNode.Instrument.CurrencyId; foreach (var customerGroup in byCurrency) { Console.WriteLine(customerGroup.Key); foreach (var customer in customerGroup) { Console.WriteLine(" {0}", customer.Instrument.Symbol); } } var byType = from instrumentNode in instrumentNodes group instrumentNode by instrumentNode.Instrument.Type; foreach (var customerGroup in byType) { Console.WriteLine(customerGroup.Key); foreach (var customer in customerGroup) { Console.WriteLine(" {0}", customer.Instrument.Symbol); } } var byMaturity = from instrumentNode in instrumentNodes group instrumentNode by instrumentNode.Instrument.Maturity; foreach (var customerGroup in byMaturity) { Console.WriteLine(customerGroup.Key); foreach (var customer in customerGroup) { Console.WriteLine(" {0}", customer.Instrument.Symbol); } } }
void InitWindow() { int height; int width; this.Icon = Utilities.GetIcon ("tasque-48", 48); // Update the window title Title = string.Format ("Tasque"); width = GtkApplication.Instance.Preferences.GetInt("MainWindowWidth"); height = GtkApplication.Instance.Preferences.GetInt("MainWindowHeight"); if(width == -1) width = 600; if(height == -1) height = 600; this.DefaultSize = new Gdk.Size( width, height); accelGroup = new AccelGroup (); AddAccelGroup (accelGroup); globalKeys = new GlobalKeybinder (accelGroup); VBox mainVBox = new VBox(); mainVBox.BorderWidth = 0; mainVBox.Show (); this.Add (mainVBox); HBox topHBox = new HBox (false, 0); topHBox.BorderWidth = 4; categoryComboBox = new ComboBox (); categoryComboBox.Accessible.Description = "Category Selection"; categoryComboBox.WidthRequest = 150; categoryComboBox.WrapWidth = 1; categoryComboBox.Sensitive = false; CellRendererText comboBoxRenderer = new Gtk.CellRendererText (); comboBoxRenderer.WidthChars = 20; comboBoxRenderer.Ellipsize = Pango.EllipsizeMode.End; categoryComboBox.PackStart (comboBoxRenderer, true); categoryComboBox.SetCellDataFunc (comboBoxRenderer, new Gtk.CellLayoutDataFunc (CategoryComboBoxDataFunc)); categoryComboBox.Show (); topHBox.PackStart (categoryComboBox, false, false, 0); // Space the addTaskButton and the categoryComboBox // far apart by using a blank label that expands Label spacer = new Label (string.Empty); spacer.Show (); topHBox.PackStart (spacer, true, true, 0); // The new task entry widget addTaskEntry = new Entry (Catalog.GetString ("New task...")); addTaskEntry.Sensitive = false; addTaskEntry.Focused += OnAddTaskEntryFocused; addTaskEntry.Changed += OnAddTaskEntryChanged; addTaskEntry.Activated += OnAddTaskEntryActivated; addTaskEntry.FocusInEvent += OnAddTaskEntryFocused; addTaskEntry.FocusOutEvent += OnAddTaskEntryUnfocused; addTaskEntry.DragDataReceived += OnAddTaskEntryDragDataReceived; addTaskEntry.Show (); topHBox.PackStart (addTaskEntry, true, true, 0); // Use a small add icon so the button isn't mammoth-sized HBox buttonHBox = new HBox (false, 6); Gtk.Image addImage = new Gtk.Image (Gtk.Stock.Add, IconSize.Menu); addImage.Show (); buttonHBox.PackStart (addImage, false, false, 0); Label l = new Label (Catalog.GetString ("_Add")); l.Show (); buttonHBox.PackStart (l, true, true, 0); buttonHBox.Show (); addTaskButton = new MenuToolButton (buttonHBox, Catalog.GetString ("_Add Task")); addTaskButton.UseUnderline = true; // Disactivate the button until the backend is initialized addTaskButton.Sensitive = false; Gtk.Menu addTaskMenu = new Gtk.Menu (); addTaskButton.Menu = addTaskMenu; addTaskButton.Clicked += OnAddTask; addTaskButton.Show (); topHBox.PackStart (addTaskButton, false, false, 0); globalKeys.AddAccelerator (OnGrabEntryFocus, (uint) Gdk.Key.n, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); globalKeys.AddAccelerator (delegate (object sender, EventArgs e) { GtkApplication.Instance.Quit (); }, (uint) Gdk.Key.q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); this.KeyPressEvent += KeyPressed; topHBox.Show (); mainVBox.PackStart (topHBox, false, false, 0); scrolledWindow = new ScrolledWindow (); scrolledWindow.VscrollbarPolicy = PolicyType.Automatic; scrolledWindow.HscrollbarPolicy = PolicyType.Never; scrolledWindow.BorderWidth = 0; scrolledWindow.CanFocus = true; scrolledWindow.Show (); mainVBox.PackStart (scrolledWindow, true, true, 0); innerEb = new EventBox(); innerEb.BorderWidth = 0; Gdk.Color backgroundColor = GetBackgroundColor (); innerEb.ModifyBg (StateType.Normal, backgroundColor); innerEb.ModifyBase (StateType.Normal, backgroundColor); targetVBox = new VBox(); targetVBox.BorderWidth = 5; targetVBox.Show (); innerEb.Add(targetVBox); scrolledWindow.AddWithViewport(innerEb); statusbar = new Gtk.Statusbar (); statusbar.HasResizeGrip = true; statusbar.Show (); mainVBox.PackEnd (statusbar, false, false, 0); // // Delay adding in the TaskGroups until the backend is initialized // Shown += OnWindowShown; DeleteEvent += WindowDeleted; backend.BackendInitialized += OnBackendInitialized; backend.BackendSyncStarted += OnBackendSyncStarted; backend.BackendSyncFinished += OnBackendSyncFinished; // if the backend is already initialized, go ahead... initialize if(backend.Initialized) { OnBackendInitialized(null, null); } GtkApplication.Instance.Preferences.SettingChanged += OnSettingChanged; }