Exemple #1
0
            public PropertyBox(ItemInfo owner) : base(false, 12)
            {
                this.owner = owner;

                this.captionLbls = new Label[MAX_ITEM_PROPERTIES];
                this.valueLbls   = new Label[MAX_ITEM_PROPERTIES];

                this.lblName           = WindowBase.CreateLabel(string.Empty, true);
                this.lblName.Ellipsize = Pango.EllipsizeMode.End;

                this.tbls = new Table[WIDTH];
                this.hbox = new HBox(false, 12);

                for (int i = 0; i < WIDTH; i++)
                {
                    this.tbls[i] = WindowBase.CreateTable(HEIGHT, 2, 6);                     // 2 = caption + value
                    this.hbox.PackStart(tbls[i], true, true, 0);
                }

                int tbl = 0, y = 0;

                for (int i = 0; i < MAX_ITEM_PROPERTIES; i++, y++)
                {
                    if (i == HEIGHT)
                    {
                        y = 0;
                        tbl++;
                    }

                    // create caption label
                    this.captionLbls[i] = WindowBase.CreateLabel(string.Empty, true);

                    // create value label
                    this.valueLbls[i]           = WindowBase.CreateLabel(string.Empty, false);
                    this.valueLbls[i].Ellipsize = Pango.EllipsizeMode.End;

                    // attach caption and value labels to the table
                    WindowBase.TblAttach(tbls[tbl], captionLbls[i], 0, y);
                    this.tbls[tbl].Attach(valueLbls[i], 1, 2, (uint)y, (uint)(y + 1));
                }

                // custom button
                HBox hb = new HBox(false, 6);

                this.btnArrow = new Arrow(ArrowType.Down, ShadowType.None);
                hb.PackStart(btnArrow, false, false, 0);
                hb.PackStart(lblName, true, true, 0);

                Button btn = new Button(hb);

                btn.Clicked += OnBtnClicked;

                this.PackStart(btn, true, false, 0);
                this.PackStart(hbox, true, true, 0);
            }