コード例 #1
0
ファイル: IntEditor.cs プロジェクト: yuluos/CocoStudio2.0.6
        public Widget ResolveEditor(PropertyItem item = null)
        {
            if (this._propertyItem.DiaplayName != "Display_FontSize")
            {
                this.widget = (Widget) new UndoEntryIntEx();
                (this.widget as UndoEntryIntEx).SetEntryPRoperty(true, 0, 1.0);
                if (this._propertyItem.InstanceCount > 1)
                {
                    this.widget.Sensitive = false;
                }
                else
                {
                    this.SetControl();
                    if (this._propertyItem.ValueRangeDescriptor != null)
                    {
                        (this.widget as UndoEntryIntEx).MaxValue  = this._propertyItem.ValueRangeDescriptor.MaxValue;
                        (this.widget as UndoEntryIntEx).MinValue  = this._propertyItem.ValueRangeDescriptor.MinValue;
                        (this.widget as UndoEntryIntEx).ScrollNum = this._propertyItem.ValueRangeDescriptor.Step;
                    }
                    (this.widget as UndoEntryIntEx).EntryValueChanged += new EventHandler <EntryIntEventArgs>(this.IntEditor_Changed);
                }
                return(this.widget);
            }
            ComboBoxEntry comboBoxEntry = new ComboBoxEntry();
            ListStore     listStore     = new ListStore(new Type[1] {
                typeof(string)
            });

            foreach (int combox in this.comboxList)
            {
                listStore.AppendValues(new object[1]
                {
                    (object)combox.ToString()
                });
            }
            comboBoxEntry.Model = (TreeModel)listStore;
            CellRendererText cellRendererText = new CellRendererText();

            comboBoxEntry.PackStart((CellRenderer)cellRendererText, true);
            comboBoxEntry.AddAttribute((CellRenderer)cellRendererText, "text", 0);
            object obj   = this._propertyItem.PropertyData.GetValue(this._propertyItem.Instance, (object[])null);
            int    index = this.IndexCombox((int)obj);

            if (index == -1)
            {
                comboBoxEntry.Entry.Text = obj.ToString();
            }
            else
            {
                comboBoxEntry.Active     = index;
                comboBoxEntry.Entry.Text = this.comboxList[index].ToString();
            }
            this.widget = (Widget)comboBoxEntry;
            (this.widget as ComboBoxEntry).Changed += new EventHandler(this.combox_Changed);
            (this.widget as ComboBoxEntry).Entry.KeyReleaseEvent += new KeyReleaseEventHandler(this.Entry_KeyReleaseEvent);
            (this.widget as ComboBoxEntry).Entry.FocusOutEvent   += new FocusOutEventHandler(this.Entry_FocusOutEvent);
            (this.widget as ComboBoxEntry).Entry.Changed         += new EventHandler(this.Entry_Changed);
            this.widget = (Widget)comboBoxEntry;
            return(this.widget);
        }
コード例 #2
0
        public void BindStateOut()
        {
            if (TaskStateSource != null)
            {
                fStateOutStore = new ListStore(typeof(int), typeof(string));
                cbStateOut.Clear();
                foreach (DataRow row in TaskStateSource.Tables["TaskState"].Rows)
                {
                    fStateOutStore.AppendValues((int)row["ID"], (string)row["Name"]);
                }

                cbStateOut.Model = fStateOutStore;
                CellRendererText stateText = new CellRendererText();
                stateText.Style = Pango.Style.Oblique;
                cbStateOut.PackStart(stateText, true);
                cbStateOut.AddAttribute(stateText, "text", 1);
                TreeIter iter;
                if (fStateOutStore.GetIterFirst(out iter))
                {
                    cbStateOut.SetActiveIter(iter);
                }
            }
            else
            {
                throw new ManagementException(ExceptionType.NotAllowed, "TaskStateSource not set to instance");
            }
        }
コード例 #3
0
        public void BindActor()
        {
            fActorStore = new ListStore(typeof(int), typeof(string));
            cbActor.Clear();
            foreach (DataRow row in ActorSource.Tables["Actor"].Rows)
            {
                fActorStore.AppendValues((int)row["ID"], (string)row["Name"]);
            }

            cbActor.Model = fActorStore;
            CellRendererText actorText = new CellRendererText();

            actorText.Style = Pango.Style.Oblique;

            //actorText.BackgroundGdk = new Gdk.Color(0x63,0,0);
            cbActor.PackStart(actorText, true);
            cbActor.AddAttribute(actorText, "text", 1);
            TreeIter iter;

            if (fActorStore.GetIterFirst(out iter))
            {
                cbActor.SetActiveIter(iter);
                fActorID = (int)ActorSource.Tables["Actor"].Rows[0]["ID"];
            }
        }
コード例 #4
0
        public void BindState()
        {
            fStateStore = new ListStore(typeof(int), typeof(string));
            cbState.Clear();
            foreach (DataRow row in StateSource.Tables["TaskState"].Rows)
            {
                fStateStore.AppendValues((int)row["ID"], (string)row["Name"]);
            }

            cbState.Model = fStateStore;
            CellRendererText stateText = new CellRendererText();

            cbState.PackStart(stateText, true);
            cbState.AddAttribute(stateText, "text", 1);
            TreeIter iter;

            if (fStateStore.GetIterFirst(out iter))
            {
                cbState.SetActiveIter(iter);
                fStateID = (int)StateSource.Tables["TaskState"].Rows[0]["ID"];
            }
        }
コード例 #5
0
ファイル: Pads.cs プロジェクト: saamerm/Continuous
        void PopulateHostEntry()
        {
            var devs   = Env.Discovery.Devices;
            var active = hostEntry.ActiveText;

            hostEntry.Clear();
            var cell = new CellRendererText();

            hostEntry.PackStart(cell, false);
            hostEntry.AddAttribute(cell, "text", 0);
            hostEntry.TextColumn = 0;
            var store = new ListStore(typeof(string));

            if (!string.IsNullOrWhiteSpace(active) && !devs.Contains(active))
            {
                store.AppendValues(active);
            }
            store.AppendValues(devs);

            hostEntry.Model = store;
            Console.WriteLine(devs);
        }