Ejemplo n.º 1
0
        static void HandleDragScrolling(Widget w)
        {
            ScrolledWindow sw = (ScrolledWindow)w.GetAncestor(ScrolledWindow.GType);

            if (sw != null)
            {
                Drag.DestSetTrackMotion(w, true);

                DragMotionHandler dm = delegate(object o, DragMotionArgs args) {
                    int x, y;
                    Gdk.ModifierType mt;
                    sw.GdkWindow.GetPointer(out x, out y, out mt);
                    args.Args[1] = x;
                    args.Args[2] = y;
                    OnSwDragMotion(sw, args);
                };
                w.DragMotion -= dm;
                w.DragMotion += dm;
                Drag.DestSet(sw, DestDefaults.Motion, new TargetEntry[] {}, Gdk.DragAction.Move);
                Drag.DestSetTrackMotion(sw, true);
                sw.DragMotion -= OnSwDragMotion;
                sw.DragMotion += OnSwDragMotion;
            }
            else
            {
                Console.WriteLine("WARNING: No ScrolledWindow Container found: " + w.ToString());
            }
        }
Ejemplo n.º 2
0
        public EditModsDialog(Window parent, Instance inst)
            : base("Edit Mods", parent)
        {
            this.inst = inst;

            XML gxml = new XML(null, "MultiMC.GTKGUI.EditModsDialog.glade",
                               "vboxEditMods", null);

            gxml.Autoconnect(this);

            this.VBox.PackStart(vboxEditMods);

            this.AddButton("_Cancel", ResponseType.Cancel);
            this.AddButton("_OK", ResponseType.Ok);

            WidthRequest  = 600;
            HeightRequest = 500;
            // the Jar page is active by default. FIXME: determine dynamically!
            currentMode = Mode.Jar;

            modStore         = new ListStore(typeof(string), typeof(Mod));
            jarModList.Model = modStore;
            jarModList.AppendColumn("Mod Name", new CellRendererText(), "text", 0);

            mlModStore      = new ListStore(typeof(string), typeof(Mod));
            mlModList.Model = mlModStore;
            mlModList.AppendColumn("Mod Name", new CellRendererText(), "text", 0);

            //mlModList.Selection.Mode = SelectionMode.Multiple;

            inst.InstMods.ModFileChanged += (o, args) => LoadModList();

            // Listen for key presses
            jarModList.KeyPressEvent += new KeyPressEventHandler(jarModList_KeyPressEvent);
            mlModList.KeyPressEvent  += new KeyPressEventHandler(mlModList_KeyPressEvent);

            // set up drag & drop
            jarModList.EnableModelDragDest(targetEntries, Gdk.DragAction.Default);
            jarModList.EnableModelDragSource(Gdk.ModifierType.Button1Mask, srcEntries, Gdk.DragAction.Move);
            jarModList.DragDataReceived += OnDragDataReceived;
            jarModList.DragDataGet      += (object o, DragDataGetArgs args) =>
            {
                TreeIter  iter;
                TreeModel model;
                if (!jarModList.Selection.GetSelected(out iter))
                {
                    return;
                }
                Gdk.Atom[] targets = args.Context.Targets;
                TreePath   tp      = modStore.GetPath(iter);
                int        idx     = tp.Indices[0];

                args.SelectionData.Set(targets[0], 0, System.Text.Encoding.UTF8.GetBytes(idx.ToString()));
            };

            Drag.DestSet(mlModList, DestDefaults.All, targetEntries, Gdk.DragAction.Default);
            mlModList.DragDataReceived += OnDragDataReceived;
            mlModList.EnableModelDragDest(targetEntries, Gdk.DragAction.Default);
        }
