Exemplo n.º 1
0
        public TransfersMenu(TreeView transfersList, IFileTransfer transfer)
        {
            Glade.XML glade = new Glade.XML(null, "FileFind.Meshwork.GtkClient.meshwork.glade", "TransfersMenu", null);
            glade.Autoconnect(this);
            this.menu = (Gtk.Menu) glade.GetWidget("TransfersMenu");

            this.transfersList = transfersList;
            this.transfer = transfer;

            if (transfer != null) {
                mnuCancelAndRemoveTransfer.Visible = true;
                mnuShowTransferDetails.Sensitive = true;
                mnuClearFinishedFailedTransfers.Sensitive = true;
                if (transfer.Status == FileTransferStatus.Paused) {
                    mnuPauseTransfer.Visible = false;
                    mnuResumeTransfer.Visible = true;
                    mnuResumeTransfer.Sensitive = true;
                    mnuCancelTransfer.Sensitive = true;
                } else if (transfer.Status == FileTransferStatus.Canceled || transfer.Status == FileTransferStatus.Completed) {
                    mnuPauseTransfer.Sensitive = false;
                    mnuResumeTransfer.Visible = false;
                    mnuCancelTransfer.Sensitive = false;
                }
            } else {
                mnuCancelAndRemoveTransfer.Visible = false;
                mnuShowTransferDetails.Sensitive = false;
                mnuPauseTransfer.Sensitive = false;
                mnuResumeTransfer.Visible = false;
                mnuCancelTransfer.Sensitive = false;
            }
        }
Exemplo n.º 2
0
        public PlayListTreeView()
        {
            this.HeadersVisible = false;

            ls = new ListStore(typeof(PlayListPlay));
            this.Model = ls;

            menu = new Menu();
            MenuItem title = new MenuItem(Catalog.GetString("Edit Title"));
            title.Activated += new EventHandler(OnTitle);
            title.Show();
            MenuItem delete = new MenuItem(Catalog.GetString("Delete"));
            delete.Activated += new EventHandler(OnDelete);
            delete.Show();
            setRate = new MenuItem(Catalog.GetString("Apply current play rate"));
            setRate.Activated += new EventHandler(OnApplyRate);
            setRate.Show();
            menu.Append(title);
            menu.Append(setRate);
            menu.Append(delete);

            Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn();
            nameColumn.Title = Catalog.GetString("Name");
            Gtk.CellRendererText nameCell = new Gtk.CellRendererText();
            nameColumn.PackStart(nameCell, true);
            nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderName));
            this.AppendColumn(nameColumn);
        }
        public TrackListHeaderMenuController(BaseTrackListViewController trackListViewController)
        {
            var visibleColumns = trackListViewController.GetColumnTrackProperties().ToHashSet();

            Menu headerMenu = new Menu();

            foreach (TrackProperty trackProperty in Enum.GetValues(typeof(TrackProperty)))
            {
                var trackPropertyMenuItem = new CheckMenuItem(Extensions.GetEnumDescription(trackProperty));
                if (visibleColumns.Contains(trackProperty))
                    trackPropertyMenuItem.Active = true;
                TrackProperty property = trackProperty;
                trackPropertyMenuItem.Toggled += (sender, args) =>
                    {
                        if (trackPropertyMenuItem.Active)
                            trackListViewController.InsertColumn(property, ClickedProperty);
                        else
                            trackListViewController.RemoveColumn(property);
                    };
                headerMenu.Append(trackPropertyMenuItem);
            }

            View = headerMenu;
            View.ShowAll();
        }
Exemplo n.º 4
0
        protected override void OnPressed()
        {
            //base.OnPressed ();
            Gtk.Menu menu = new Gtk.Menu ();

            if (menu.Children.Length > 0) {
                Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem ();
                sep.Show ();
                menu.Insert (sep, -1);
            }

            Gtk.RadioMenuItem grp = new Gtk.RadioMenuItem ("");

            foreach (ComboItem ci in items) {
                Gtk.RadioMenuItem mi = new Gtk.RadioMenuItem (grp, ci.Label.Replace ("_","__"));
                if (ci.Item == items.CurrentItem || ci.Item.Equals (items.CurrentItem))
                    mi.Active = true;

                ComboItemSet isetLocal = items;
                ComboItem ciLocal = ci;
                mi.Activated += delegate {
                    SelectItem (isetLocal, ciLocal);
                };
                mi.ShowAll ();
                menu.Insert (mi, -1);
            }
            menu.Popup (null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime);
        }
Exemplo n.º 5
0
        protected void Construct (Widget buttonWidget, Menu menu, bool showArrow)
        {
            WidgetFlags |= WidgetFlags.NoWindow;

            button_widget = buttonWidget;
            Menu = menu;

            toggle_button.Parent = this;
            toggle_button.FocusOnClick = false;
            toggle_button.Relief = ReliefStyle.None;
            toggle_button.Pressed += delegate { ShowMenu (); toggle_button.Active = true; };
            toggle_button.Activated += delegate { ShowMenu (); };

            box.Parent = this;

            if (showArrow) {
                box.PackStart (button_widget, true, true, 0);
                alignment = new Alignment (0f, 0.5f, 0f, 0f);
                arrow = new Arrow (ArrowType.Down, ShadowType.None);
                alignment.Add (arrow);
                box.PackStart (alignment, false, false, 5);
                size_widget = box;
                FocusChain = new Widget[] {toggle_button, box};
                alignment.ShowAll ();
                alignment.NoShowAll = true;
            } else {
                toggle_button.Add (button_widget);
                size_widget = toggle_button;
            }

            ShowAll ();
        }
Exemplo n.º 6
0
        public TIcon(CInterfaceGateway in_krnGateway, Gtk.Window mwindow)
        {
            krnGateway = in_krnGateway;
            mainwindow = mwindow;

             	menu = new Gtk.Menu ();
               		EventBox eb = new EventBox ();
            eb.ButtonPressEvent += new ButtonPressEventHandler (TIconClicked);
            eb.Add (new Gtk.Image (new Gdk.Pixbuf (null, "lPhant.png")));

            MenuItem it_show = new MenuItem ("Show");
            it_show.Activated += new EventHandler (TIconShow);

            MenuItem it_options = new MenuItem ("Options");
            it_options.Activated += new EventHandler (TIconOptions);

            ImageMenuItem it_quit = new ImageMenuItem("Quit");
            it_quit.Activated += new EventHandler (TIconQuit);

            menu.Append (it_show);
            menu.Append (it_options);
            menu.Append (it_quit);

               	   t = new TrayIcon ("eLePhantGTK");
               	   t.Add (eb);
               	   t.ShowAll ();
        }
Exemplo n.º 7
0
 public ParseTreeWindow(RuntimeThread runtimeThread) : base("Parse Tree")
 {
     runtimeThread.Runtime.ParseTrace.ParsedEvent += OnParsed;
     
     SetDefaultSize(250, 300);
     SkipPagerHint = true;
     SkipTaskbarHint = true;
     
     scroller = new ScrolledWindow();
     scroller.BorderWidth = 5;
     scroller.ShadowType = ShadowType.In;
     Add(scroller);
     
     store = new TreeStore(typeof(string), typeof(object));
     
     view = new TreeView(store);
     column = view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
     view.HeadersVisible = false;
     view.RowActivated += OnTreeRowActivated;
     view.ButtonPressEvent += OnTreeButtonPress;
     scroller.Add(view);
     
     MenuBuilder menuBuilder = new MenuBuilder();
     menu = menuBuilder.StartMenu();
     menuBuilder.Add("Show source", OnMenuShowSource);
     menuBuilder.Add("Show object", OnMenuShowObject);
     menu.ShowAll();
 }
Exemplo n.º 8
0
        static void HandleTrayIconPopupMenu(object o, PopupMenuArgs args)
        {
            Menu popupMenu = new Menu ();
            ImageMenuItem menuItemQuit = new ImageMenuItem ("Quit");

            ImageMenuItem menuItemEnabled;
            if(Preferences.Enabled)
            {
                menuItemEnabled = new ImageMenuItem ("Disable");
                menuItemEnabled.Image = new Gtk.Image (Gtk.Stock.Yes, IconSize.Menu);
            }
            else
            {
                // hopefully prevent any major mem leaks

                menuItemEnabled = new ImageMenuItem ("Enable");
                menuItemEnabled.Image = new Gtk.Image(Gtk.Stock.Yes, IconSize.Menu);
            }

            menuItemQuit.Image = new Gtk.Image (Gtk.Stock.Quit, IconSize.Menu);
            popupMenu.Add(menuItemQuit);
            popupMenu.Add(menuItemEnabled);

            menuItemQuit.Activated += delegate(object sender, EventArgs e) {
                Application.Quit();
            };
            menuItemEnabled.Activated += HandleMenuItemEnabledActivated;

            popupMenu.ShowAll();
            popupMenu.Popup();
        }
Exemplo n.º 9
0
		public static void Main21 (string[] args)
		{
			Application.Init();
			Window win = new Window ("Menu Sample App");
			win.DeleteEvent += new DeleteEventHandler (delete_cb);
			win.DefaultWidth = 200;
			win.DefaultHeight = 150;

			VBox box = new VBox (false, 2);

			MenuBar mb = new MenuBar ();
			Menu file_menu = new Menu ();
			MenuItem exit_item = new MenuItem("Exit");
			exit_item.Activated += new EventHandler (exit_cb);
			file_menu.Append (exit_item);
			MenuItem file_item = new MenuItem("File");
			file_item.Submenu = file_menu;
			mb.Append (file_item);
			box.PackStart(mb, false, false, 0);

			Button btn = new Button ("Yep, that's a menu");
			box.PackStart(btn, true, true, 0);
			
			win.Add (box);
			win.ShowAll ();

			Application.Run ();
		}
Exemplo n.º 10
0
        // create the context menu
        public VideoContextMenu()
            : base()
        {
            MenuItem aspect_ratio = new MenuItem ("Aspect Ratio");
            ImageMenuItem fullscreen = new ImageMenuItem (Stock.Fullscreen, null);

            Menu aspect_menu = new Menu ();
            aspect_auto = new RadioMenuItem ("Auto");
            aspect_4x3 = new RadioMenuItem (aspect_auto, "4:3");
            aspect_16x9 = new RadioMenuItem (aspect_auto, "16:9");
            aspect_16x10 = new RadioMenuItem (aspect_auto, "16:10");

            aspect_menu.Add (aspect_auto);
            aspect_menu.Add (aspect_4x3);
            aspect_menu.Add (aspect_16x9);
            aspect_menu.Add (aspect_16x10);

            aspect_ratio.Submenu = aspect_menu;

            this.Add (aspect_ratio);

            showVisualisations ();

            this.Add (new SeparatorMenuItem ());
            this.Add (fullscreen);

            fullscreen.Activated += fullscreen_activated;

            aspect_auto.ButtonReleaseEvent += aspect_auto_toggled;
            aspect_4x3.ButtonReleaseEvent += aspect_4x3_toggled;
            aspect_16x9.ButtonReleaseEvent += aspect_16x9_toggled;
            aspect_16x10.ButtonReleaseEvent += aspect_16x10_toggled;

            toggle_aspect_value ();
        }
