예제 #1
0
 private void FontSizeComboxInit()
 {
     if (this.fontSizeType == null)
     {
         this.combox.Hide();
     }
     else
     {
         this.combox.Entry.FocusOutEvent += new FocusOutEventHandler(this.Entry_FocusOutEvent);
         this.combox.Entry.MaxLength      = 3;
         this.combox.Changed             += new EventHandler(this.combox_Changed);
         this.fontsize = (int)this.TriggerObject.GetType().GetProperty(this.fontSizeType).GetValue(this.TriggerObject, (object[])null);
         ListStore listStore = new ListStore(new Type[1] {
             typeof(string)
         });
         foreach (int combox in this.comboxList)
         {
             listStore.AppendValues(new object[1]
             {
                 (object)combox.ToString()
             });
         }
         this.combox.Model = (TreeModel)listStore;
         CellRendererText cellRendererText = new CellRendererText();
         this.combox.PackStart((CellRenderer)cellRendererText, true);
         this.combox.AddAttribute((CellRenderer)cellRendererText, "text", 0);
         int index = this.IndexCombox(this.fontsize);
         if (index == -1)
         {
             this.combox.Entry.Text = this.fontsize.ToString();
         }
         else
         {
             this.combox.Active     = index;
             this.combox.Entry.Text = this.comboxList[index].ToString();
         }
     }
 }
예제 #2
0
        public Gtk.Widget ResolveEditor(PropertyItem item = null)
        {
            this.Widget              = new Table(2U, 2U, false);
            this.color               = new ColorEx();
            this.combox              = new ComboBoxEntry();
            this.import              = new ResourceFileImport(this._propertyItem, LanguageInfo.Property_ImportFont, "");
            this.color.ColorChanged += new EventHandler <ColorExEvent>(this.color_ColorChanged);
            this.combox              = 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()
                });
            }
            this.combox.Model = (TreeModel)listStore;
            CellRendererText cellRendererText = new CellRendererText();

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

            if (index == -1)
            {
                this.combox.Entry.Text = obj.ToString();
                this.comboxOldValue    = (int)obj;
            }
            else
            {
                this.combox.Active     = index;
                this.combox.Entry.Text = this.comboxList[index].ToString();
                this.comboxOldValue    = this.comboxList[index];
            }
            this.combox.WidthRequest           = 60;
            this.combox.Changed               += new EventHandler(this.combox_Changed);
            this.combox.Entry.KeyReleaseEvent += new KeyReleaseEventHandler(this.Entry_KeyReleaseEvent);
            this.combox.Entry.FocusOutEvent   += new FocusOutEventHandler(this.Entry_FocusOutEvent);
            this.combox.Entry.Changed         += new EventHandler(this.Entry_Changed);
            object property = (object)this._propertyItem.Instance.GetType().GetProperty("TextColor");

            this.colorText = "TextColor";
            if (property == null)
            {
                property       = (object)this._propertyItem.Instance.GetType().GetProperty("CColor");
                this.colorText = "CColor";
            }
            if (property != null)
            {
                this.Widget = new Table(2U, 3U, false);
                this.Widget.Attach((Gtk.Widget) this.color, 0U, 1U, 0U, 1U, AttachOptions.Fill, AttachOptions.Fill, 0U, 0U);
                this.Widget.Attach((Gtk.Widget) this.combox, 1U, 2U, 0U, 1U, AttachOptions.Fill, AttachOptions.Fill, 0U, 0U);
                this.Widget.Attach((Gtk.Widget) new Label(), 2U, 3U, 0U, 1U, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0U, 0U);
                this.Widget.Attach((Gtk.Widget) this.import, 0U, 3U, 1U, 2U, AttachOptions.Fill, AttachOptions.Fill, 0U, 0U);
            }
            else
            {
                this.Widget = new Table(2U, 1U, false);
                this.Widget.Attach((Gtk.Widget) this.combox, 0U, 1U, 0U, 1U, AttachOptions.Fill, AttachOptions.Fill, 0U, 0U);
                this.Widget.Attach((Gtk.Widget) this.import, 0U, 2U, 1U, 3U, AttachOptions.Fill, AttachOptions.Fill, 0U, 0U);
            }
            this.SetColorValue();
            this.Widget.ShowAll();
            this.Widget.RowSpacing    = 6U;
            this.Widget.ColumnSpacing = 30U;
            return((Gtk.Widget) this.Widget);
        }