Ejemplo n.º 3
0
        /// <summary>Default constructor for ExplorerView</summary>
        public ExplorerView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.ExplorerView.glade");

            vbox1                    = (VBox)builder.GetObject("vbox1");
            toolStrip                = (Toolbar)builder.GetObject("toolStrip");
            treeview1                = (TreeView)builder.GetObject("treeview1");
            RightHandView            = (Viewport)builder.GetObject("RightHandView");
            _mainWidget              = vbox1;
            RightHandView.ShadowType = ShadowType.EtchedOut;
            treeview1.Model          = treemodel;
            TreeViewColumn     column     = new TreeViewColumn();
            CellRendererPixbuf iconRender = new Gtk.CellRendererPixbuf();

            column.PackStart(iconRender, false);
            textRender                 = new Gtk.CellRendererText();
            textRender.Editable        = false;
            textRender.EditingStarted += OnBeforeLabelEdit;
            textRender.Edited         += OnAfterLabelEdit;
            column.PackStart(textRender, true);
            column.SetCellDataFunc(textRender, OnSetCellData);

            CellRendererText tickCell = new CellRendererText();

            tickCell.Editable = false;
            column.PackEnd(tickCell, false);
            column.SetAttributes(iconRender, "pixbuf", 1);
            column.SetAttributes(textRender, "text", 0);
            column.SetAttributes(tickCell, "text", 3);
            // column.SetCellDataFunc(textRender, treecelldatafunc);
            treeview1.AppendColumn(column);
            treeview1.TooltipColumn = 2;

            treeview1.CursorChanged      += OnAfterSelect;
            treeview1.ButtonReleaseEvent += OnButtonUp;
            treeview1.ButtonPressEvent   += OnButtonPress;
            treeview1.RowActivated       += OnRowActivated;

            TargetEntry[] target_table = new TargetEntry[] {
                new TargetEntry(modelMime, TargetFlags.App, 0)
            };

            Gdk.DragAction actions = Gdk.DragAction.Copy | Gdk.DragAction.Link | Gdk.DragAction.Move;
            // treeview1.EnableModelDragDest(target_table, actions);
            // treeview1.EnableModelDragSource(Gdk.ModifierType.Button1Mask, target_table, actions);
            Drag.SourceSet(treeview1, Gdk.ModifierType.Button1Mask, target_table, actions);
            Drag.DestSet(treeview1, 0, target_table, actions);
            treeview1.DragMotion       += OnDragOver;
            treeview1.DragDrop         += OnDragDrop;
            treeview1.DragBegin        += OnDragBegin;
            treeview1.DragDataGet      += OnDragDataGet;
            treeview1.DragDataReceived += OnDragDataReceived;
            treeview1.DragEnd          += OnDragEnd;
            treeview1.FocusInEvent     += Treeview1_FocusInEvent;
            treeview1.FocusOutEvent    += Treeview1_FocusOutEvent;
            timer.Elapsed         += Timer_Elapsed;
            _mainWidget.Destroyed += _mainWidget_Destroyed;
        }