Exemplo n.º 11
0
		private Menu CreateMenu (int depth, bool tearoff)
		{
			if (depth < 1)
				return null;

			Menu menu = new Menu ();
			RadioMenuItem[] group = null;

			if (tearoff) {
				TearoffMenuItem menuitem = new TearoffMenuItem ();
				menu.Append (menuitem);
			}

			for (int i = 0, j = 1; i < 5; i++, j++) {
				RadioMenuItem menuitem = new RadioMenuItem (group, String.Format ("item {0} - {1}", depth, j));
				group = menuitem.Group;

				menu.Append (menuitem);
				if (i == 3)
					menuitem.Sensitive = false;

				menuitem.Submenu = CreateMenu ((depth - 1), true);
			}

			return menu;
		}
        public EquipmentReceptionView()
        {
            this.Build();

            ytreeEquipment.ColumnsConfig = Gamma.GtkWidgets.ColumnsConfigFactory.Create<ReceptionEquipmentItemNode> ()
                .AddColumn ("Номенклатура").AddTextRenderer (node => node.Name)
                .AddColumn ("Серийный номер").AddTextRenderer (node => node.Serial)
                .AddColumn ("Кол-во")
                .AddToggleRenderer (node => node.Returned, false)
                .AddNumericRenderer (node => node.Amount, false)
                .AddColumn("Номер заявки на сервис")
                .AddTextRenderer(
                    node => node.ServiceClaim != null
                    ? node.ServiceClaim.Id.ToString()
                    : "")
                .AddColumn("")
                .Finish ();

            ytreeEquipment.Selection.Changed += YtreeEquipment_Selection_Changed;
            ytreeEquipment.ItemsDataSource = ReceptionEquipmentList;

            //Создаем меню в кнопке выбора СН
            var menu = new Menu();
            menuitemRegisterSerial = new MenuItem("Зарегистрировать новый СН");
            menuitemRegisterSerial.Activated += MenuitemRegisterSerial_Activated;
            menu.Add(menuitemRegisterSerial);
            menuitemSelectFromClient = new MenuItem("Выбрать по клиенту");
            menuitemSelectFromClient.Activated += MenuitemSelectFromClient_Activated;
            menu.Add(menuitemSelectFromClient);
            var menuitemSelectFromUnused = new MenuItem("Незадействованные СН");
            menuitemSelectFromUnused.Activated += MenuitemSelectFromUnused_Activated;
            menu.Add(menuitemSelectFromUnused);
            menu.ShowAll();
            buttonSelectSerial.Menu = menu;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Create a global keybinder for the given Gtk.AccelGroup.
        /// </summary>
        /// </param>
        public GlobalKeybinder(Gtk.AccelGroup accel_group)
        {
            this.accel_group = accel_group;

            fake_menu = new Gtk.Menu ();
            fake_menu.AccelGroup = accel_group;
        }
		Gtk.MenuBar CreateMenus ()
		{
			AccelGroup group = new AccelGroup ();
			MenuBar bar = new MenuBar ();
			
			Menu file_menu = new Menu ();
			MenuItem file_menu_item = new MenuItem ("_File");
			file_menu_item.Submenu = file_menu;
			
			ImageMenuItem file_exit = new ImageMenuItem (Gtk.Stock.Quit, group);
			file_exit.Activated += new EventHandler (exit_cb);
			file_menu.Append (file_exit);
			bar.Append (file_menu_item);

			Menu help_menu = new Menu ();
			ImageMenuItem help_menu_item = new ImageMenuItem (Gtk.Stock.Help, group);
			help_menu_item.Submenu = help_menu;
			
			ImageMenuItem file_help = new ImageMenuItem (Gnome.Stock.About, group);
			file_help.Activated += new EventHandler (about_cb);
			help_menu.Append (file_help);
			bar.Append (help_menu_item);
			bar.ShowAll ();

			return bar;
		}
Exemplo n.º 15
0
		public DockNotebook ()
		{
			pagesCol = new ReadOnlyCollection<IDockNotebookTab> (pages);
			AddEvents ((Int32)(EventMask.AllEventsMask));

			tabStrip = new TabStrip (this);

			PackStart (tabStrip, false, false, 0);

			contentBox = new EventBox ();
			PackStart (contentBox, true, true, 0);

			ShowAll ();

			tabStrip.DropDownButton.Sensitive = false;

			tabStrip.DropDownButton.MenuCreator = delegate {
				Gtk.Menu menu = new Menu ();
				foreach (var tab in pages) {
					var mi = new Gtk.ImageMenuItem ("");
					menu.Insert (mi, -1);
					var label = (Gtk.AccelLabel) mi.Child;
					if (tab.Markup != null)
						label.Markup = tab.Markup;
					else
						label.Text = tab.Text;
					var locTab = tab;
					mi.Activated += delegate {
						CurrentTab = locTab;
					};
				}
				menu.ShowAll ();
				return menu;
			};
		}
Exemplo n.º 16
0
        public MainWindow()
        {
            Build ();

            popupMenu = new Menu ();

            ImageMenuItem explore = new ImageMenuItem ("Explore");
            explore.Image = new Image (Stock.Open, IconSize.Menu);
            explore.Activated += Open;
            popupMenu.Add (explore);

            ImageMenuItem quit = new ImageMenuItem ("Exit");
            quit.Image = new Image (Stock.Quit, IconSize.Menu);
            quit.Activated += (object sender, EventArgs e) => {
                Application.Quit ();
            };
            popupMenu.Add (quit);

            statusIcon = new StatusIcon ();
            statusIcon.Pixbuf = c.Icon.Bitmap.ToPixbuf ();
            statusIcon.Activate += Open;
            statusIcon.PopupMenu += (object o, PopupMenuArgs args) => {
                popupMenu.ShowAll ();
                popupMenu.Popup ();
            };
            statusIcon.Tooltip = c.Icon.Tooltip;
            statusIcon.Visible = true;
        }
Exemplo n.º 17
0
    public void Activate(Gdk.EventButton eb, Tag tag, Tag [] tags)
    {
        int photo_count = App.Instance.Organizer.SelectedPhotos().Length;
        int tags_count  = tags.Length;

        Gtk.Menu popup_menu = new Gtk.Menu();

        GtkUtil.MakeMenuItem(popup_menu,
                             String.Format(Catalog.GetPluralString("Find", "Find", tags.Length), tags.Length),
                             "gtk-add",
                             new EventHandler(App.Instance.Organizer.HandleIncludeTag),
                             true
                             );

        FSpot.TermMenuItem.Create(tags, popup_menu);

        GtkUtil.MakeMenuSeparator(popup_menu);

        GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Create New Tag..."), "tag-new",
                             App.Instance.Organizer.HandleCreateNewCategoryCommand, true);

        GtkUtil.MakeMenuSeparator(popup_menu);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetString("Edit Tag..."), "gtk-edit",
                             delegate {
            App.Instance.Organizer.HandleEditSelectedTagWithTag(tag);
        }, tag != null && tags_count == 1);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetPluralString("Delete Tag", "Delete Tags", tags_count), "gtk-delete",
                             new EventHandler(App.Instance.Organizer.HandleDeleteSelectedTagCommand), tag != null);

        GtkUtil.MakeMenuSeparator(popup_menu);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetPluralString("Attach Tag to Selection", "Attach Tags to Selection", tags_count), "gtk-add",
                             new EventHandler(App.Instance.Organizer.HandleAttachTagCommand), tag != null && photo_count > 0);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetPluralString("Remove Tag From Selection", "Remove Tags From Selection", tags_count), "gtk-remove",
                             new EventHandler(App.Instance.Organizer.HandleRemoveTagCommand), tag != null && photo_count > 0);

        if (tags_count > 1 && tag != null)
        {
            GtkUtil.MakeMenuSeparator(popup_menu);

            GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Merge Tags"),
                                 new EventHandler(App.Instance.Organizer.HandleMergeTagsCommand), true);
        }

        if (eb != null)
        {
            popup_menu.Popup(null, null, null, eb.Button, eb.Time);
        }
        else
        {
            popup_menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
        }
    }
Exemplo n.º 18
0
 public ConnectionMenu(TreeView connectionList)
 {
     this.connectionList = connectionList;
     Glade.XML xmlMnuConnections = new Glade.XML(null, "FileFind.Meshwork.GtkClient.meshwork.glade", "mnuConnections", null);
     mnuConnections = (xmlMnuConnections.GetWidget("mnuConnections") as Gtk.Menu);
     xmlMnuConnections.Autoconnect (this);
 }
Exemplo n.º 19
0
        public VolatileReader()
            : base("Volatile Reader")
        {
            this.Build ();
            SetDefaultSize(250,200);
            SetPosition(Gtk.WindowPosition.Center);
            DeleteEvent += delegate(object o, DeleteEventArgs args) {
                Application.Quit();
            };

            MenuBar bar = new MenuBar();

            Menu fileMenu  = new Menu();
            MenuItem fileMenuItem = new MenuItem("File");
            fileMenuItem.Submenu = fileMenu;

            MenuItem exit = new MenuItem("Exit");
            exit.Activated += delegate(object sender, EventArgs e) {
                Application.Quit();
            };

            MenuItem openFile = new MenuItem("Open file...");
            openFile.Activated += OpenFile;

            fileMenu.Append(openFile);
            fileMenu.Append(exit);

            bar.Append(fileMenuItem);

            _vbox = new VBox(false, 2);
            _vbox.PackStart(bar, false, false, 0);

            this.Add(_vbox);
            this.ShowAll();
        }
Exemplo n.º 20
0
    public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string l, EventHandler e, bool enabled)
    {
        Gtk.MenuItem  i;
        Gtk.StockItem item = Gtk.StockItem.Zero;

        if (Gtk.StockManager.Lookup(l, ref item))
        {
            i = new Gtk.ImageMenuItem(l, new Gtk.AccelGroup());
        }
        else
        {
            i = new Gtk.MenuItem(l);
        }

        if (e != null)
        {
            i.Activated += e;
        }

        i.Sensitive = enabled;

        menu.Append(i);
        i.Show();

        return(i);
    }
Exemplo n.º 21
0
		public void Initialize (DockFrame workspace, Menu padMenu)
		{
			var layers = new LayersListWidget ();
			DockItem layers_item = workspace.AddItem ("Layers");
			DockItemToolbar layers_tb = layers_item.GetToolbar (PositionType.Bottom);

			layers_item.Label = Catalog.GetString ("Layers");
			layers_item.Content = layers;
			layers_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.MergeLayerDown.png");
            layers_item.DefaultWidth = 100;

			layers_tb.Add (PintaCore.Actions.Layers.AddNewLayer.CreateDockToolBarItem ());
			layers_tb.Add (PintaCore.Actions.Layers.DeleteLayer.CreateDockToolBarItem ());
			layers_tb.Add (PintaCore.Actions.Layers.DuplicateLayer.CreateDockToolBarItem ());
			layers_tb.Add (PintaCore.Actions.Layers.MergeLayerDown.CreateDockToolBarItem ());
			layers_tb.Add (PintaCore.Actions.Layers.MoveLayerUp.CreateDockToolBarItem ());
			layers_tb.Add (PintaCore.Actions.Layers.MoveLayerDown.CreateDockToolBarItem ());

			Gtk.ToggleAction show_layers = padMenu.AppendToggleAction ("Layers", Catalog.GetString ("Layers"), null, "Menu.Layers.MergeLayerDown.png");
			show_layers.Activated += delegate { layers_item.Visible = show_layers.Active; };
			layers_item.VisibleChanged += delegate { show_layers.Active = layers_item.Visible; };

			show_layers.Active = layers_item.Visible;

			PintaCore.Workspace.ActiveDocumentChanged += delegate { layers.Reset (); };
		}
Exemplo n.º 22
0
        public SearchEntry()
            : base()
        {
            ChangeTimeoutMs = 25;

            menu = new Menu ();
        }
Exemplo n.º 23
0
 public ImageMenuItem AddImageItem(string stock_id, Menu subMenu)
 {
     ImageMenuItem item = new ImageMenuItem(stock_id, null);
     item.Submenu = subMenu;
     Append(item);
     return(item);
 }
Exemplo n.º 24
0
        public void CreateMainMenu(Gtk.Menu menu)
        {
            addins_menu = menu;

            menu.Append (AddinManager.CreateMenuItem ());
            menu.AppendSeparator ();
        }
Exemplo n.º 25
0
 public GrammarWindow(RuntimeThread runtimeThread) : base("Grammar")
 {
     runtimeThread.Runtime.Grammar.Trace.PatternDefinedEvent += OnGrammarPatternDefined;
     runtimeThread.Runtime.Grammar.Trace.PatternChangedEvent += OnGrammarPatternChanged;
     
     SetDefaultSize(250, 300);
     SkipPagerHint = true;
     SkipTaskbarHint = true;
     
     scroller = new ScrolledWindow();
     scroller.BorderWidth = 5;
     scroller.ShadowType = ShadowType.In;
     Add(scroller);
     
     store = new TreeStore(typeof(string), typeof(Source));
     
     // FIXME - only want to sort top level
     
     //TreeModelSort storeSort = new TreeModelSort(store);
     //storeSort.SetSortColumnId(0, SortType.Ascending);
     
     view = new TreeView(store);
     
     view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
     view.HeadersVisible = false;
     view.RowActivated += OnTreeRowActivated;
     view.ButtonPressEvent += OnTreeButtonPress;
     scroller.Add(view);
     
     MenuBuilder menuBuilder = new MenuBuilder();
     menu = menuBuilder.StartMenu();
     menuBuilder.Add("Show source", OnMenuShowSource);
     menuBuilder.Add("Show object", OnMenuShowObject);
     menu.ShowAll();
 }
Exemplo n.º 26
0
        public MenuBarController()
        {
            MenuBar mb = new MenuBar();

            Menu filemenu = new Menu();
            MenuItem file = new MenuItem("File");
            file.Submenu = filemenu;

            ImageMenuItem importDirectoryMenuItem = new ImageMenuItem("Import Directory");
            importDirectoryMenuItem.Activated += ImportDirectoryMenuItemOnActivated;
            filemenu.Append(importDirectoryMenuItem);

            ImageMenuItem open = new ImageMenuItem(Stock.Open);
            filemenu.Append(open);

            SeparatorMenuItem sep = new SeparatorMenuItem();
            filemenu.Append(sep);

            ImageMenuItem exit = new ImageMenuItem(Stock.Quit);

            exit.Activated += (sender, args) => Application.Quit();
            filemenu.Append(exit);

            mb.Append(file);
            View = mb;
        }
Exemplo n.º 27
0
		void Position (Menu menu, out int x, out int y, out bool push_in)
		{
			this.GdkWindow.GetOrigin (out x, out y);
			x += Allocation.X;
			y += Allocation.Y + Allocation.Height;
			push_in = false;
			menu.WidthRequest = Allocation.Width;
		}
Exemplo n.º 28
0
 public PlayerMenu()
 {
     playerMenu = new Menu ();
     addToPlaylistMenu = new MenuItem ("");
     playerMenu.Add (addToPlaylistMenu);
     exportToVideoFile = new MenuItem ("");
     exportToVideoFile.Add (exportToVideoFile);
 }
Exemplo n.º 29
0
		public void PresentMenu (Menu menu, uint button, uint activate_time) 
		{
			if (StatusIconPositionMenuFunc == null)
				// gtk_status_icon_position_menu already defined by autogenerated code
				StatusIconPositionMenuFunc = new MenuPositionFuncNative (gtk_status_icon_position_menu);

			gtk_menu_popup (menu == null ? IntPtr.Zero : menu.Handle, IntPtr.Zero, IntPtr.Zero, StatusIconPositionMenuFunc, Handle, button, activate_time);
		}
