コード例 #1
0
        public JoinChatroomDialog(Window parent) : base(parent, "JoinChatroomDialog")
        {
            passwordEntry.Text = "";

            networksListStore = new ListStore(typeof(object));
            networksListStore.AppendValues(new object());
            foreach (Network network in Core.Networks)
            {
                networksListStore.AppendValues(network);
            }

            roomListStore = new ListStore(typeof(string), typeof(ChatRoom));

            CellRendererText textCell = new CellRendererText();

            networkCombo.PackStart(textCell, true);
            networkCombo.SetCellDataFunc(textCell, new CellLayoutDataFunc(networkComboBox_TextFunc));
            networkCombo.Model = networksListStore;

            roomNameCombo.Entry.Changed         += roomNameCombo_Entry_Changed;
            roomNameCombo.Entry.ActivatesDefault = true;
            roomNameCombo.Entry.Text             = "#";

            var imageCell = new CellRendererPixbuf();

            roomNameCombo.PackEnd(imageCell, false);
            roomNameCombo.SetCellDataFunc(imageCell, RoomComboImageFunc);

            roomNameCombo.Model      = roomListStore;
            roomNameCombo.TextColumn = 0;

            if (networksListStore.IterNChildren() > 0)
            {
                networkCombo.Active = 1;
                roomNameCombo.Entry.GrabFocus();
                roomNameCombo.Entry.SelectRegion(1, 1);
            }
            else
            {
                networkCombo.Active = 0;
            }

            base.Dialog.Shown += delegate {
                roomNameCombo.Entry.SelectRegion(1, 1);
            };

            EnableDisableOkButton();
        }