Ejemplo n.º 4
0
        public FolderQueryWidget(PhotoQuery query)
        {
            folderSet  = new FolderSet();
            this.query = query;

            query.SetCondition(folderSet);

            Drag.DestSet(this, DestDefaults.All, folderQueryWidgetSourceTable, Gdk.DragAction.Copy | Gdk.DragAction.Move);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a new <see cref="NodeView"/>.
        /// </summary>
        public NodeView()
        {
            CursorInit();

            HasWindow = false;
            SetSizeRequest(100, 100);

            Drag.DestSet(this, DestDefaults.Motion, null, DragAction.Private);
            Drag.DestSetTrackMotion(this, true);
        }
Ejemplo n.º 6
0
 public CalendarHBox(OrdersCalendar calendar) : base()
 {
     ParentCalendar               = calendar;
     emptyButton                  = new ItemButton();
     emptyButton.ParentCalendar   = ParentCalendar;
     emptyButton.TypeItemButton   = TypeItemOrButton.Order;
     emptyButton.NewOrderClicked += HandleNewOrderClicked;
     this.Add(emptyButton);
     Drag.DestSet(this, DestDefaults.Highlight, null, 0);
 }
Ejemplo n.º 7
0
        /// <summary>Default constructor for ExplorerView</summary>
        public ExplorerView(ViewBase owner) : base(owner)
        {
            Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.ExplorerView.glade", "vpaned1");
            gxml.Autoconnect(this);
            _mainWidget = vpaned1;

            progressbar1.Visible       = false;
            statusWindow.HeightRequest = 20;
            treeview1.Model            = treemodel;
            TreeViewColumn     column     = new TreeViewColumn();
            CellRendererPixbuf iconRender = new Gtk.CellRendererPixbuf();

            column.PackStart(iconRender, false);
            CellRendererText textRender = new Gtk.CellRendererText();

            textRender.Editable        = true;
            textRender.EditingStarted += OnBeforeLabelEdit;
            textRender.Edited         += OnAfterLabelEdit;
            column.PackStart(textRender, true);
            column.SetAttributes(iconRender, "pixbuf", 1);
            column.SetAttributes(textRender, "text", 0);
//            column.SetCellDataFunc(textRender, treecelldatafunc);
            treeview1.AppendColumn(column);

            treeview1.CursorChanged      += OnAfterSelect;
            treeview1.ButtonReleaseEvent += OnButtonUp;

            TargetEntry[] target_table = new TargetEntry[] {
                new TargetEntry("application/x-model-component", TargetFlags.App, 0)
            };

            Gdk.DragAction actions = Gdk.DragAction.Copy | Gdk.DragAction.Link | Gdk.DragAction.Move;
            //treeview1.EnableModelDragDest(target_table, actions);
            //treeview1.EnableModelDragSource(Gdk.ModifierType.Button1Mask, target_table, actions);
            Drag.SourceSet(treeview1, Gdk.ModifierType.Button1Mask, target_table, actions);
            Drag.DestSet(treeview1, 0, target_table, actions);
            treeview1.DragMotion       += OnDragOver;
            treeview1.DragDrop         += OnDragDrop;
            treeview1.DragBegin        += OnDragBegin;
            treeview1.DragDataGet      += OnDragDataGet;
            treeview1.DragDataReceived += OnDragDataReceived;
            treeview1.DragEnd          += OnDragEnd;
            treeview1.DragDataDelete   += OnDragDataDelete;

            TextTag tag = new TextTag("error");

            tag.Foreground = "red";
            statusWindow.Buffer.TagTable.Add(tag);
            tag            = new TextTag("warning");
            tag.Foreground = "brown";
            statusWindow.Buffer.TagTable.Add(tag);
            tag            = new TextTag("normal");
            tag.Foreground = "blue";
            statusWindow.ModifyBase(StateType.Normal, new Gdk.Color(0xff, 0xff, 0xf0));
        }
Ejemplo n.º 8
0
        protected override void Initialise(ViewBase ownerView, GLib.Object gtkControl)
        {
            treeview1       = (Gtk.TreeView)gtkControl;
            mainWidget      = treeview1;
            treeview1.Model = treemodel;
            TreeViewColumn     column     = new TreeViewColumn();
            CellRendererPixbuf iconRender = new Gtk.CellRendererPixbuf();

            iconRender.SetPadding(2, 1);
            column.PackStart(iconRender, false);
            textRender                 = new Gtk.CellRendererText();
            textRender.Editable        = false;
            textRender.EditingStarted += OnBeforeLabelEdit;
            textRender.Edited         += OnAfterLabelEdit;
            column.PackStart(textRender, true);
            column.SetCellDataFunc(textRender, OnSetCellData);

            CellRendererText tickCell = new CellRendererText();

            tickCell.Editable = false;
            column.PackEnd(tickCell, false);
            column.SetAttributes(iconRender, "pixbuf", 1);
            column.SetAttributes(textRender, "text", 0);
            column.SetAttributes(tickCell, "text", 3);
            treeview1.AppendColumn(column);
            treeview1.TooltipColumn = 2;

            treeview1.CursorChanged      += OnAfterSelect;
            treeview1.ButtonReleaseEvent += OnButtonUp;
            treeview1.ButtonPressEvent   += OnButtonPress;
            treeview1.RowActivated       += OnRowActivated;
            treeview1.FocusInEvent       += OnTreeGainFocus;
            treeview1.FocusOutEvent      += OnTreeLoseFocus;

            TargetEntry[] target_table = new TargetEntry[] {
                new TargetEntry(modelMime, TargetFlags.App, 0)
            };

            Gdk.DragAction actions = Gdk.DragAction.Copy | Gdk.DragAction.Link | Gdk.DragAction.Move;
            Drag.SourceSet(treeview1, Gdk.ModifierType.Button1Mask, target_table, actions);
            Drag.DestSet(treeview1, 0, target_table, actions);
            treeview1.DragMotion       += OnDragOver;
            treeview1.DragDrop         += OnDragDrop;
            treeview1.DragBegin        += OnDragBegin;
            treeview1.DragDataGet      += OnDragDataGet;
            treeview1.DragDataReceived += OnDragDataReceived;
            treeview1.DragEnd          += OnDragEnd;
            timer.Elapsed        += OnTimerElapsed;
            mainWidget.Destroyed += OnDestroyed;
        }
Ejemplo n.º 9
0
        /// <summary>Constructor</summary>
        public TreeView(ViewBase owner, Gtk.TreeView treeView) : base(owner)
        {
            treeview1       = treeView;
            treeview1.Model = treemodel;
            TreeViewColumn     column     = new TreeViewColumn();
            CellRendererPixbuf iconRender = new Gtk.CellRendererPixbuf();

            column.PackStart(iconRender, false);
            textRender                 = new Gtk.CellRendererText();
            textRender.Editable        = false;
            textRender.EditingStarted += OnBeforeLabelEdit;
            textRender.Edited         += OnAfterLabelEdit;
            column.PackStart(textRender, true);
            column.SetCellDataFunc(textRender, OnSetCellData);

            CellRendererText tickCell = new CellRendererText();

            tickCell.Editable = false;
            column.PackEnd(tickCell, false);
            column.SetAttributes(iconRender, "pixbuf", 1);
            column.SetAttributes(textRender, "text", 0);
            column.SetAttributes(tickCell, "text", 3);
            // column.SetCellDataFunc(textRender, treecelldatafunc);
            treeview1.AppendColumn(column);
            treeview1.TooltipColumn = 2;

            treeview1.CursorChanged      += OnAfterSelect;
            treeview1.ButtonReleaseEvent += OnButtonUp;
            treeview1.ButtonPressEvent   += OnButtonPress;
            treeview1.RowActivated       += OnRowActivated;
            treeview1.FocusInEvent       += OnTreeGainFocus;
            treeview1.FocusOutEvent      += OnTreeLoseFocus;

            TargetEntry[] target_table = new TargetEntry[] {
                new TargetEntry(modelMime, TargetFlags.App, 0)
            };

            Gdk.DragAction actions = Gdk.DragAction.Copy | Gdk.DragAction.Link | Gdk.DragAction.Move;
            // treeview1.EnableModelDragDest(target_table, actions);
            // treeview1.EnableModelDragSource(Gdk.ModifierType.Button1Mask, target_table, actions);
            Drag.SourceSet(treeview1, Gdk.ModifierType.Button1Mask, target_table, actions);
            Drag.DestSet(treeview1, 0, target_table, actions);
            treeview1.DragMotion       += OnDragOver;
            treeview1.DragDrop         += OnDragDrop;
            treeview1.DragBegin        += OnDragBegin;
            treeview1.DragDataGet      += OnDragDataGet;
            treeview1.DragDataReceived += OnDragDataReceived;
            treeview1.DragEnd          += OnDragEnd;
            timer.Elapsed += OnTimerElapsed;
        }
Ejemplo n.º 10
0
        private void SetDestDnD()
        {
            Drag.DestSet(
                packTreeView,
                DestDefaults.All,
                new TargetEntry[] { new TargetEntry("text/uri-list", TargetFlags.OtherApp, 0) },
                Gdk.DragAction.Copy);

            packTreeView.DragDataReceived += (o, args) =>
            {
                string data = Encoding.UTF8.GetString(args.SelectionData.Data, 0, args.SelectionData.Length - 1);
                data = Uri.UnescapeDataString(data);
                Drag.Finish(args.Context, true, false, args.Time);

                string[] files = data.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                // try to open pack
                if (fileSystem == null)
                {
                    if (files.Length == 1)
                    {
                        OpenPack(files.Select(
                                     path => path.StartsWith("file:///") ? path.Substring(8) : path).First());
                    }

                    return;
                }

                packTreeView.Selection.UnselectAll();

                files.Select(path => path.StartsWith("file:///") ? path.Substring(8) : path).ToList()
                .ForEach(path =>
                {
                    if (Directory.Exists(path))
                    {
                        Packer.Item folderItem = NewItem(currentFolder, path);
                        TreeIter folderIter    = AppendItem(currentFolder, folderItem);
                        AppendFolders(folderIter, path);
                    }
                    else
                    if (File.Exists(path))
                    {
                        AppendFile(currentFolder, path);
                    }
                });
            };
        }
Ejemplo n.º 11
0
        /// <summary>Default constructor for ExplorerView</summary>
        public ExplorerView(ViewBase owner) : base(owner)
        {
            Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.ExplorerView.glade", "vbox1");
            gxml.Autoconnect(this);
            _mainWidget = vbox1;
            RightHandView.ShadowType = ShadowType.EtchedOut;

            treeview1.Model = treemodel;
            TreeViewColumn     column     = new TreeViewColumn();
            CellRendererPixbuf iconRender = new Gtk.CellRendererPixbuf();

            column.PackStart(iconRender, false);
            textRender                 = new Gtk.CellRendererText();
            textRender.Editable        = true;
            textRender.EditingStarted += OnBeforeLabelEdit;
            textRender.Edited         += OnAfterLabelEdit;
            column.PackStart(textRender, true);
            column.SetAttributes(iconRender, "pixbuf", 1);
            column.SetAttributes(textRender, "text", 0);
            // column.SetCellDataFunc(textRender, treecelldatafunc);
            treeview1.AppendColumn(column);
            treeview1.TooltipColumn = 2;

            treeview1.CursorChanged      += OnAfterSelect;
            treeview1.ButtonReleaseEvent += OnButtonUp;

            TargetEntry[] target_table = new TargetEntry[] {
                new TargetEntry("application/x-model-component", TargetFlags.App, 0)
            };

            Gdk.DragAction actions = Gdk.DragAction.Copy | Gdk.DragAction.Link | Gdk.DragAction.Move;
            // treeview1.EnableModelDragDest(target_table, actions);
            // treeview1.EnableModelDragSource(Gdk.ModifierType.Button1Mask, target_table, actions);
            Drag.SourceSet(treeview1, Gdk.ModifierType.Button1Mask, target_table, actions);
            Drag.DestSet(treeview1, 0, target_table, actions);
            treeview1.DragMotion       += OnDragOver;
            treeview1.DragDrop         += OnDragDrop;
            treeview1.DragBegin        += OnDragBegin;
            treeview1.DragDataGet      += OnDragDataGet;
            treeview1.DragDataReceived += OnDragDataReceived;
            treeview1.DragEnd          += OnDragEnd;
            treeview1.DragDataDelete   += OnDragDataDelete;
            treeview1.FocusInEvent     += Treeview1_FocusInEvent;
            treeview1.FocusOutEvent    += Treeview1_FocusOutEvent;
            _mainWidget.Destroyed      += _mainWidget_Destroyed;
        }
Ejemplo n.º 12
0
        public ProjectView()
        {
            Build();

            basename = "base";

            var column = new TreeViewColumn();

            var iconCell = new CellRendererPixbuf();
            var textCell = new CellRendererText();
            var idCell   = new CellRendererText();

            idCell.Visible = false;

            column.PackStart(iconCell, false);
            column.PackStart(textCell, false);
            column.PackStart(idCell, false);

            treeview1.AppendColumn(column);

            column.AddAttribute(iconCell, "pixbuf", 0);
            column.AddAttribute(textCell, "text", 1);
            column.AddAttribute(idCell, "text", 2);

            listStore = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string));

            treeview1.Reorderable    = true;
            treeview1.Model          = listStore;
            treeview1.Selection.Mode = SelectionMode.Multiple;

            treeview1.ButtonPressEvent   += OnTreeview1ButtonPressEvent;
            treeview1.KeyReleaseEvent    += HandleKeyReleaseEvent;
            treeview1.ButtonReleaseEvent += OnTreeview1ButtonReleaseEvent;
            treeview1.CursorChanged      += OnTreeview1CursorChanged;

            Drag.SourceSet(this.treeview1, 0, null, Gdk.DragAction.Move);
            Drag.DestSet(this.treeview1, 0, null, 0);

            treeview1.DragBegin        += Treeview1_DragBegin;
            treeview1.DragMotion       += Treeview1_DragMotion;
            treeview1.DragDrop         += Treeview1_DragDrop;
            treeview1.DragDataReceived += Treeview1_DragDataReceived;
            treeview1.DragEnd          += Treeview1_DragEnd;
        }