Exemplo n.º 30
0
		public void CreateMainMenu (Gtk.Menu menu)
		{
			window_menu = menu;

			menu.Append (SaveAll.CreateAcceleratedMenuItem (Gdk.Key.A, Gdk.ModifierType.Mod1Mask | Gdk.ModifierType.ControlMask));
			menu.Append (CloseAll.CreateAcceleratedMenuItem (Gdk.Key.W, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
			menu.AppendSeparator ();
		}
Exemplo n.º 31
0
        public static Gtk.MenuItem CreateSubMenuItem(this Gtk.Action action)
        {
            MenuItem item = (MenuItem)action.CreateMenuItem ();

            Menu sub_menu = new Menu ();
            item.Submenu = sub_menu;

            return item;
        }
Exemplo n.º 32
0
Arquivo: Tray.cs Projeto: GNOME/nemo
        private void popupMenuHandler(object o, Gtk.PopupMenuArgs args)
        {
            Menu popupMenu = new Menu();

            // add show
              			ImageMenuItem menuPopup1;
              			if (hidden)
              				menuPopup1 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Show window"));
            else
              				menuPopup1 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Hide window"));
              			menuPopup1.Image = new Image(Stock.Refresh, IconSize.Menu);
              			popupMenu.Add(menuPopup1);
              			menuPopup1.Activated += delegate {
              				if (hidden)
              				{
                    main_window.ShowAll();
                    restore_position();
                    hidden = false;
                    main_window.Unref(); // restore correct reference count
              				}
              				else
              				{
                    hide_window();
              				}
              			};

              			ImageMenuItem menuPopup0 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Indexing status"));
              			popupMenu.Add(menuPopup0);
              			menuPopup0.Activated += delegate {
                Singleton<Indexing>.Instance.Show();
              			};

              			ImageMenuItem menuPopup2 = new ImageMenuItem(Mono.Unix.Catalog.GetString("About"));
              			menuPopup2.Image = new Image(Stock.About, IconSize.Menu);
              			popupMenu.Add(menuPopup2);
              			menuPopup2.Activated += delegate {
                Gtk.AboutDialog about = new AboutDialog();
                about.Name = "Nemo";
                about.Authors = new string[] { "Anders Rune Jensen", "Lau Bech Lauritzen", "Ole Laursen" };
                about.Artists = new string[] { "Linda Nhu", "Sune Theodorsen" };
                about.Comments = Mono.Unix.Catalog.GetString("Nemo is a file manager for those who would rather have their files manage themselves.");
                about.Logo = new Gdk.Pixbuf(null, "blue_guy_med.png");
                about.Response += delegate {
                    about.Destroy();
                };
                about.Show();
              			};

            // add quit
              			ImageMenuItem menuPopup3 = new ImageMenuItem (Mono.Unix.Catalog.GetString("Quit"));
              			menuPopup3.Image = new Image(Stock.Quit, IconSize.Menu);
              			popupMenu.Add(menuPopup3);
              			menuPopup3.Activated += new EventHandler(this.OnPopupClick);

            popupMenu.ShowAll();
              			popupMenu.Popup(null, null, null, (uint)args.Args[0], (uint)args.Args[1]);
        }
Exemplo n.º 33
0
    public static void MakeMenuItem(Gtk.Menu menu, string l, EventHandler e, bool enabled)
    {
        Gtk.MenuItem i = new Gtk.MenuItem(l);
        i.Activated += e;
        i.Sensitive  = enabled;

        menu.Append(i);
        i.Show();
    }
Exemplo n.º 34
0
    public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string label, string image_name, EventHandler e, bool enabled)
    {
        Gtk.ImageMenuItem i = new Gtk.ImageMenuItem(label);
        i.Activated += e;
        i.Sensitive  = enabled;
        i.Image      = new Gtk.Image(image_name, Gtk.IconSize.Menu);

        menu.Append(i);
        i.Show();

        return(i);
    }
Exemplo n.º 35
0
    public static Gtk.MenuItem MakeCheckMenuItem(Gtk.Menu menu, string label, EventHandler e, bool enabled, bool active, bool as_radio)
    {
        Gtk.CheckMenuItem i = new Gtk.CheckMenuItem(label);
        i.Activated  += e;
        i.Sensitive   = enabled;
        i.DrawAsRadio = as_radio;
        i.Active      = active;

        menu.Append(i);
        i.Show();

        return(i);
    }
Exemplo n.º 36
0
    private void popupMenu()
    {
        Gtk.Menu popupMenu = new Gtk.Menu();

        foreach (Sector sector in level.Sectors)
        {
            Gtk.MenuItem item = new Gtk.MenuItem(sector.Name);
            item.Name       = sector.Name;
            item.Activated += OnSectorItemActivated;
            popupMenu.Add(item);
        }
        popupMenu.Add(new Gtk.SeparatorMenuItem());

        Gtk.MenuItem propertiesItem = new Gtk.ImageMenuItem(Gtk.Stock.Properties, null);
        propertiesItem.Activated += OnPropertiesActivated;
        popupMenu.Add(propertiesItem);

        Gtk.ImageMenuItem camPropsItem = new Gtk.ImageMenuItem("Camera Properties");
        camPropsItem.Activated += OnCameraPropertiesActivated;
        //camPropsItem.Image = Image(EditorStock.CameraMenuImage); //TODO: find out how to set custom image
        popupMenu.Add(camPropsItem);

        Gtk.MenuItem resizeItem = new Gtk.MenuItem("Resize");
        resizeItem.Activated += OnResizeActivated;
        popupMenu.Add(resizeItem);

        Gtk.MenuItem createNewItem = new Gtk.ImageMenuItem(Gtk.Stock.New, null);
        createNewItem.Activated += OnCreateNew;
        popupMenu.Add(createNewItem);

        Gtk.MenuItem deleteItem = new Gtk.ImageMenuItem(Gtk.Stock.Delete, null);
        deleteItem.Activated += OnDeleteActivated;
        popupMenu.Add(deleteItem);

        Gtk.MenuItem CheckIDsItem = new Gtk.MenuItem("Check all tilemaps for bad tile IDs");
        CheckIDsItem.Activated += OnCheckIDs;
        popupMenu.Append(CheckIDsItem);

        popupMenu.ShowAll();
        popupMenu.Popup();
    }
Exemplo n.º 37
0
 public static void MakeMenuItem(Gtk.Menu menu, string l, EventHandler e)
 {
     MakeMenuItem(menu, l, e, true);
 }
Exemplo n.º 38
0
        void PopupQuickFixMenu(Gdk.EventButton evt, Action <Gtk.Menu> menuAction)
        {
            var menu = new Gtk.Menu();

            menu.Events |= Gdk.EventMask.AllEventsMask;
            Gtk.Menu      fixMenu = menu;
            ResolveResult resolveResult;

            ICSharpCode.NRefactory.CSharp.AstNode node;
            int items = 0;

            if (ResolveCommandHandler.ResolveAt(document, out resolveResult, out node))
            {
                var possibleNamespaces = MonoDevelop.Refactoring.ResolveCommandHandler.GetPossibleNamespaces(
                    document,
                    node,
                    ref resolveResult
                    );

                foreach (var t in possibleNamespaces.Where(tp => tp.OnlyAddReference))
                {
                    var menuItem = new Gtk.MenuItem(t.GetImportText());
                    menuItem.Activated += delegate {
                        new ResolveCommandHandler.AddImport(document, resolveResult, null, t.Reference, true, node).Run();
                        menu.Destroy();
                    };
                    menu.Add(menuItem);
                    items++;
                }

                bool addUsing = !(resolveResult is AmbiguousTypeResolveResult);
                if (addUsing)
                {
                    foreach (var t in possibleNamespaces.Where(tp => tp.IsAccessibleWithGlobalUsing))
                    {
                        string ns        = t.Namespace;
                        var    reference = t.Reference;
                        var    menuItem  = new Gtk.MenuItem(t.GetImportText());
                        menuItem.Activated += delegate {
                            new ResolveCommandHandler.AddImport(document, resolveResult, ns, reference, true, node).Run();
                            menu.Destroy();
                        };
                        menu.Add(menuItem);
                        items++;
                    }
                }

                bool resolveDirect = !(resolveResult is UnknownMemberResolveResult);
                if (resolveDirect)
                {
                    foreach (var t in possibleNamespaces)
                    {
                        string ns        = t.Namespace;
                        var    reference = t.Reference;
                        var    menuItem  = new Gtk.MenuItem(t.GetInsertNamespaceText(document.Editor.GetTextBetween(node.StartLocation, node.EndLocation)));
                        menuItem.Activated += delegate {
                            new ResolveCommandHandler.AddImport(document, resolveResult, ns, reference, false, node).Run();
                            menu.Destroy();
                        };
                        menu.Add(menuItem);
                        items++;
                    }
                }

                if (menu.Children.Any() && Fixes.Any())
                {
                    fixMenu = new Gtk.Menu();
                    var menuItem = new Gtk.MenuItem(GettextCatalog.GetString("Quick Fixes"));
                    menuItem.Submenu = fixMenu;
                    menu.Add(menuItem);
                    items++;
                }
            }

            PopulateFixes(fixMenu, ref items);
            if (items == 0)
            {
                menu.Destroy();
                return;
            }
            document.Editor.SuppressTooltips = true;
            document.Editor.Parent.HideTooltip();
            if (menuAction != null)
            {
                menuAction(menu);
            }
            menu.ShowAll();
            menu.SelectFirst(true);
            menu.Hidden += delegate {
                document.Editor.SuppressTooltips = false;
            };
            var container = document.Editor.Parent;

            var p    = container.LocationToPoint(currentSmartTagBegin);
            var rect = new Gdk.Rectangle(
                p.X + container.Allocation.X,
                p.Y + (int)document.Editor.LineHeight + container.Allocation.Y, 0, 0);

            GtkWorkarounds.ShowContextMenu(menu, document.Editor.Parent, null, rect);
        }
Exemplo n.º 39
0
        public void PopulateFixes(Gtk.Menu menu, ref int items)
        {
            int  mnemonic = 1;
            bool gotImportantFix = false, addedSeparator = false;
            var  fixesAdded = new List <string> ();

            foreach (var fix_ in Fixes.OrderByDescending(i => Tuple.Create(IsAnalysisOrErrorFix(i), (int)i.Severity, GetUsage(i.IdString))))
            {
                // filter out code actions that are already resolutions of a code issue
                if (fixesAdded.Any(f => fix_.IdString.IndexOf(f, StringComparison.Ordinal) >= 0))
                {
                    continue;
                }
                fixesAdded.Add(fix_.IdString);
                if (IsAnalysisOrErrorFix(fix_))
                {
                    gotImportantFix = true;
                }
                if (!addedSeparator && gotImportantFix && !IsAnalysisOrErrorFix(fix_))
                {
                    menu.Add(new Gtk.SeparatorMenuItem());
                    addedSeparator = true;
                }

                var fix          = fix_;
                var escapedLabel = fix.Title.Replace("_", "__");
                var label        = (mnemonic <= 10)
                                        ? "_" + (mnemonic++ % 10).ToString() + " " + escapedLabel
                                        : "  " + escapedLabel;
                var thisInstanceMenuItem = new MenuItem(label);
                thisInstanceMenuItem.Activated += new ContextActionRunner(fix, document, currentSmartTagBegin).Run;
                thisInstanceMenuItem.Activated += delegate {
                    ConfirmUsage(fix.IdString);
                    menu.Destroy();
                };
                menu.Add(thisInstanceMenuItem);
                items++;
            }

            bool first             = true;
            var  settingsMenuFixes = Fixes
                                     .OfType <AnalysisContextActionProvider.AnalysisCodeAction> ()
                                     .Where(f => f.Result is InspectorResults)
                                     .GroupBy(f => ((InspectorResults)f.Result).Inspector);

            foreach (var analysisFixGroup_ in settingsMenuFixes)
            {
                var analysisFixGroup    = analysisFixGroup_;
                var arbitraryFixInGroup = analysisFixGroup.First();
                var ir = (InspectorResults)arbitraryFixInGroup.Result;

                if (first)
                {
                    menu.Add(new Gtk.SeparatorMenuItem());
                    first = false;
                }

                var subMenu = new Gtk.Menu();
                foreach (var analysisFix_ in analysisFixGroup)
                {
                    var analysisFix = analysisFix_;
                    if (analysisFix.SupportsBatchRunning)
                    {
                        var batchRunMenuItem = new Gtk.MenuItem(string.Format(GettextCatalog.GetString("Apply in file: {0}"), analysisFix.Title));
                        batchRunMenuItem.Activated += delegate {
                            ConfirmUsage(analysisFix.IdString);
                            menu.Destroy();
                        };
                        batchRunMenuItem.Activated += new ContextActionRunner(analysisFix, document, this.currentSmartTagBegin).BatchRun;
                        subMenu.Add(batchRunMenuItem);
                        subMenu.Add(new Gtk.SeparatorMenuItem());
                    }
                }

                var inspector = ir.Inspector;
                if (inspector.CanSuppressWithAttribute)
                {
                    var menuItem = new Gtk.MenuItem(GettextCatalog.GetString("_Suppress with attribute"));
                    menuItem.Activated += delegate {
                        inspector.SuppressWithAttribute(document, arbitraryFixInGroup.DocumentRegion);
                    };
                    subMenu.Add(menuItem);
                }

                if (inspector.CanDisableWithPragma)
                {
                    var menuItem = new Gtk.MenuItem(GettextCatalog.GetString("_Suppress with #pragma"));
                    menuItem.Activated += delegate {
                        inspector.DisableWithPragma(document, arbitraryFixInGroup.DocumentRegion);
                    };
                    subMenu.Add(menuItem);
                }

                if (inspector.CanDisableOnce)
                {
                    var menuItem = new Gtk.MenuItem(GettextCatalog.GetString("_Disable Once"));
                    menuItem.Activated += delegate {
                        inspector.DisableOnce(document, arbitraryFixInGroup.DocumentRegion);
                    };
                    subMenu.Add(menuItem);
                }

                if (inspector.CanDisableAndRestore)
                {
                    var menuItem = new Gtk.MenuItem(GettextCatalog.GetString("Disable _and Restore"));
                    menuItem.Activated += delegate {
                        inspector.DisableAndRestore(document, arbitraryFixInGroup.DocumentRegion);
                    };
                    subMenu.Add(menuItem);
                }
                var label       = GettextCatalog.GetString("_Options for \"{0}\"", InspectorResults.GetTitle(ir.Inspector));
                var subMenuItem = new Gtk.MenuItem(label);

                var optionsMenuItem = new Gtk.MenuItem(GettextCatalog.GetString("_Configure Rule"));
                optionsMenuItem.Activated += arbitraryFixInGroup.ShowOptions;

                optionsMenuItem.Activated += delegate {
                    menu.Destroy();
                };
                subMenu.Add(optionsMenuItem);
                subMenuItem.Submenu = subMenu;
                menu.Add(subMenuItem);
                items++;
            }
        }
Exemplo n.º 40
0
 public void CreateMainMenu(Gtk.Menu menu)
 {
     effects_menu = menu;
 }
        public DefaultPolicyOptionsDialog(Gtk.Window parentWindow)
            : base(parentWindow, new PolicySet(),
                   "/MonoDevelop/ProjectModel/Gui/DefaultPolicyPanels")
        {
            this.Title = GettextCatalog.GetString("Custom Policies");
            editingSet = (PolicySet)DataObject;

            HBox topBar = new HBox();

            topBar.Spacing = 3;
            topBar.PackStart(new Label(GettextCatalog.GetString("Editing Policy:")), false, false, 0);

            policiesCombo = ComboBox.NewText();
            topBar.PackStart(policiesCombo, false, false, 0);

            deleteButton = new Button(GettextCatalog.GetString("Delete Policy"));
            topBar.PackEnd(deleteButton, false, false, 0);

            exportButton             = new MenuButton();
            exportButton.Label       = GettextCatalog.GetString("Export");
            exportButton.MenuCreator = delegate {
                Gtk.Menu menu = new Gtk.Menu();
                MenuItem mi   = new MenuItem(GettextCatalog.GetString("To file..."));
                mi.Activated += HandleToFile;
                menu.Insert(mi, -1);
                mi            = new MenuItem(GettextCatalog.GetString("To project or solution..."));
                mi.Activated += HandleToProject;
                if (!IdeApp.Workspace.IsOpen)
                {
                    mi.Sensitive = false;
                }
                menu.Insert(mi, -1);
                menu.ShowAll();
                return(menu);
            };
            topBar.PackEnd(exportButton, false, false, 0);

            newButton             = new MenuButton();
            newButton.Label       = GettextCatalog.GetString("Add Policy");
            newButton.MenuCreator = delegate {
                Gtk.Menu menu = new Gtk.Menu();
                MenuItem mi   = new MenuItem(GettextCatalog.GetString("New policy..."));
                mi.Activated += HandleNewButtonClicked;
                menu.Insert(mi, -1);
                mi            = new MenuItem(GettextCatalog.GetString("From file..."));
                mi.Activated += HandleFromFile;
                menu.Insert(mi, -1);
                mi            = new MenuItem(GettextCatalog.GetString("From project or solution..."));
                mi.Activated += HandleFromProject;
                if (!IdeApp.Workspace.IsOpen)
                {
                    mi.Sensitive = false;
                }
                menu.Insert(mi, -1);
                menu.ShowAll();
                return(menu);
            };
            topBar.PackEnd(newButton, false, false, 0);

            Alignment align = new Alignment(0f, 0f, 1f, 1f);

            align.LeftPadding   = 9;
            align.TopPadding    = 9;
            align.RightPadding  = 9;
            align.BottomPadding = 9;
            align.Add(topBar);

            HeaderBox ebox = new HeaderBox();

            ebox.GradientBackground = true;
            ebox.SetMargins(0, 1, 0, 0);
            ebox.Add(align);

            ebox.ShowAll();

            VBox.PackStart(ebox, false, false, 0);
            VBox.BorderWidth = 0;
            Box.BoxChild c = (Box.BoxChild)VBox [ebox];
            c.Position = 0;

            foreach (PolicySet ps in PolicyService.GetUserPolicySets())
            {
                PolicySet copy = ps.Clone();
                originalSets [copy] = ps;
                sets.Add(copy);
            }
            FillPolicySets();

            policiesCombo.Changed += HandlePoliciesComboChanged;
            deleteButton.Clicked  += HandleDeleteButtonClicked;
        }
Exemplo n.º 42
0
        void MiniScreenSettings()
        {
            Console.WriteLine("Right Click");

            Gtk.Menu     menu_settings = new Gtk.Menu();
            Gtk.MenuItem menuitem1     = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("MiniScreen Resolution"));
            menu_settings.Append(menuitem1);
            // Submenu 1
            Gtk.Menu     menu_dim    = new Gtk.Menu();
            Gtk.MenuItem menuitem1_0 = new Gtk.MenuItem("300 x 240 (5:4)");
            menu_dim.Append(menuitem1_0);
            menuitem1_0.Show();
            menuitem1.Submenu = menu_dim;

            Gtk.MenuItem menuitem1_1 = new Gtk.MenuItem("400 x 320 (5:4)");
            menu_dim.Append(menuitem1_1);
            menuitem1_1.Show();

            Gtk.MenuItem menuitem1_6 = new Gtk.MenuItem("400 x 235 (16:9)");
            menu_dim.Append(menuitem1_6);
            menuitem1_6.Show();

            Gtk.MenuItem menuitem1_7 = new Gtk.MenuItem("300 x 176 (16:9)");
            menu_dim.Append(menuitem1_7);
            menuitem1_7.Show();

            Gtk.MenuItem menuitem1_2 = new Gtk.MenuItem("300 x 225 (4:3)");
            menu_dim.Append(menuitem1_2);
            menuitem1_2.Show();

            Gtk.MenuItem menuitem1_3 = new Gtk.MenuItem("200 x 150 (4:3)");
            menu_dim.Append(menuitem1_3);
            menuitem1_3.Show();

            Gtk.MenuItem menuitem1_4 = new Gtk.MenuItem("300 x 166 (9:5)");
            menu_dim.Append(menuitem1_4);
            menuitem1_4.Show();

            Gtk.MenuItem menuitem1_5 = new Gtk.MenuItem("200 x 111 (9:5)");
            menu_dim.Append(menuitem1_5);
            menuitem1_5.Show();


            // Opcio refreshRate

            Gtk.MenuItem menuitemRefreshRate = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Set Refresh Rate"));
            menu_settings.Append(menuitemRefreshRate);

            Gtk.Menu     menu_ref_rate    = new Gtk.Menu();
            Gtk.MenuItem menuitem_ref_500 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("500 ms (high refresh rate)"));
            menu_ref_rate.Append(menuitem_ref_500);
            menuitem_ref_500.Show();
            menuitemRefreshRate.Submenu = menu_ref_rate;

            Gtk.MenuItem menuitem_ref_750 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("750 ms"));
            menu_ref_rate.Append(menuitem_ref_750);
            menuitem_ref_750.Show();

            Gtk.MenuItem menuitem_ref_1000 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("1000 ms"));
            menu_ref_rate.Append(menuitem_ref_1000);
            menuitem_ref_1000.Show();

            Gtk.MenuItem menuitem_ref_1500 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("1500 ms"));
            menu_ref_rate.Append(menuitem_ref_1500);
            menuitem_ref_1500.Show();

            Gtk.MenuItem menuitem_ref_2000 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("2000 ms (low refresh rate)"));
            menu_ref_rate.Append(menuitem_ref_2000);
            menuitem_ref_2000.Show();



            // Opció 2

            Gtk.MenuItem menuitem2 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Set path color"));
            menu_settings.Append(menuitem2);


            // Opció 3 - Submenú posició


            Gtk.Menu     menu_position = new Gtk.Menu();
            Gtk.MenuItem menuitem3     = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Window position"));
            menu_settings.Append(menuitem3);

            // Submenu 3
            Gtk.MenuItem menuitem3_0 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Left"));
            menu_position.Append(menuitem3_0);
            menuitem3_0.Show();
            menuitem3.Submenu = menu_position;

            Gtk.MenuItem menuitem3_1 = new Gtk.MenuItem(Mono.Unix.Catalog.GetString("Right"));
            menu_position.Append(menuitem3_1);
            menuitem3_1.Show();

            // Opció 4 - Eixir
            Gtk.ImageMenuItem menuitem4 = new Gtk.ImageMenuItem(Stock.Quit, grup);
            menuitem4.RenderIcon(Stock.Quit, IconSize.Menu, Mono.Unix.Catalog.GetString("Exit from MiniScreen"));
            menu_settings.Append(menuitem4);

            // Opció 5 - About


            //Gtk.MenuItem menuitem5=new Gtk.MenuItem(Mono.Unix.Catalog.GetString("About"));
            //Gtk.ImageMenuItem menuitem5=new Gtk.MenuItem((Mono.Unix.Catalog.GetString("About"));


            Gtk.ImageMenuItem menuitem5 = new Gtk.ImageMenuItem(Stock.About, grup);
            menuitem5.RenderIcon(Stock.About, IconSize.Menu, Mono.Unix.Catalog.GetString("About LliureX MiniScreen"));
            menu_settings.Append(menuitem5);

            menuitem1.Show();
            menuitemRefreshRate.Show();
            menuitem2.Show();
            menuitem3.Show();
            menuitem4.Show();
            menuitem5.ShowAll();
            menuitem5.Show();

            menu_settings.Popup();

            menuitem1_0.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_1.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_2.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_3.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_4.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_5.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_6.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;
            menuitem1_7.ButtonPressEvent += HandleMenuitem1ButtonPressEvent;


            menuitem_ref_500.ButtonPressEvent  += HandleMenuitem_ref_500ButtonPressEvent;
            menuitem_ref_750.ButtonPressEvent  += HandleMenuitem_ref_750ButtonPressEvent;
            menuitem_ref_1000.ButtonPressEvent += HandleMenuitem_ref_1000ButtonPressEvent;
            menuitem_ref_1500.ButtonPressEvent += HandleMenuitem_ref_1500ButtonPressEvent;
            menuitem_ref_2000.ButtonPressEvent += HandleMenuitem_ref_2000ButtonPressEvent;



            menuitem2.ButtonPressEvent += HandleMenuitem2ButtonPressEvent;

            menuitem3_0.ButtonPressEvent += HandleMenuitem3_0ButtonPressEvent;
            menuitem3_1.ButtonPressEvent += HandleMenuitem3_1ButtonPressEvent;
            menuitem4.ButtonPressEvent   += HandleMenuitem4ButtonPressEvent;
            menuitem5.ButtonPressEvent   += HandleMenuitem5ButtonPressEvent;
        }
