~ubuntu-branches/ubuntu/natty/smuxi/natty

« back to all changes in this revision

Viewing changes to src/Frontend-SWF/Chats/GroupChatView.cs

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2009-01-31 18:02:54 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090131180254-7eyq547fy2gmgjow
Tags: 0.6.3-2ubuntu1
Merge from Debian(Unstable), remaining changes:
-debian/control:
Replace lib{gnome/gconf)2.0-cil with lib{gnome/gconf)2.24-cil
and bump versioning

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
{
36
36
    [ChatViewInfo(ChatType = ChatType.Group)]
37
37
    public class GroupChatView : ChatView
38
 
    {
39
 
        private TextBox _TopicTextView;
 
38
    {
 
39
        private TextBox _TopicTextView;
40
40
        private ListBox _PersonListBox;
41
41
 
42
42
        public GroupChatView(ChatModel chat) :
43
43
                        base(chat)
44
 
        {
45
 
            InitializeComponents();
46
 
 
47
 
        }
48
 
 
49
 
 
50
 
        public GroupChatModel GroupChatModel {
51
 
            get {
52
 
                return (GroupChatModel)base.ChatModel;
53
 
            }
54
 
        }
55
 
 
56
 
        private void InitializeComponents()
57
 
        {
58
 
            Splitter personListBoxSplitter = new Splitter();
59
 
            this._TopicTextView = new TextBox();
60
 
            this._PersonListBox = new ListBox();
 
44
        {
 
45
            InitializeComponents();
 
46
 
 
47
        }
 
48
 
 
49
 
 
50
        public GroupChatModel GroupChatModel {
 
51
            get {
 
52
                return (GroupChatModel)base.ChatModel;
 
53
            }
 
54
        }
 
55
 
 
56
        private void InitializeComponents()
 
57
        {
 
58
            Splitter personListBoxSplitter = new Splitter();
 
59
            this._TopicTextView = new TextBox();
 
60
            this._PersonListBox = new ListBox();
61
61
            this.SuspendLayout();
62
62
 
63
 
            // _TopicTextView
64
 
            this._TopicTextView.ReadOnly = true;
65
 
            this._TopicTextView.Name = "_TopicTextView";
 
63
            // _TopicTextView
 
64
            this._TopicTextView.ReadOnly = true;
 
65
            this._TopicTextView.Name = "_TopicTextView";
66
66
            this._TopicTextView.Dock = DockStyle.Top;
67
67
 
68
 
            // _PersonListBox
69
 
            this._PersonListBox.Name = "_PersonListBox";
70
 
            this._PersonListBox.Dock = DockStyle.Right;
71
 
            this._PersonListBox.IntegralHeight = false;
72
 
 
73
 
            // personListBoxSplitter
74
 
            personListBoxSplitter.Dock = DockStyle.Right;
75
 
 
76
 
            this.Controls.Add(base.OutputTextView);
77
 
            this.Controls.Add(_TopicTextView);
78
 
            this.Controls.Add(personListBoxSplitter);
79
 
            this.Controls.Add(_PersonListBox);
80
 
 
 
68
            // _PersonListBox
 
69
            this._PersonListBox.Name = "_PersonListBox";
 
70
            this._PersonListBox.Dock = DockStyle.Right;
 
71
            this._PersonListBox.IntegralHeight = false;
 
72
 
 
73
            // personListBoxSplitter
 
74
            personListBoxSplitter.Dock = DockStyle.Right;
 
75
 
 
76
            this.Controls.Add(base.OutputTextView);
 
77
            this.Controls.Add(_TopicTextView);
 
78
            this.Controls.Add(personListBoxSplitter);
 
79
            this.Controls.Add(_PersonListBox);
 
80
 
81
81
            this.ResumeLayout();
82
 
 
83
 
        }
84
 
 
85
 
        public override void ApplyConfig(UserConfig config)
86
 
        {
87
 
            base.ApplyConfig(config);
88
 
            if (BackgroundColor.HasValue) _PersonListBox.BackColor = _TopicTextView.BackColor = BackgroundColor.Value;
89
 
            if (BackgroundColor.HasValue) _PersonListBox.ForeColor = _TopicTextView.ForeColor = ForegroundColor.Value;
90
 
            _PersonListBox.Font = _TopicTextView.Font = Font;
91
 
            _PersonListBox.Width = TextRenderer.MeasureText("999999999", Font).Width;
 
82
 
 
83
        }
 
84
 
 
85
        public override void ApplyConfig(UserConfig config)
 
86
        {
 
87
            base.ApplyConfig(config);
 
88
            if (BackgroundColor.HasValue) _PersonListBox.BackColor = _TopicTextView.BackColor = BackgroundColor.Value;
 
89
            if (BackgroundColor.HasValue) _PersonListBox.ForeColor = _TopicTextView.ForeColor = ForegroundColor.Value;
 
90
            _PersonListBox.Font = _TopicTextView.Font = Font;
 
91
            _PersonListBox.Width = TextRenderer.MeasureText("999999999", Font).Width;
92
92
        }
93
93
 
94
94
        public void AddPerson(PersonModel person)
95
 
        {
 
95
        {
96
96
            _PersonListBox.Items.Add(person.IdentityName);
97
97
        }
98
98
 
99
99
        public void UpdatePerson(PersonModel oldPerson, PersonModel newPerson)
100
 
        {
101
 
            _PersonListBox.Items.Remove(oldPerson.IdentityName);
 
100
        {
 
101
            _PersonListBox.Items.Remove(oldPerson.IdentityName);
102
102
            _PersonListBox.Items.Add(newPerson.IdentityName);
103
103
        }
104
104
 
105
105
        public void RemovePerson(PersonModel person)
106
 
        {
 
106
        {
107
107
            _PersonListBox.Items.Remove(person.IdentityName);
108
 
        }
109
 
 
110
 
        public override void Sync()
111
 
        {
112
 
            base.Sync();
113
 
            foreach (PersonModel person in GroupChatModel.Persons.Values) {
114
 
                _PersonListBox.Items.Add(person.IdentityName);
115
 
            }
116
 
        }
117
 
 
118
 
        public override void Disable()
119
 
        {
120
 
            base.Disable();
121
 
            _PersonListBox.Items.Clear();
122
 
            _TopicTextView.Clear();
 
108
        }
 
109
 
 
110
        public override void Sync()
 
111
        {
 
112
            base.Sync();
 
113
            foreach (PersonModel person in GroupChatModel.Persons.Values) {
 
114
                _PersonListBox.Items.Add(person.IdentityName);
 
115
            }
 
116
        }
 
117
 
 
118
        public override void Disable()
 
119
        {
 
120
            base.Disable();
 
121
            _PersonListBox.Items.Clear();
 
122
            _TopicTextView.Clear();
123
123
        }
124
124
    }
125
125
}