public override void Initialize()
 {
     textView = new GtkMultilineTextEntry();
     Widget   = new Gtk.Frame();
     ((Gtk.Frame)Widget).Add(textView);
     ((Gtk.Frame)Widget).ShadowType = Gtk.ShadowType.In;
     Widget.ShowAll();
     ShowFrame = true;
     InitializeMultiLine();
 }
Esempio n. 2
0
 // Drag function for automatic sources, called from DragBegin
 public static void Drag(Gtk.Widget source, Gdk.DragContext ctx, WidgetDropCallback dropCallback, string label)
 {
     Gtk.Frame fr = new Gtk.Frame();
     fr.ShadowType = Gtk.ShadowType.Out;
     Gtk.HBox box = new Gtk.HBox();
     box.Spacing     = 3;
     box.BorderWidth = 3;
     box.PackStart(new Gtk.Image(widgetIcon), false, false, 0);
     Gtk.Label lab = new Gtk.Label(label);
     lab.Xalign = 0;
     box.PackStart(lab, true, true, 0);
     fr.Add(box);
     fr.ShowAll();
     Drag(source, ctx, dropCallback, fr);
 }
Esempio n. 3
0
        void UpdatePointerTextBox(Gtk.Entry entry, ValueReference r)
        {
            pointerFrame.Remove(pointerFrame.Child);

            subEditor = new ObjectGroupEditor();
            Gtk.Alignment alignment = new Gtk.Alignment(0.5F, 0.5F, 0.0F, 0.8F);
            try {
                Project.GetFileWithLabel(entry.Text.Trim());
                subEditor.SetObjectGroup(Project.GetDataType <ObjectGroup>(r.GetStringValue()));
                subEditor.ShowAll();
                alignment.Add(subEditor);
                r.SetValue(entry.Text.Trim());
            }
            catch (InvalidLookupException) {
                subEditor.SetObjectGroup(null);
                Gtk.Label label = new Gtk.Label("Error: label \"" + entry.Text + "\" not found.");
                label.Show();
                alignment.Add(label);
            }
            pointerFrame.Label = entry.Text;
            pointerFrame.Add(alignment);
            pointerFrame.ShowAll();
        }
Esempio n. 4
0
File: DND.cs Progetto: mono/stetic
 // Drag function for automatic sources, called from DragBegin
 public static void Drag(Gtk.Widget source, Gdk.DragContext ctx, WidgetDropCallback dropCallback, string label)
 {
     Gtk.Frame fr = new Gtk.Frame ();
     fr.ShadowType = Gtk.ShadowType.Out;
     Gtk.HBox box = new Gtk.HBox ();
     box.Spacing = 3;
     box.BorderWidth = 3;
     box.PackStart (new Gtk.Image (widgetIcon), false, false, 0);
     Gtk.Label lab = new Gtk.Label (label);
     lab.Xalign = 0;
     box.PackStart (lab, true, true, 0);
     fr.Add (box);
     fr.ShowAll ();
     Drag (source, ctx, dropCallback, fr);
 }
        public virtual void Initialize(string label, string icon, NodeBuilder[] builders, TreePadOption[] options)
        {
            // Create default options

            this.options = options;
            globalOptions = new TreeOptions ();
            foreach (TreePadOption op in options)
                globalOptions [op.Id] = op.DefaultValue;

            globalOptions.Pad = this;

            // Check that there is only one node builder per type

            Hashtable bc = new Hashtable ();
            foreach (NodeBuilder nb in builders) {
                TypeNodeBuilder tnb = nb as TypeNodeBuilder;
                if (tnb != null) {
                    TypeNodeBuilder other = (TypeNodeBuilder) bc [tnb.NodeDataType];
                    if (other != null)
                        throw new ApplicationException (string.Format ("The type node builder {0} can't be used in this context because the type {1} is already handled by {2}", nb.GetType(), tnb.NodeDataType, other.GetType()));
                    bc [tnb.NodeDataType] = tnb;
                }
                else if (!(nb is NodeBuilderExtension))
                    throw new InvalidOperationException (string.Format ("Invalid NodeBuilder type: {0}. NodeBuilders must inherit either from TypeNodeBuilder or NodeBuilderExtension", nb.GetType()));
            }

            NodeBuilders = builders;
            Title = label;
            Icon = icon;

            builderContext = new TreeBuilderContext (this);

            tree = new Gtk.TreeView ();

            /*
            0 -- Text
            1 -- Icon (Open)
            2 -- Icon (Closed)
            3 -- Node Data
            4 -- Builder chain
            5 -- Pango weight
            6 -- Expanded
            */
            store = new Gtk.TreeStore (typeof (string), typeof (Gdk.Pixbuf), typeof (Gdk.Pixbuf), typeof (object), typeof (object), typeof(int), typeof(bool));
            tree.Model = store;

            tree.EnableModelDragDest (target_table, Gdk.DragAction.Copy | Gdk.DragAction.Move);
            Gtk.Drag.SourceSet (tree, Gdk.ModifierType.Button1Mask, target_table, Gdk.DragAction.Copy | Gdk.DragAction.Move);

            store.DefaultSortFunc = new Gtk.TreeIterCompareFunc (CompareNodes);
            store.SetSortColumnId (/* GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID */ -1, Gtk.SortType.Ascending);

            tree.HeadersVisible = false;
            tree.SearchColumn = 0;
            tree.EnableSearch = true;
            complete_column = new Gtk.TreeViewColumn ();
            complete_column.Title = "column";

            Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf ();
            complete_column.PackStart (pix_render, false);
            complete_column.AddAttribute (pix_render, "pixbuf", OpenIconColumn);
            complete_column.AddAttribute (pix_render, "pixbuf-expander-open", OpenIconColumn);
            complete_column.AddAttribute (pix_render, "pixbuf-expander-closed", ClosedIconColumn);

            text_render = new Gtk.CellRendererText ();
            text_render.Edited += new Gtk.EditedHandler (HandleOnEdit);

            complete_column.PackStart (text_render, true);
            complete_column.AddAttribute (text_render, "text", TextColumn);
            complete_column.AddAttribute (text_render, "weight", WeightColumn);

            tree.AppendColumn (complete_column);

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
            sw.Add(tree);
            contentPanel = new Gtk.Frame ();
            contentPanel.Add(sw);

            tree.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow);
            tree.RowActivated += new Gtk.RowActivatedHandler(OnNodeActivated);

            contentPanel.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(OnButtonRelease);
            contentPanel.PopupMenu += new Gtk.PopupMenuHandler (OnPopupMenu);

            foreach (NodeBuilder nb in builders)
                nb.SetContext (builderContext);

            workNode = new TreeNodeNavigator (this);
            compareNode1 = new TreeNodeNavigator (this);
            compareNode2 = new TreeNodeNavigator (this);

            tree.DragBegin += new Gtk.DragBeginHandler (OnDragBegin);
            tree.DragDataReceived += new Gtk.DragDataReceivedHandler (OnDragDataReceived);
            tree.DragDrop += new Gtk.DragDropHandler (OnDragDrop);
            tree.DragEnd += new Gtk.DragEndHandler (OnDragEnd);
            tree.DragMotion += new Gtk.DragMotionHandler (OnDragMotion);

            tree.CursorChanged += new EventHandler (OnSelectionChanged);

            contentPanel.ShowAll ();
        }