Exemplo n.º 43
0
        private void ConfigureDlg()
        {
            notebook1.ShowTabs          = false;
            spinWeight.Sensitive        = false;
            spinVolume.Sensitive        = false;
            lblPercentForMaster.Visible = spinPercentForMaster.Visible = false;
            entryName.IsEditable        = true;
            radioInfo.Active            = true;

            ylabelCreationDate.Binding.AddFuncBinding(Entity, s => s.CreateDate.HasValue ? s.CreateDate.Value.ToString("dd.MM.yyyy HH:mm") : "", w => w.LabelProp).InitializeFromSource();
            ylabelCreatedBy.Binding.AddFuncBinding <Nomenclature>(Entity, s => GetUserEmployeeName(s.CreatedBy), w => w.LabelProp).InitializeFromSource();

            enumVAT.ItemsEnum = typeof(VAT);
            enumVAT.Binding.AddBinding(Entity, e => e.VAT, w => w.SelectedItem).InitializeFromSource();

            enumType.ItemsEnum = typeof(NomenclatureCategory);
            enumType.Binding.AddBinding(Entity, e => e.Category, w => w.SelectedItem).InitializeFromSource();

            enumTareVolume.ItemsEnum = typeof(TareVolume);
            enumTareVolume.Binding.AddBinding(Entity, e => e.TareVolume, w => w.SelectedItemOrNull).InitializeFromSource();
            ycheckDisposableTare.Binding.AddBinding(Entity, e => e.IsDisposableTare, w => w.Active).InitializeFromSource();

            yСolorBtnBottleCapColor.Binding.AddBinding(Entity, e => e.BottleCapColor, w => w.Color, new ColorTextToGdkColorConverter()).InitializeFromSource();
            yСolorBtnBottleCapColor.ColorSet += YСolorBtnBottleCapColorOnColorSet;

            enumSaleCategory.Visible   = Entity.Category == NomenclatureCategory.equipment;
            enumSaleCategory.ItemsEnum = typeof(SaleCategory);
            enumSaleCategory.Binding.AddBinding(Entity, e => e.SaleCategory, w => w.SelectedItemOrNull).InitializeFromSource();

            enumDepositType.Visible   = Entity.Category == NomenclatureCategory.deposit;
            enumDepositType.ItemsEnum = typeof(TypeOfDepositCategory);
            enumDepositType.Binding.AddBinding(Entity, e => e.TypeOfDepositCategory, w => w.SelectedItemOrNull).InitializeFromSource();

            comboMobileCatalog.ItemsEnum = typeof(MobileCatalog);
            comboMobileCatalog.Binding.AddBinding(Entity, e => e.MobileCatalog, w => w.SelectedItem).InitializeFromSource();

            lblSaleCategory.Visible = Nomenclature.GetCategoriesWithSaleCategory().Contains(Entity.Category);
            lblSubType.Visible      = Entity.Category == NomenclatureCategory.deposit;

            entryName.Binding.AddBinding(Entity, e => e.Name, w => w.Text).InitializeFromSource();
            yentryOfficialName.Binding.AddBinding(Entity, e => e.OfficialName, w => w.Text).InitializeFromSource();
            var parallel = new ParallelEditing(yentryOfficialName);

            parallel.SubscribeOnChanges(entryName);
            parallel.GetParallelTextFunc = GenerateOfficialName;

            ycheckRentPriority.Binding.AddBinding(Entity, e => e.RentPriority, w => w.Active).InitializeFromSource();
            checkNotReserve.Binding.AddBinding(Entity, e => e.DoNotReserve, w => w.Active).InitializeFromSource();
            checkcanPrintPrice.Binding.AddBinding(Entity, e => e.CanPrintPrice, w => w.Active).InitializeFromSource();
            labelCanPrintPrice.Visible = checkcanPrintPrice.Visible = Entity.Category == NomenclatureCategory.water && !Entity.IsDisposableTare;
            checkHide.Binding.AddBinding(Entity, e => e.Hide, w => w.Active).InitializeFromSource();
            entryCode1c.Binding.AddBinding(Entity, e => e.Code1c, w => w.Text).InitializeFromSource();
            yspinSumOfDamage.Binding.AddBinding(Entity, e => e.SumOfDamage, w => w.ValueAsDecimal).InitializeFromSource();
            spinWeight.Binding.AddBinding(Entity, e => e.Weight, w => w.Value).InitializeFromSource();
            spinVolume.Binding.AddBinding(Entity, e => e.Volume, w => w.Value).InitializeFromSource();
            spinPercentForMaster.Binding.AddBinding(Entity, e => e.PercentForMaster, w => w.Value).InitializeFromSource();
            checkSerial.Binding.AddBinding(Entity, e => e.IsSerial, w => w.Active).InitializeFromSource();

            ycheckNewBottle.Binding.AddBinding(Entity, e => e.IsNewBottle, w => w.Active).InitializeFromSource();
            ycheckDefectiveBottle.Binding.AddBinding(Entity, e => e.IsDefectiveBottle, w => w.Active).InitializeFromSource();
            ycheckShabbyBottle.Binding.AddBinding(Entity, e => e.IsShabbyBottle, w => w.Active).InitializeFromSource();

            chkIsDiler.Binding.AddBinding(Entity, e => e.IsDiler, w => w.Active).InitializeFromSource();
            spinMinStockCount.Binding.AddBinding(Entity, e => e.MinStockCount, w => w.ValueAsDecimal).InitializeFromSource();

            ycomboFuelTypes.SetRenderTextFunc <FuelType>(x => x.Name);
            ycomboFuelTypes.ItemsList = UoW.GetAll <FuelType>();
            ycomboFuelTypes.Binding.AddBinding(Entity, e => e.FuelType, w => w.SelectedItem).InitializeFromSource();
            ycomboFuelTypes.Visible = Entity.Category == NomenclatureCategory.fuel;

            ylblOnlineStore.Text = Entity.OnlineStore?.Name;

            yentryFolder1c.SubjectType = typeof(Folder1c);
            yentryFolder1c.Binding.AddBinding(Entity, e => e.Folder1C, w => w.Subject).InitializeFromSource();

            yentryProductGroup.JournalButtons      = Buttons.Add | Buttons.Edit;
            yentryProductGroup.RepresentationModel = new ProductGroupVM(UoW, new ProductGroupFilterViewModel());
            yentryProductGroup.Binding.AddBinding(Entity, e => e.ProductGroup, w => w.Subject).InitializeFromSource();

            referenceUnit.SubjectType = typeof(MeasurementUnits);
            referenceUnit.Binding.AddBinding(Entity, n => n.Unit, w => w.Subject).InitializeFromSource();
            yentryrefEqupmentType.SubjectType = typeof(EquipmentKind);
            yentryrefEqupmentType.Binding.AddBinding(Entity, e => e.Kind, w => w.Subject).InitializeFromSource();
            referenceColor.SubjectType = typeof(EquipmentColors);
            referenceColor.Binding.AddBinding(Entity, e => e.EquipmentColor, w => w.Subject).InitializeFromSource();
            referenceRouteColumn.SubjectType = typeof(Domain.Logistic.RouteColumn);
            referenceRouteColumn.Binding.AddBinding(Entity, n => n.RouteListColumn, w => w.Subject).InitializeFromSource();
            referenceManufacturer.SubjectType = typeof(Manufacturer);
            referenceManufacturer.Binding.AddBinding(Entity, e => e.Manufacturer, w => w.Subject).InitializeFromSource();
            checkNoDeliver.Binding.AddBinding(Entity, e => e.NoDelivey, w => w.Active).InitializeFromSource();

            yentryShortName.Binding.AddBinding(Entity, e => e.ShortName, w => w.Text, new NullToEmptyStringConverter()).InitializeFromSource();
            yentryShortName.MaxLength = 220;
            checkIsArchive.Binding.AddBinding(Entity, e => e.IsArchive, w => w.Active).InitializeFromSource();
            checkIsArchive.Sensitive = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_create_and_arc_nomenclatures");

            entityviewmodelentryShipperCounterparty.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(QS.Project.Services.ServicesConfig.CommonServices)
                );
            entityviewmodelentryShipperCounterparty.Binding.AddBinding(Entity, s => s.ShipperCounterparty, w => w.Subject).InitializeFromSource();
            entityviewmodelentryShipperCounterparty.CanEditReference = true;
            yentryStorageCell.Binding.AddBinding(Entity, s => s.StorageCell, w => w.Text).InitializeFromSource();
            UpdateVisibilityForEshopParam();

            nomenclaturePurchasePricesView.ViewModel = new NomenclaturePurchasePricesViewModel(Entity, this, UoW, ServicesConfig.CommonServices);

            #region Вкладка характиристики

            ytextDescription.Binding.AddBinding(Entity, e => e.Description, w => w.Buffer.Text).InitializeFromSource();
            nomenclaturecharacteristicsview1.Uow = UoWGeneric;

            #endregion

            int currNomenclatureOfDependence = (Entity.DependsOnNomenclature == null ? 0 : Entity.DependsOnNomenclature.Id);

            dependsOnNomenclature.RepresentationModel = new NomenclatureDependsFromVM(Entity);
            dependsOnNomenclature.Binding.AddBinding(Entity, e => e.DependsOnNomenclature, w => w.Subject).InitializeFromSource();

            ConfigureInputs(Entity.Category, Entity.TareVolume);

            pricesView.UoWGeneric = UoWGeneric;
            pricesView.Sensitive  = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_create_and_arc_nomenclatures");

            Imageslist.ImageButtonPressEvent += Imageslist_ImageButtonPressEvent;

            Entity.PropertyChanged += Entity_PropertyChanged;

            //make actions menu
            var menu     = new Gtk.Menu();
            var menuItem = new Gtk.MenuItem("Заменить все ссылки на номенклатуру...");
            menuItem.Activated += MenuItem_ReplaceLinks_Activated;;
            menu.Add(menuItem);
            menuActions.Menu = menu;
            menu.ShowAll();
            menuActions.Sensitive = !UoWGeneric.IsNew;

            ConfigureValidationContext();
        }
