Esempio n. 1
0
        private void preview_UserTagSelection(object sender, EventArgs e)
        {
            if (sender is string && (TagsBox == null || !TagsBox.Contains(sender as string)))
            {
                TagsBox += " " + sender;
            }

            if (SearchBoxChanged != null)
            {
                SearchBoxChanged(null, null);
            }

            RaisePropertyChanged("TagsBox");
        }
Esempio n. 2
0
        public Window(Inventory inventory)
            : this(new Builder("window.ui"))
        {
            Inventory = inventory;

            // load the menues and toolbars
            uiManager = new UIManager();

            // create the file actions
            Gtk.Action saveInventoryAction = new Gtk.Action("saveFile","Save","Save the active inventory",Stock.Save);
            saveInventoryAction.Activated += OnSaveInventory;
            Gtk.Action printLabelsAction = new Gtk.Action("printLabels","Print Labels","Print labels for items.",Stock.Print);
            printLabelsAction.Activated += OnPrintLabels;
            Gtk.Action quitAction = new Gtk.Action("quit","Quit","Quit the application",Stock.Quit);
            quitAction.Activated += OnQuit;
            Gtk.Action fileAction = new Gtk.Action("file","File");
            ActionGroup fileActionGroup = new ActionGroup("file");
            fileActionGroup.Add(saveInventoryAction);
            fileActionGroup.Add(printLabelsAction);
            fileActionGroup.Add(quitAction);
            fileActionGroup.Add(fileAction);
            uiManager.InsertActionGroup(fileActionGroup,0);

            // create items box
            itemsBox = new ItemsBox(inventory.Items, uiManager);
            itemsBox.DrawDescriptionEntry += OnDrawDescriptionEntry;
            itemsBox.ShowMe += OnShowItemsBox;
            itemsAlign.Add(itemsBox);

            // create locations box
            locationsBox = new LocationsBox(inventory.Locations, uiManager);
            locationsBox.DrawDescriptionEntry += OnDrawDescriptionEntry;
            locationsBox.ShowMe += OnShowLocationsBox;
            locationsBox.GotoItem += OnGotoLocationsItem;
            locationsAlign.Add(locationsBox);

            // create tags box
            tagsBox = new TagsBox(inventory.Tags, uiManager);
            tagsBox.ShowMe += OnShowTagsBox;
            tagsAlign.Add(tagsBox);

            // create tool and menubar
            uiManager.AddUiFromResource("window_menues.xml");
            menuBar = (MenuBar) uiManager.GetWidget("/menuBar");
            toolbar = (Toolbar) uiManager.GetWidget("/toolbar");
            toolbar.IconSize = IconSize.LargeToolbar;
            toolbar.ToolbarStyle = ToolbarStyle.Both;

            mainBox.PackStart(menuBar,false,true,0);
            mainBox.PackStart(toolbar,false,true,0);

            // laod category icons
            itemsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).ItemsTabIcon;
            locationsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).LocationsTabIcon;
            tagsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).TagsTabIcon;

            this.Icon = ((GtkSettings)Inventory.Settings).WindowIcon;
            this.Resize(((GtkSettings)Inventory.Settings).MainWindowWidth,((GtkSettings)Inventory.Settings).MainWindowHeight);
        }