Ejemplo n.º 13
0
        void SetDragDestToAllWidgets()
        {
            DragDropHelpers.ApplyToWidget(notebookDragDrop, delegate(Widget w) {
                Drag.DestSet(w,
                             DestDefaults.Motion | DestDefaults.Drop,
                             DragDropHelpers.TgtAll,
                             Gdk.DragAction.Move);

                w.DragDataReceived += delegate(object o, DragDataReceivedArgs args) {
                    // first delete
                    MyButton b = (MyButton)Drag.GetSourceWidget(args.Context);
                    b.Owner.SetData(null);
                    // then set...
                    object data =
                        DragDropHelpers.Deserialize(args.SelectionData);
                    SetItem(data);
                };
            });
        }
Ejemplo n.º 14
0
        public PreferencesWindow() :
            base(WindowType.Toplevel)
        {
            Build();
            IconName = "gnome-do";

            btn_close.IsFocus = true;

            TargetEntry [] targets = { new TargetEntry("text/uri-list", 0, 0) };
            Drag.DestSet(this, DestDefaults.All, targets, Gdk.DragAction.Copy);

            // Add notebook pages.
            foreach (IConfigurable page in Pages)
            {
                notebook.AppendPage(page.GetConfiguration(), new Label(page.Name));
            }

            // Sets default page to the plugins tab, a good default.
            notebook.CurrentPage = ManagePreferencesPreferencesPageIndex;
        }