Exemplo n.º 44
0
 public static void ShowContextMenu(Gtk.Menu menu, Gtk.Widget parent, Gdk.EventButton evt)
 {
     ShowContextMenu(menu, parent, evt, Gdk.Rectangle.Zero);
 }
Exemplo n.º 45
0
        private void FillControl()
        {
            btnSave          = new Button();
            btnSave.Label    = MainClass.Languages.Translate("save");
            btnSave.Clicked += delegate(object sender, EventArgs e) {
                Save();
            };

            if (String.IsNullOrEmpty(appFile.Title))
            {
                cbOrientation.Active = 0;
            }

            //cbOrientation.AppendValues("Portrait");

            if ((MainClass.Settings.DisplayOrientations == null) || ((MainClass.Settings.DisplayOrientations.Count < 1)))
            {
                MainClass.Settings.GenerateOrientations();
            }
            TreeIter ti = new TreeIter();

            foreach (SettingValue ds in MainClass.Settings.DisplayOrientations)
            {
                if (ds.Value == appFile.Orientation)
                {
                    ti = orientationModel.AppendValues(ds.Display, ds.Value);
                    cbOrientation.SetActiveIter(ti);
                }
                else
                {
                    orientationModel.AppendValues(ds.Display, ds.Value);
                }
            }
            if (cbOrientation.Active < 0)
            {
                cbOrientation.Active = 0;
            }

            entTitle.Text       = appFile.Title;
            entHomepage.Text    = appFile.Homepage;
            entDescription.Text = appFile.Description;
            entCopyright.Text   = appFile.Copyright;
            entAuthor.Text      = appFile.Author;
            //lblId2.LabelProp = appFile.Id;
            lblName2.LabelProp = appFile.Name;
            entUses.Text       = appFile.Uses;

            if (!String.IsNullOrEmpty(appFile.Version))
            {
                string[] version = appFile.Version.Split('.');

                if (version.Length >= 2)
                {
                    Int32.TryParse(version[0].Trim(), out major);
                    Int32.TryParse(version[1].Trim(), out minor);
                }
                else
                {
                    Int32.TryParse(version[0].Trim(), out major);
                }
            }

            entrVersionMajor.Text = major.ToString();
            entrVersionMinor.Text = minor.ToString();

            entrVersionMajor.Changed += delegate(object sender, EventArgs e) {
                int mn = 0;
                if (!Int32.TryParse(entrVersionMajor.Text, out mn))
                {
                    entrVersionMajor.Text = major.ToString();
                }
                else
                {
                    major = mn;
                }
            };

            entrVersionMinor.Changed += delegate(object sender, EventArgs e) {
                int mn = 0;
                if (!Int32.TryParse(entrVersionMinor.Text, out mn))
                {
                    entrVersionMinor.Text = minor.ToString();
                }
                else
                {
                    minor = mn;
                }
            };

            if (mode == ApplicationFileControl.Mode.Read)
            {
                entTitle.IsEditable       = false;
                entHomepage.IsEditable    = false;
                entDescription.IsEditable = false;
                entCopyright.IsEditable   = false;
                entAuthor.IsEditable      = false;
                //lblId2.Visible = false;
                lblName2.Visible   = false;
                entUses.IsEditable = false;
            }

            if (mode == Mode.Edit)
            {
                table1.Attach(btnSave, 0, 1, 8, 9);
            }

            Gdk.Pixbuf default_pixbuf = null;
            string     file           = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png");

            if (System.IO.File.Exists(file))
            {
                default_pixbuf = new Gdk.Pixbuf(file);

                Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf));
                btnClose.TooltipText  = MainClass.Languages.Translate("insert_libs");
                btnClose.Relief       = Gtk.ReliefStyle.None;
                btnClose.CanFocus     = false;
                btnClose.WidthRequest = btnClose.HeightRequest = 22;
                btnClose.Clicked     += delegate {
                    popupLibs.Popup();
                };
                //table1.Attach(btnClose,2,3,7,8, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

                popupLibs = new Gtk.Menu();

                if ((MainClass.Settings.LibsDefine == null) || (MainClass.Settings.LibsDefine.Count < 1))
                {
                    MainClass.Settings.GenerateLibs();
                }

                foreach (string lib in MainClass.Settings.LibsDefine)
                {
                    AddMenuItem(lib);
                }

                popupLibs.ShowAll();
            }

            Gdk.Pixbuf default_pixbuf2 = null;
            string     file2           = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-add.png");

            if (System.IO.File.Exists(file2))
            {
                default_pixbuf2 = new Gdk.Pixbuf(file2);

                Gtk.Button btnAddMajor = new Gtk.Button(new Gtk.Image(default_pixbuf2));
                btnAddMajor.Relief       = Gtk.ReliefStyle.None;
                btnAddMajor.CanFocus     = false;
                btnAddMajor.WidthRequest = btnAddMajor.HeightRequest = 19;
                btnAddMajor.Clicked     += delegate {
                    major++;
                    entrVersionMajor.Text = major.ToString();
                };
                tblVersion.Attach(btnAddMajor, 1, 2, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);


                Gtk.Button btnAddMinor = new Gtk.Button(new Gtk.Image(default_pixbuf2));
                btnAddMinor.Relief       = Gtk.ReliefStyle.None;
                btnAddMinor.CanFocus     = false;
                btnAddMinor.WidthRequest = btnAddMinor.HeightRequest = 19;
                btnAddMinor.Clicked     += delegate {
                    minor++;
                    entrVersionMinor.Text = minor.ToString();
                };
                tblVersion.Attach(btnAddMinor, 4, 5, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            }

            if (mode == Mode.Create)
            {
                entUses.Visible   = false;
                Uses.Visible      = false;
                btnManage.Visible = false;
                table1.Remove(entUses);
                table1.Remove(Uses);
                table1.Remove(btnManage);
            }
            entTitle.KeyReleaseEvent += delegate(object o, KeyReleaseEventArgs args) {
                titleChange = true;
            };
        }
Exemplo n.º 46
0
    public void Activate(Widget toplevel, Gdk.EventButton eb)
    {
        // FIXME this is a hack to handle the --view case for the time being.
        creator = toplevel;

        if (MainWindow.Toplevel == null)
        {
            return;
        }

        int count = MainWindow.Toplevel.SelectedIds().Length;

        Gtk.Menu popup_menu     = this;
        bool     have_selection = count > 0;

        GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Copy Photo Location"),
                             delegate { MainWindow.Toplevel.HandleCopyLocation(creator, null); }, have_selection);

        GtkUtil.MakeMenuSeparator(popup_menu);

        GtkUtil.MakeMenuItem(popup_menu, "f-spot-rotate-270",
                             delegate { MainWindow.Toplevel.HandleRotate270Command(creator, null); }, have_selection);
        GtkUtil.MakeMenuItem(popup_menu, "f-spot-rotate-90",
                             delegate { MainWindow.Toplevel.HandleRotate90Command(creator, null); }, have_selection);

        GtkUtil.MakeMenuSeparator(popup_menu);

        OpenWithMenu owm = OpenWithMenu.AppendMenuTo(popup_menu, MainWindow.Toplevel.SelectedMimeTypes, true);

        owm.IgnoreApp             = "f-spot";
        owm.ApplicationActivated += delegate(Gnome.Vfs.MimeApplication app) { MainWindow.Toplevel.HandleOpenWith(creator, app); };

        GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Remove From Catalog"),
                             delegate { MainWindow.Toplevel.HandleRemoveCommand(creator, null); }, have_selection);
        GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Delete From Drive"),
                             delegate { MainWindow.Toplevel.HandleDeleteCommand(creator, null); }, have_selection);

        GtkUtil.MakeMenuSeparator(popup_menu);

        //
        // FIXME TagMenu is ugly.
        //
        ImageMenuItem attach_item = new ImageMenuItem(Catalog.GetString("Attach Tag"));

        attach_item.Image = new Gtk.Image("gtk-add", IconSize.Menu);
        TagMenu attach_menu = new TagMenu(attach_item, MainWindow.Toplevel.Database.Tags);

        attach_menu.NewTagHandler += delegate { MainWindow.Toplevel.HandleCreateTagAndAttach(creator, null); };
        attach_menu.TagSelected   += MainWindow.Toplevel.HandleAttachTagMenuSelected;
        attach_item.ShowAll();
        popup_menu.Append(attach_item);

        //
        // FIXME finish the IPhotoSelection stuff and move the activate handler into the class
        // this current method is way too complicated.
        //
        ImageMenuItem remove_item = new ImageMenuItem(Catalog.GetString("Remove Tag"));

        remove_item.Image = new Gtk.Image("gtk-remove", IconSize.Menu);
        PhotoTagMenu remove_menu = new PhotoTagMenu();

        remove_menu.TagSelected += MainWindow.Toplevel.HandleRemoveTagMenuSelected;
        remove_item.Submenu      = remove_menu;
        remove_item.Activated   += MainWindow.Toplevel.HandleTagMenuActivate;
        remove_item.ShowAll();
        popup_menu.Append(remove_item);

        if (eb != null)
        {
            popup_menu.Popup(null, null, null, eb.Button, eb.Time);
        }
        else
        {
            popup_menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
        }
    }
Exemplo n.º 47
0
 public static void ShowContextMenu(Gtk.Menu menu, Gtk.Widget parent, Gdk.Rectangle caret)
 {
     ShowContextMenu(menu, parent, null, caret);
 }
Exemplo n.º 48
0
 private void positionFunc(Gtk.Menu menu, out int x, out int y, out bool pushIn)
 {
     x      = this.x;
     y      = this.y;
     pushIn = false;
 }
Exemplo n.º 49
0
 static void DeactivateMenu(object sender, EventArgs args)
 {
     Gtk.Menu menu = (Gtk.Menu)sender;
     menu.Popdown();
 }
Exemplo n.º 50
0
        protected virtual void OnExporerTreeviewButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
        {
            TreePath path;

            exporerTreeview.GetPathAtPos((int)args.Event.X, (int)args.Event.Y, out path);
            if (path != null)
            {
                if (args.Event.Button == 3)
                {
                    Gtk.MenuItem addNewMenuItem = null;
                    if (path.Depth > 1)
                    {
                        int index = path.Indices [1];
                        if ((index == 2 || index == 1) && path.Depth == 2)
                        {
                            /*TODO 3tk - at the moment user added datafields are disabled
                             *  Gtk.Menu jBox = new Gtk.Menu ();
                             *  if (index == 1) {
                             *          addNewMenuItem = new MenuItem ("add field");
                             *
                             *  } else {
                             *          addNewMenuItem = new MenuItem ("add parameter");
                             *  }
                             *  jBox.Add (addNewMenuItem);
                             *
                             *  addNewMenuItem.Activated += delegate(object sender, EventArgs e) {
                             *          PropertyFieldEditor pfe = new PropertyFieldEditor ();
                             *          pfe.Response += delegate(object oo, ResponseArgs argss) {
                             *                  if (argss.ResponseId == ResponseType.Ok) {
                             *                          if (index == 1){
                             *                                  //DesignService.Report.Fields.Add (new PropertyDataField (){ Name = pfe.PropertyName});
                             *                                  updateTreeNode(dataFieldsNode,designService.Report.DataFields);
                             *
                             *                          }else {
                             *                                  //DesignService.Report.Parameters.Add (new PropertyDataField< (){ Name = pfe.PropertyName, DefaultValue = pfe.DefaultValue });
                             *                                  updateTreeNode(parametersNode,designService.Report.Parameters);
                             *                          }
                             *
                             *                          pfe.Destroy ();
                             *
                             *                  }else {
                             *                          pfe.Destroy ();
                             *                  }
                             *          };
                             *          pfe.Show ();
                             *  };
                             *
                             *  jBox.ShowAll ();
                             *  jBox.Popup ();
                             */
                        }
                        else if (index == 4 && path.Depth == 2)
                        {
                            Gtk.Menu jBox = new Gtk.Menu();

                            addNewMenuItem = new MenuItem("add image");
                            jBox.Add(addNewMenuItem);
                            addNewMenuItem.Activated += delegate(object sender, EventArgs e) {
                                Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the Monoreports file to open", null, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
                                var fileFilter           = new FileFilter {
                                    Name = "Images"
                                };
                                fileFilter.AddPattern("*.jpg");
                                fileFilter.AddPattern("*.png");
                                fileFilter.AddPattern("*.gif");
                                fileFilter.AddPattern("*.JPG");
                                fileFilter.AddPattern("*.PNG");
                                fileFilter.AddPattern("*.GIF");
                                fc.AddFilter(fileFilter);

                                if (fc.Run() == (int)ResponseType.Accept)
                                {
                                    System.IO.FileStream file = System.IO.File.OpenRead(fc.Filename);

                                    byte[] bytes = new byte[file.Length];
                                    file.Read(bytes, 0, (int)file.Length);
                                    string fileName = System.IO.Path.GetFileName(fc.Filename);
                                    designService.Report.ResourceRepository.Add(fileName, bytes);
                                    designService.PixbufRepository.AddOrUpdatePixbufByName(fileName);
                                    file.Close();
                                }

                                fc.Destroy();
                                updateTreeNode(imagesNode, designService.Report.ResourceRepository);
                            };
                            jBox.ShowAll();
                            jBox.Popup();
                        }
                    }
                }
                else if (args.Event.Button == 1)
                {
                    if (path.Depth == 3)
                    {
                        int index = path.Indices [1];

                        if (index == 1)
                        {
                            Workspace.ShowInPropertyGrid(designService.Report.DataFields[path.Indices[2]]);
                        }
                        else if (index == 0)
                        {
                            Workspace.ShowInPropertyGrid(designService.Report.Parameters[path.Indices[2]]);
                        }
                    }
                }
            }
        }
Exemplo n.º 51
0
 public ChatMenu()
 {
     Glade.XML xmlMnuChat = new Glade.XML(null, "FileFind.Meshwork.GtkClient.meshwork.glade", "mnuChat", null);
     mnuChat = (xmlMnuChat.GetWidget("mnuChat") as Gtk.Menu);
     xmlMnuChat.Autoconnect(this);
 }
Exemplo n.º 52
0
        /// <summary>Shows a context menu.</summary>
        /// <param name='menu'>The menu.</param>
        /// <param name='parent'>The parent widget.</param>
        /// <param name='evt'>The mouse event. May be null if triggered by keyboard.</param>
        /// <param name='caret'>The caret/selection position within the parent, if the EventButton is null.</param>
        public static void ShowContextMenu(Gtk.Menu menu, Gtk.Widget parent, Gdk.EventButton evt, Gdk.Rectangle caret)
        {
            Gtk.MenuPositionFunc posFunc = null;

            if (parent != null)
            {
                menu.AttachToWidget(parent, null);
                menu.Hidden += (sender, e) => {
                    menu.Detach();
                };
                posFunc = delegate(Gtk.Menu m, out int x, out int y, out bool pushIn) {
                    Gdk.Window window = evt != null? evt.Window : parent.GdkWindow;
                    window.GetOrigin(out x, out y);
                    var alloc = parent.Allocation;
                    if (evt != null)
                    {
                        x += (int)evt.X;
                        y += (int)evt.Y;
                    }
                    else if (caret.X >= alloc.X && caret.Y >= alloc.Y)
                    {
                        x += caret.X;
                        y += caret.Y + caret.Height;
                    }
                    else
                    {
                        x += alloc.X;
                        y += alloc.Y;
                    }
                    Gtk.Requisition request  = m.SizeRequest();
                    var             screen   = parent.Screen;
                    Gdk.Rectangle   geometry = GetUsableMonitorGeometry(screen, screen.GetMonitorAtPoint(x, y));

                    //whether to push or flip menus that would extend offscreen
                    //FIXME: this is the correct behaviour for mac, check other platforms
                    bool flip_left = true;
                    bool flip_up   = false;

                    if (x + request.Width > geometry.X + geometry.Width)
                    {
                        if (flip_left)
                        {
                            x -= request.Width;
                        }
                        else
                        {
                            x = geometry.X + geometry.Width - request.Width;
                        }

                        if (x < geometry.Left)
                        {
                            x = geometry.Left;
                        }
                    }

                    if (y + request.Height > geometry.Y + geometry.Height)
                    {
                        if (flip_up)
                        {
                            y -= request.Height;
                        }
                        else
                        {
                            y = geometry.Y + geometry.Height - request.Height;
                        }

                        if (y < geometry.Top)
                        {
                            y = geometry.Top;
                        }
                    }

                    pushIn = false;
                };
            }

            uint time;
            uint button;

            if (evt == null)
            {
                time   = Gtk.Global.CurrentEventTime;
                button = 0;
            }
            else
            {
                time   = evt.Time;
                button = evt.Button;
            }

            //HACK: work around GTK menu issues on mac when passing button to menu.Popup
            //some menus appear and immediately hide, and submenus don't activate
            if (Platform.IsMac)
            {
                button = 0;
            }

            menu.Popup(null, null, posFunc, button, time);
        }
Exemplo n.º 53
0
 public static void MakeMenuSeparator(Gtk.Menu menu)
 {
     Gtk.SeparatorMenuItem i = new Gtk.SeparatorMenuItem();
     menu.Append(i);
     i.Show();
 }