Ejemplo n.º 15
0
 public static void DestSet(Widget widget, params string[] targets)
 {
     Drag.DestSet(widget, DestDefaults.All, new List <string>(targets).ConvertAll(
                      (target) => new TargetEntry(target, TargetFlags.App, 0)
                      ).ToArray(), Gdk.DragAction.Move);
 }
Ejemplo n.º 16
0
        public override void InitializeInterface()
        {
            Glade.XML gxml = new Glade.XML(null, "type-reflector.glade", "main_window", null);
            try {
                gxml.Autoconnect(this);
            } catch (Exception e) {
                Trace.WriteLineIf(info.TraceError,
                                  "Error with glade: " + e.ToString());
                throw;
            }

            memberStore    = new TreeStore(typeof(TreeCell));
            treeView.Model = memberStore;

            treeView.RowExpanded += new RowExpandedHandler(OnRowExpanded);

            TreeViewColumn column = new TreeViewColumn();

            column.Title = "Type Information";

#if SHOW_ICONS
            CellRenderer image = new CellRendererPixbuf();
            column.PackStart(image, false);
            // column.AddAttribute (image, "pixbuf", 2);
            column.SetCellDataFunc(image, new Gtk.TreeCellDataFunc(OnRenderCellIcon));
#endif

            CellRenderer text = new CellRendererText();
            column.PackStart(text, true);
            column.SetCellDataFunc(text, new Gtk.TreeCellDataFunc(OnRenderCellText));

            treeView.AppendColumn(column);

            CreateOptions();
            CreateFormatters();
            CreateFinders();

            // mark certain menu entries as disabled
            string[] menus =
            {
                "button_preferences",
                "reflector_preferences",
                "file_close",           "file_save",       "file_save_as",
                "edit_copy",
                // "edit_find",
                "edit_find_panel",      "edit_find_next",  "edit_find_prev",
                "edit_find_selection",
                // "window_new", "window_next", "window_prev",
                // "window_all_to_front",
                "help_manual"
            };
            foreach (string m in menus)
            {
                Widget menu = (Widget)gxml[m];
                menu.Sensitive = false;
            }

            appWindowInfo                = new AppWindowInfo();
            appWindowInfo.AppWindow      = mainWindow;
            appWindowInfo.AppMenu        = reflector_menu;
            appWindowInfo.WindowMenu     = window;
            appWindowInfo.FullscreenMenu = window_fullscreen;
            appWindowInfo.MaximizeMenu   = window_maximize;

            appWindows.Add(appWindowInfo);

            Drag.DestSet(mainWindow, DestDefaults.All, accept_table, Gdk.DragAction.Copy);
            mainWindow.DragDataReceived += new DragDataReceivedHandler(OnDropFiles);

            mainWindow.ShowAll();

            // Allow the interface to be fully rendered.  If we don't do this, and
            // we do (e.g.) --load-default-assemblies, then the UI will be
            // incompletely rendered until AddType is called, which could be awhile.
            while (GLib.MainContext.Iteration())
            {
                ;
            }
        }