Exemplo n.º 54
0
        public GlobalOptionsWidget(Gtk.Window parent)
        {
            parentWindow = parent;

            this.Build();
            this.chbShowUnsupportDevic.Sensitive = false;

            feLib                  = new FavoriteEntry(NavigationBar.NavigationType.libs);
            feLib.IsFolder         = true;
            fePublishTool          = new FavoriteEntry(NavigationBar.NavigationType.publish);
            fePublishTool.IsFolder = true;
            feEmulator             = new FavoriteEntry(NavigationBar.NavigationType.emulator);
            feEmulator.IsFolder    = true;

            if (!String.IsNullOrEmpty(MainClass.Settings.EmulatorDirectory))
            {
                feEmulator.Path = MainClass.Settings.EmulatorDirectory;
            }

            if (!String.IsNullOrEmpty(MainClass.Settings.LibDirectory))
            {
                feLib.Path = MainClass.Settings.LibDirectory;
            }

            if (!String.IsNullOrEmpty(MainClass.Settings.PublishDirectory))
            {
                fePublishTool.Path = MainClass.Settings.PublishDirectory;
            }

            table1.Attach(fePublishTool, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0);
            table1.Attach(feLib, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0);
            table1.Attach(feEmulator, 1, 2, 2, 3, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0);

            fontbutton1.FontName = MainClass.Settings.ConsoleTaskFont;

            chbAutoselectProject.Active  = MainClass.Settings.AutoSelectProject;
            chbOpenLastOpenedW.Active    = MainClass.Settings.OpenLastOpenedWorkspace;
            chbShowUnsupportDevic.Active = MainClass.Settings.ShowUnsupportedDevices;
            chbShowDebugDevic.Active     = MainClass.Settings.ShowDebugDevices;


            cbBackground.UseAlpha = false;

            cbBackground.Color = new Gdk.Color(MainClass.Settings.BackgroundColor.Red,
                                               MainClass.Settings.BackgroundColor.Green, MainClass.Settings.BackgroundColor.Blue);

            ignoreFolder = new List <IgnoreFolder>(MainClass.Settings.IgnoresFolders.ToArray());

            tvIgnoreFolder.AppendColumn(MainClass.Languages.Translate("name"), new Gtk.CellRendererText(), "text", 0);

            CellRendererToggle crt = new CellRendererToggle();

            crt.Activatable = true;
            crt.Toggled    += delegate(object o, ToggledArgs args) {
                TreeIter iter;
                if (storeIFo.GetIter(out iter, new TreePath(args.Path)))
                {
                    bool         old  = (bool)storeIFo.GetValue(iter, 1);
                    IgnoreFolder iFol = (IgnoreFolder)storeIFo.GetValue(iter, 3);
                    iFol.IsForIde = !old;

                    storeIFo.SetValue(iter, 1, !old);
                }
            };

            tvIgnoreFolder.AppendColumn(MainClass.Languages.Translate("ignore_for_ide"), crt, "active", 1);

            CellRendererToggle crt2 = new CellRendererToggle();

            crt2.Activatable = true;
            crt2.Toggled    += delegate(object o, ToggledArgs args) {
                TreeIter iter;
                if (storeIFo.GetIter(out iter, new TreePath(args.Path)))
                {
                    bool         old  = (bool)storeIFo.GetValue(iter, 2);
                    IgnoreFolder iFol = (IgnoreFolder)storeIFo.GetValue(iter, 3);
                    //CombinePublish cp =(CombinePublish) fontListStore.GetValue(iter,2);
                    //cp.IsSelected = !old;
                    iFol.IsForPublish = !old;

                    storeIFo.SetValue(iter, 2, !old);
                }
            };

            tvIgnoreFolder.AppendColumn(MainClass.Languages.Translate("ignore_for_Pub"), crt2, "active", 2);
            tvIgnoreFolder.Model = storeIFo;

            foreach (IgnoreFolder ignoref in MainClass.Settings.IgnoresFolders)
            {
                storeIFo.AppendValues(ignoref.Folder, ignoref.IsForIde, ignoref.IsForPublish, ignoref);
            }

            /* Ignore Files */
            ignoreFile = new List <IgnoreFolder>(MainClass.Settings.IgnoresFiles.ToArray());

            tvIgnoreFiles.AppendColumn(MainClass.Languages.Translate("name"), new Gtk.CellRendererText(), "text", 0);

            CellRendererToggle crtFi = new CellRendererToggle();

            crtFi.Activatable = true;
            crtFi.Toggled    += delegate(object o, ToggledArgs args) {
                TreeIter iter;
                if (storeIFi.GetIter(out iter, new TreePath(args.Path)))
                {
                    bool         old  = (bool)storeIFi.GetValue(iter, 1);
                    IgnoreFolder iFol = (IgnoreFolder)storeIFi.GetValue(iter, 3);
                    iFol.IsForIde = !old;

                    storeIFi.SetValue(iter, 1, !old);
                }
            };

            tvIgnoreFiles.AppendColumn(MainClass.Languages.Translate("ignore_for_ide"), crtFi, "active", 1);

            CellRendererToggle crtFi2 = new CellRendererToggle();

            crtFi2.Activatable = true;
            crtFi2.Toggled    += delegate(object o, ToggledArgs args) {
                TreeIter iter;
                if (storeIFi.GetIter(out iter, new TreePath(args.Path)))
                {
                    bool         old  = (bool)storeIFi.GetValue(iter, 2);
                    IgnoreFolder iFol = (IgnoreFolder)storeIFi.GetValue(iter, 3);
                    iFol.IsForPublish = !old;
                    storeIFi.SetValue(iter, 2, !old);
                }
            };

            tvIgnoreFiles.AppendColumn(MainClass.Languages.Translate("ignore_for_Pub"), crtFi2, "active", 2);
            tvIgnoreFiles.Model = storeIFi;

            foreach (IgnoreFolder ignoref in MainClass.Settings.IgnoresFiles)
            {
                storeIFi.AppendValues(ignoref.Folder, ignoref.IsForIde, ignoref.IsForPublish, ignoref);
            }
            /**/

            Gdk.Pixbuf default_pixbuf = null;
            string     file           = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png");

            if (System.IO.File.Exists(file))
            {
                default_pixbuf = new Gdk.Pixbuf(file);

                popupColor = new Gtk.Menu();
                CreateMenu();

                Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf));
                btnClose.TooltipText  = MainClass.Languages.Translate("select_color");
                btnClose.Relief       = Gtk.ReliefStyle.None;
                btnClose.CanFocus     = false;
                btnClose.WidthRequest = btnClose.HeightRequest = 22;

                popupColor.AttachToWidget(btnClose, new Gtk.MenuDetachFunc(DetachWidget));
                btnClose.Clicked += delegate {
                    popupColor.Popup(null, null, new Gtk.MenuPositionFunc(GetPosition), 3, Gtk.Global.CurrentEventTime);
                };
                table1.Attach(btnClose, 2, 3, 3, 4, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

                popupColor.ShowAll();
            }
        }
Exemplo n.º 55
0
 public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string l, EventHandler e)
 {
     return(MakeMenuItem(menu, l, e, true));
 }
Exemplo n.º 56
0
 private void DetachWidget(Gtk.Widget attach_widget, Gtk.Menu menu)
 {
 }
Exemplo n.º 57
0
        private void ConfigureDlg()
        {
            notebook1.ShowTabs          = false;
            spinWeight.Sensitive        = false;
            spinVolume.Sensitive        = false;
            lblPercentForMaster.Visible = spinPercentForMaster.Visible = false;
            entryName.IsEditable        = true;
            radioInfo.Active            = true;

            ylabelCreationDate.Binding.AddFuncBinding(Entity, s => s.CreateDate.HasValue ? s.CreateDate.Value.ToString("dd.MM.yyyy HH:mm") : "", w => w.LabelProp).InitializeFromSource();
            ylabelCreatedBy.Binding.AddFuncBinding <Nomenclature>(Entity, s => GetUserEmployeeName(s.CreatedBy), w => w.LabelProp).InitializeFromSource();

            enumVAT.ItemsEnum = typeof(VAT);
            enumVAT.Binding.AddBinding(Entity, e => e.VAT, w => w.SelectedItem).InitializeFromSource();

            enumType.ItemsEnum = typeof(NomenclatureCategory);
            enumType.Binding.AddBinding(Entity, e => e.Category, w => w.SelectedItem).InitializeFromSource();

            enumTareVolume.ItemsEnum = typeof(TareVolume);
            enumTareVolume.Binding.AddBinding(Entity, e => e.TareVolume, w => w.SelectedItemOrNull).InitializeFromSource();
            ycheckDisposableTare.Binding.AddBinding(Entity, e => e.IsDisposableTare, w => w.Active).InitializeFromSource();

            enumEquipmentSubtype.Visible   = Entity.Category == NomenclatureCategory.equipment;
            enumEquipmentSubtype.ItemsEnum = typeof(SubtypeOfEquipmentCategory);
            enumEquipmentSubtype.Binding.AddBinding(Entity, e => e.SubTypeOfEquipmentCategory, w => w.SelectedItem).InitializeFromSource();

            enumDepositType.Visible   = Entity.Category == NomenclatureCategory.deposit;
            enumDepositType.ItemsEnum = typeof(TypeOfDepositCategory);
            enumDepositType.Binding.AddBinding(Entity, e => e.TypeOfDepositCategory, w => w.SelectedItemOrNull).InitializeFromSource();

            comboMobileCatalog.ItemsEnum = typeof(MobileCatalog);
            comboMobileCatalog.Binding.AddBinding(Entity, e => e.MobileCatalog, w => w.SelectedItem).InitializeFromSource();

            labelSubType.Visible = (Entity.Category == NomenclatureCategory.deposit || Entity.Category == NomenclatureCategory.equipment);

            entryName.Binding.AddBinding(Entity, e => e.Name, w => w.Text).InitializeFromSource();
            yentryOfficialName.Binding.AddBinding(Entity, e => e.OfficialName, w => w.Text).InitializeFromSource();
            var parallel = new ParallelEditing(yentryOfficialName);

            parallel.SubscribeOnChanges(entryName);
            parallel.GetParallelTextFunc = GenerateOfficialName;

            ycheckRentPriority.Binding.AddBinding(Entity, e => e.RentPriority, w => w.Active).InitializeFromSource();
            checkNotReserve.Binding.AddBinding(Entity, e => e.DoNotReserve, w => w.Active).InitializeFromSource();
            checkcanPrintPrice.Binding.AddBinding(Entity, e => e.CanPrintPrice, w => w.Active).InitializeFromSource();
            labelCanPrintPrice.Visible = checkcanPrintPrice.Visible = Entity.Category == NomenclatureCategory.water && !Entity.IsDisposableTare;
            checkHide.Binding.AddBinding(Entity, e => e.Hide, w => w.Active).InitializeFromSource();
            entryCode1c.Binding.AddBinding(Entity, e => e.Code1c, w => w.Text).InitializeFromSource();
            yspinSumOfDamage.Binding.AddBinding(Entity, e => e.SumOfDamage, w => w.ValueAsDecimal).InitializeFromSource();
            spinWeight.Binding.AddBinding(Entity, e => e.Weight, w => w.Value).InitializeFromSource();
            spinVolume.Binding.AddBinding(Entity, e => e.Volume, w => w.Value).InitializeFromSource();
            spinPercentForMaster.Binding.AddBinding(Entity, e => e.PercentForMaster, w => w.Value).InitializeFromSource();
            checkSerial.Binding.AddBinding(Entity, e => e.IsSerial, w => w.Active).InitializeFromSource();
            ycheckNewBottle.Binding.AddBinding(Entity, e => e.IsNewBottle, w => w.Active).InitializeFromSource();
            ycheckDefectiveBottle.Binding.AddBinding(Entity, e => e.IsDefectiveBottle, w => w.Active).InitializeFromSource();
            chkIsDiler.Binding.AddBinding(Entity, e => e.IsDiler, w => w.Active).InitializeFromSource();
            spinMinStockCount.Binding.AddBinding(Entity, e => e.MinStockCount, w => w.ValueAsDecimal).InitializeFromSource();

            yentryFolder1c.SubjectType = typeof(Folder1c);
            yentryFolder1c.Binding.AddBinding(Entity, e => e.Folder1C, w => w.Subject).InitializeFromSource();
            yentryProductGroup.SubjectType = typeof(ProductGroup);
            yentryProductGroup.Binding.AddBinding(Entity, e => e.ProductGroup, w => w.Subject).InitializeFromSource();
            referenceUnit.SubjectType = typeof(MeasurementUnits);
            referenceUnit.Binding.AddBinding(Entity, n => n.Unit, w => w.Subject).InitializeFromSource();
            yentryrefEqupmentType.SubjectType = typeof(EquipmentType);
            yentryrefEqupmentType.Binding.AddBinding(Entity, e => e.Type, w => w.Subject).InitializeFromSource();
            referenceColor.SubjectType = typeof(EquipmentColors);
            referenceColor.Binding.AddBinding(Entity, e => e.EquipmentColor, w => w.Subject).InitializeFromSource();
            referenceWarehouse.ItemsQuery = StoreDocumentHelper.GetWarehouseQuery();
            referenceWarehouse.Binding.AddBinding(Entity, n => n.Warehouse, w => w.Subject).InitializeFromSource();
            referenceRouteColumn.SubjectType = typeof(Domain.Logistic.RouteColumn);
            referenceRouteColumn.Binding.AddBinding(Entity, n => n.RouteListColumn, w => w.Subject).InitializeFromSource();
            referenceManufacturer.SubjectType = typeof(Manufacturer);
            referenceManufacturer.Binding.AddBinding(Entity, e => e.Manufacturer, w => w.Subject).InitializeFromSource();
            checkNoDeliver.Binding.AddBinding(Entity, e => e.NoDelivey, w => w.Active).InitializeFromSource();

            yentryShortName.Binding.AddBinding(Entity, e => e.ShortName, w => w.Text, new NullToEmptyStringConverter()).InitializeFromSource();
            yentryShortName.MaxLength = 220;
            checkIsArchive.Binding.AddBinding(Entity, e => e.IsArchive, w => w.Active).InitializeFromSource();
            checkIsArchive.Sensitive = QSMain.User.Permissions["can_create_and_arc_nomenclatures"];

            #region Вкладка характиристики

            ytextDescription.Binding.AddBinding(Entity, e => e.Description, w => w.Buffer.Text).InitializeFromSource();
            nomenclaturecharacteristicsview1.Uow = UoWGeneric;

            #endregion

            int currNomenclatureOfDependence = (Entity.DependsOnNomenclature == null ? 0 : Entity.DependsOnNomenclature.Id);

            dependsOnNomenclature.RepresentationModel = new NomenclatureDependsFromVM(Entity);
            dependsOnNomenclature.Binding.AddBinding(Entity, e => e.DependsOnNomenclature, w => w.Subject).InitializeFromSource();

            ConfigureInputs(Entity.Category);

            pricesView.UoWGeneric = UoWGeneric;
            pricesView.Sensitive  = QSMain.User.Permissions["can_create_and_arc_nomenclatures"];

            Imageslist.ImageButtonPressEvent += Imageslist_ImageButtonPressEvent;

            Entity.PropertyChanged += Entity_PropertyChanged;

            //make actions menu
            var menu     = new Gtk.Menu();
            var menuItem = new Gtk.MenuItem("Заменить все ссылки на номенклатуру...");
            menuItem.Activated += MenuItem_ReplaceLinks_Activated;;
            menu.Add(menuItem);
            menuActions.Menu = menu;
            menu.ShowAll();
            menuActions.Sensitive = !UoWGeneric.IsNew;
        }
Exemplo n.º 58
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GamePage"/> class. The given package group and node tree are
        /// wrapped by the page.
        /// </summary>
        /// <param name="packageGroup">The package group which the node tree maps to.</param>
        /// <param name="nodeTree">The prebuilt node tree to display.</param>
        /// <param name="version">The Warcraft version that the game page is contextually relevant for.</param>
        /// <param name="alias">The name of the page.</param>
        public GamePage(PackageGroup packageGroup, SerializedTree nodeTree, WarcraftVersion version, string alias)
        {
            this.Alias       = alias;
            _uiTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            _treeModel       = new FileTreeModel(nodeTree);
            this.GameContext = new WarcraftGameContext(version, packageGroup, _treeModel);

            _treeAlignment = new Alignment(0.5f, 0.5f, 1.0f, 1.0f)
            {
                TopPadding    = 1,
                BottomPadding = 1
            };

            _treeFilter = new TreeModelFilter(new TreeModelAdapter(_treeModel), null)
            {
                VisibleFunc = TreeModelVisibilityFunc
            };

            _treeSorter = new TreeModelSort(_treeFilter);

            _treeSorter.SetSortFunc(0, SortGameTreeRow);
            _treeSorter.SetSortColumnId(0, SortType.Descending);

            this.Tree = new TreeView(_treeSorter)
            {
                HeadersVisible  = true,
                EnableTreeLines = true
            };

            var nodeIconRenderer = new CellRendererPixbuf
            {
                Xalign = 0.0f
            };
            var nodeNameRenderer = new CellRendererText
            {
                Xalign = 0.0f
            };

            var column = new TreeViewColumn
            {
                Title   = "Data Files",
                Spacing = 4
            };

            column.PackStart(nodeIconRenderer, false);
            column.PackStart(nodeNameRenderer, false);

            column.SetCellDataFunc(nodeIconRenderer, RenderNodeIcon);
            column.SetCellDataFunc(nodeNameRenderer, RenderNodeName);

            this.Tree.AppendColumn(column);

            var sw = new ScrolledWindow
            {
                this.Tree
            };

            _treeAlignment.Add(sw);

            this.Tree.RowActivated      += OnRowActivated;
            this.Tree.ButtonPressEvent  += OnButtonPressed;
            this.Tree.Selection.Changed += OnSelectionChanged;

            _treeContextMenu = new Menu();

            // Save item context button
            _saveItem = new ImageMenuItem
            {
                UseStock     = true,
                Label        = Stock.Save,
                CanFocus     = false,
                TooltipText  = "Save the currently selected item to disk.",
                UseUnderline = true
            };
            _saveItem.Activated += OnSaveItem;
            _treeContextMenu.Add(_saveItem);

            // Export item context button
            _exportItem = new ImageMenuItem("Export")
            {
                Image       = new Image(Stock.Convert, IconSize.Button),
                CanFocus    = false,
                TooltipText = "Exports the currently selected item to another format.",
            };
            _exportItem.Activated += OnExportItemRequested;
            _treeContextMenu.Add(_exportItem);

            // Open item context button
            _openItem = new ImageMenuItem
            {
                UseStock     = true,
                Label        = Stock.Open,
                CanFocus     = false,
                TooltipText  = "Open the currently selected item.",
                UseUnderline = true
            };
            _openItem.Activated += OnOpenItem;
            _treeContextMenu.Add(_openItem);

            // Queue for export context button
            _queueForExportItem = new ImageMenuItem("Queue for export")
            {
                Image       = new Image(Stock.Convert, IconSize.Button),
                CanFocus    = false,
                TooltipText = "Queues the currently selected item for batch export.",
            };
            _queueForExportItem.Activated += OnQueueForExportRequested;
            _treeContextMenu.Add(_queueForExportItem);

            // Separator
            var separator = new SeparatorMenuItem();

            _treeContextMenu.Add(separator);

            // Copy path context button
            _copyPathItem = new ImageMenuItem("Copy path")
            {
                Image       = new Image(Stock.Copy, IconSize.Button),
                CanFocus    = false,
                TooltipText = "Copy the path of the currently selected item.",
            };
            _copyPathItem.Activated += OnCopyPath;
            _treeContextMenu.Add(_copyPathItem);

            _treeAlignment.ShowAll();
        }
Exemplo n.º 59
0
        public DemoMain()
        {
            window = new Gtk.Window("TestForm1");
            Gtk.HBox hbox = new Gtk.HBox(false, 0);
            hbox1 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox2 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox3 = new Gtk.HBox(false, 0);
            hbox.Add(hbox1);
            window.SetDefaultSize(600, 400);
            window.DeleteEvent += new DeleteEventHandler(WindowDelete);

            button1          = new Gtk.Button("button1");
            button1.Clicked += Button1Clicked;
            button2          = new Gtk.Button("button2");
            button3          = new Gtk.Button("button3");
            Gtk.Button button4 = new Gtk.Button("button4");
            button4.Clicked += Button4Clicked;
            Gtk.Button button5 = new Gtk.Button("button5");
            Gtk.Button button6 = new Gtk.Button("button6");
            Gtk.Button button7 = new Gtk.Button("button7");
            button7.Sensitive = false;

            scaleButton1 = new Gtk.ScaleButton(0, 0, 100, 10, new string [0]);

            hbox1.Add(hbox3);
            hbox1.Add(hbox2);
            hbox1.Add(button3);
            hbox1.Add(button2);

            button3.Accessible.Description = "help text 3";
            button3.Sensitive = false;

            label1 = new Gtk.Label("label1");

            textBox1 = new Gtk.Entry();
            Gtk.Entry textBox2 = new Gtk.Entry();
            textBox2.Visibility = false;
            textBox2.Sensitive  = false;
            textBox2.IsEditable = false;
            textBox3            = new Gtk.TextView();
            // TODO: scrollbars
            Gtk.CheckButton checkbox1 = new Gtk.CheckButton("checkbox1");
            Gtk.CheckButton checkbox2 = new Gtk.CheckButton("checkbox2");
            checkbox2.Sensitive = false;

            Gtk.TreeStore   store = new Gtk.TreeStore(typeof(string), typeof(string));
            Gtk.TreeIter [] iters = new Gtk.TreeIter [2];
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 1", "item 1 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 1a", "item 1a (2)");
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 2", "item 2 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2a", "item 2a (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2b", "item 2b (2)");
            treeView1 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView1, 0, "column 1");
            treeView1.CollapseAll();

            treeView2 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView2, 0, "column 1");
            AddTreeViewColumn(treeView2, 1, "column 2");
            treeView2.CollapseAll();
            treeView2.Accessible.Name = "treeView2";

            tableStore = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string));
            iters [0]  = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "False", "Alice", "24", "");
            iters [0] = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "True", "Bob", "28", "");
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            AddTreeViewColumn(dataGridView1, 0, "Gender");
            AddTreeViewColumn(dataGridView1, 1, "Name");
            AddTreeViewColumn(dataGridView1, 2, "Age");
            dataGridView1.Accessible.Name = "dataGridView1";

            hboxPanel = new Gtk.HBox();
            Gtk.Button btnRemoveTextBox = new Gtk.Button("Remove");
            btnRemoveTextBox.Clicked += RemoveTextBoxClicked;
            Gtk.Button btnAddTextBox = new Gtk.Button("Add");
            btnAddTextBox.Clicked     += AddTextBoxClicked;
            txtCommand                 = new Gtk.Entry();
            txtCommand.Accessible.Name = "txtCommand";
            Gtk.Button btnRun = new Gtk.Button("Run");
            btnRun.Clicked += btnRunClicked;
            hboxPanel.Add(btnRemoveTextBox);
            hboxPanel.Add(btnAddTextBox);

            Gtk.TreeStore treeStore = new Gtk.TreeStore(typeof(string));
            Gtk.TreeIter  iter      = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 0");
            iter = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 1");
            listView1 = new Gtk.TreeView(treeStore);
            AddTreeViewColumn(listView1, 0, "items");
            listView1.Accessible.Name = "listView1";
            listView1.ExpandAll();

            hbox2.Add(button5);
            hbox2.Add(checkbox1);
            hbox2.Add(checkbox2);
            hbox2.Add(button4);
            hbox2.Accessible.Name = "groupBox2";

            hbox3.Add(button7);
            hbox3.Add(button6);
            hbox3.Sensitive       = false;
            hbox3.Accessible.Name = "groupBox3";

            hbox.Add(textBox3);
            hbox.Add(textBox2);
            hbox.Add(textBox1);
            hbox.Add(label1);
            hbox.Add(button1);
            hbox.Add(treeView1);
            hbox.Add(treeView2);
            hbox.Add(listView1);
            hbox.Add(dataGridView1);
            hbox.Add(txtCommand);
            hbox.Add(btnRun);
            hbox.Add(hboxPanel);
            hbox.Add(scaleButton1);

            Gtk.Menu file = new Gtk.Menu();
            file.Append(new Gtk.MenuItem("_New"));
            file.Append(new Gtk.MenuItem("_Open"));
            file.Append(new Gtk.CheckMenuItem("Check"));
            Gtk.MenuItem fileItem = new Gtk.MenuItem("File");
            fileItem.Submenu = file;
            Gtk.Menu edit = new Gtk.Menu();
            edit.Append(new Gtk.MenuItem("_Undo"));
            edit.Append(new Gtk.SeparatorMenuItem());
            edit.Append(new Gtk.MenuItem("_Cut"));
            edit.Append(new Gtk.MenuItem("Copy"));
            edit.Append(new Gtk.MenuItem("_Paste"));
            Gtk.MenuItem editItem = new Gtk.MenuItem("Edit");
            editItem.Submenu = edit;
            Gtk.MenuBar menuBar = new Gtk.MenuBar();
            menuBar.Append(fileItem);
            menuBar.Append(editItem);
            hbox.Add(menuBar);

            hbox.Add(new Gtk.SpinButton(0, 100, 1));
            hbox.Add(new Gtk.ToggleButton("ToggleButton"));
            Gtk.Adjustment adj = new Gtk.Adjustment(50, 0, 100,
                                                    1, 10, 10);
            hbox.Add(new Gtk.VScrollbar(adj));

            window.Add(hbox);
            window.ShowAll();
        }
Exemplo n.º 60
0
            void ShowPopup(Gdk.EventButton evnt)
            {
                Gtk.TreeIter iter;
                bool         hasSelection = Selection.GetSelected(out iter);
                PObject      obj          = null;

                if (hasSelection)
                {
                    obj = (PObject)widget.treeStore.GetValue(iter, 1);
                }
                else
                {
                    return;
                }

                var menu   = new Gtk.Menu();
                var newKey = new Gtk.MenuItem(GettextCatalog.GetString("New key"));

                menu.Append(newKey);

                newKey.Activated += delegate(object sender, EventArgs e) {
                    var newObj = new PString("");

                    PObject parent;
                    if (obj != null)
                    {
                        parent = obj.Parent;
                    }
                    else
                    {
                        Gtk.TreeIter parentIter;
                        if (widget.treeStore.IterParent(out parentIter, iter))
                        {
                            parent = (PObject)widget.treeStore.GetValue(parentIter, 1);
                        }
                        else
                        {
                            parent = widget.nsDictionary;
                        }
                    }

                    if (parent is PArray)
                    {
                        var arr = (PArray)parent;
                        arr.Add(newObj);
                        return;
                    }

                    var dict = parent as PDictionary;
                    if (dict == null)
                    {
                        return;
                    }

                    string name = "newNode";
                    while (dict.ContainsKey(name))
                    {
                        name += "_";
                    }
                    dict[name] = newObj;
                };

                if (hasSelection && obj != null)
                {
                    var removeKey = new Gtk.MenuItem(GettextCatalog.GetString("Remove key"));
                    menu.Append(removeKey);
                    removeKey.Activated += delegate(object sender, EventArgs e) {
                        //the change event handler removes it from the store
                        obj.Remove();
                    };
                }

                if (widget.scheme != null)
                {
                    menu.Append(new Gtk.SeparatorMenuItem());
                    var showDescItem = new Gtk.CheckMenuItem(GettextCatalog.GetString("Show descriptions"));
                    showDescItem.Active     = widget.ShowDescriptions;
                    showDescItem.Activated += delegate {
                        widget.ShowDescriptions = !widget.ShowDescriptions;
                    };
                    menu.Append(showDescItem);
                }
                menu.ShowAll();
                IdeApp.CommandService.ShowContextMenu(this, evnt, menu, this);
            }