Ejemplo n.º 17
0
 public static void DestSet(Widget w, DestDefaults d, TargetEntry[] t, Gdk.DragAction a)
 {
     Drag.DestSet(w, d, t, a);
     HandleDragScrolling(w);
 }
Ejemplo n.º 18
0
        private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow"))
        {
            this.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly().GetManifestResourceStream("LoopMusicPlayer.icon.ico"));
            Bass.Init();

            Bass.Configure(Configuration.UpdatePeriod, 1);
            Bass.Configure(Configuration.PlaybackBufferLength, 50);

            builder.Autoconnect(this);

            _seekbararea.AddTickCallback(onframetick);

            TitleNameCell  = new Gtk.CellRendererText();
            TimeCell       = new Gtk.CellRendererText();
            LoopCell       = new Gtk.CellRendererText();
            ArtistNameCell = new Gtk.CellRendererText();
            PathCell       = new Gtk.CellRendererText();

            _titlecolumn.PackStart(TitleNameCell, true);
            _timecolumn.PackStart(TimeCell, true);
            _loopcolumn.PackStart(LoopCell, true);
            _artistcolumn.PackStart(ArtistNameCell, true);
            _pathcolumn.PackStart(PathCell, true);

            _titlecolumn.AddAttribute(TitleNameCell, "text", 0);
            _timecolumn.AddAttribute(TimeCell, "text", 1);
            _loopcolumn.AddAttribute(LoopCell, "text", 2);
            _artistcolumn.AddAttribute(ArtistNameCell, "text", 3);
            _pathcolumn.AddAttribute(PathCell, "text", 4);

            DeleteEvent += Window_DeleteEvent;

            var targets = new[] {
                new TargetEntry("text/uri-list", TargetFlags.OtherApp, 0)
            };

            Drag.DestSet(this, DestDefaults.All, targets, Gdk.DragAction.Copy | Gdk.DragAction.Move);
            DragDataReceived += TreeViewDragDataReceived;
            this.AddEvents((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask));

            _labelseektimemenu.Toggle();
            _singlerepeat.Toggle();
            _streamingplay.Toggle();
            UpdateLoopCountLabel();
            _aboutmenu.Activated       += ShowAbout;
            _listaddmenu.Activated     += OpenFileFromMenu;
            _seekbararea.Drawn         += DrawingArea_OnDraw;
            _quitmenu.Activated        += WindowQuit;
            _listclearmenu.Activated   += ListClear;
            _listdeletemenu.Activated  += ListDelete;
            _treeview.RowActivated     += ActivateLow;
            _volumebutton.ValueChanged += VolumeChanged;
            _pausebutton.Clicked       += PauseClicked;
            _stopbutton.Clicked        += StopClicked;
            _playbutton.Clicked        += PlayClicked;
            _previousbutton.Clicked    += PreviousClicked;
            _nextbutton.Clicked        += NextClicked;
            _ejectbutton.Clicked       += EjectClicked;
            _streamingplay.Toggled     += EjectClicked;
            _onmemoryplay.Toggled      += EjectClicked;
            _seekbararea.AddEvents((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask));
            _seekbararea.ButtonPressEvent   += SeekBarButtonPress;
            _seekbararea.ButtonReleaseEvent += SeekBarButtonRelease;
            _windowkeepabovemenu.Toggled    += WindowAboveToggled;
            _showgridlinemenu.Toggled       += ShowGridMenuToggled;
            _loopcountupbutton.Clicked      += LoopCountUpButtonClicked;
            _loopcountdownbutton.Clicked    += LoopCountDownButtonClicked;
            _singleplay.Toggled             += LoopMethodToggled;
            _singlerepeat.Toggled           += LoopMethodToggled;
            _allrepeat.Toggled  += LoopMethodToggled;
            _randomplay.Toggled += LoopMethodToggled;
        }