~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to samples/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/Panels/CustObjectPanel.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// <file>
 
2
//     <copyright see="prj:///doc/copyright.txt"/>
 
3
//     <license see="prj:///doc/license.txt"/>
 
4
//     <owner name="Oakland Software Incorporated" email="general@oaklandsoftware.com"/>
 
5
//     <version>$Revision$</version>
 
6
// </file>
 
7
 
 
8
using System;
 
9
using System.Drawing;
 
10
using System.Windows.Forms;
 
11
 
 
12
using ICSharpCode.Core;
 
13
using NoGoop.Controls;
 
14
 
 
15
namespace NoGoop.ObjBrowser.Panels
 
16
{
 
17
        internal class CustObjectPanel : Panel, ICustPanel
 
18
        {
 
19
                protected CheckBox          _showPropMethCheck;
 
20
                protected CheckBox          _showFieldsCheck;
 
21
                protected CheckBox          _showPropertiesCheck;
 
22
                protected CheckBox          _showMethodsCheck;
 
23
                protected CheckBox          _showEventsCheck;
 
24
                protected CheckBox          _showBaseClassesCheck;
 
25
                protected CheckBox          _showPublicOnlyCheck;
 
26
                protected CheckBox          _showBaseClassNamesCheck;
 
27
                protected CheckBox          _showMemberCategoriesCheck;
 
28
                protected CheckBox          _showObjectAsBaseCheck;
 
29
                protected CheckBox          _showBaseCategoriesCheck;
 
30
                protected CheckBox          _hexDisplayCheck;
 
31
                protected TextBox           _showCategoriesCount;
 
32
 
 
33
                protected Panel             _showCatCountPanel;
 
34
 
 
35
                protected const int         FIELD_WIDTH = 270;
 
36
 
 
37
                internal CustObjectPanel()
 
38
                {
 
39
                        Panel panel;
 
40
                        Label l;
 
41
 
 
42
                        Text = StringParser.Parse("${res:ComponentInspector.InspectorMenu.ObjectTreeOptionsPanel.Title}");
 
43
 
 
44
                        // Other panel
 
45
                        panel = new Panel();
 
46
                        panel.Dock = DockStyle.Top;
 
47
                        panel.Height = 50;
 
48
                        Controls.Add(panel);
 
49
 
 
50
                        _hexDisplayCheck = new CheckBox();
 
51
                        _hexDisplayCheck.Location = new Point(10, 0);
 
52
                        _hexDisplayCheck.Width = FIELD_WIDTH;
 
53
                        _hexDisplayCheck.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.DisplayIntegersInHexCheckBox}");
 
54
                        panel.Controls.Add(_hexDisplayCheck);
 
55
 
 
56
                        _showBaseClassNamesCheck = new CheckBox();
 
57
                        _showBaseClassNamesCheck.Location = new Point(10, 20);
 
58
                        _showBaseClassNamesCheck.Width = FIELD_WIDTH;
 
59
                        _showBaseClassNamesCheck.Text = StringParser.Parse("${res:ComponentInspector.CustomObjectPanel.ShowBaseClassNamesCheckBox}");
 
60
                        panel.Controls.Add(_showBaseClassNamesCheck);
 
61
 
 
62
                        l = new Label();
 
63
                        l.Dock = DockStyle.Top;
 
64
                        l.Text = StringParser.Parse("${res:ComponentInspector.CustomObjectPanel.OtherLabel}");
 
65
                        l.AutoSize = true;
 
66
                        Controls.Add(l);
 
67
 
 
68
 
 
69
                        // Categories panel
 
70
                        panel = new Panel();
 
71
                        panel.Dock = DockStyle.Top;
 
72
                        panel.Height = 95;
 
73
                        Controls.Add(panel);
 
74
 
 
75
                        _showMemberCategoriesCheck = new CheckBox();
 
76
                        _showMemberCategoriesCheck.Location = new Point(10, 0);
 
77
                        _showMemberCategoriesCheck.Width = FIELD_WIDTH;
 
78
                        _showMemberCategoriesCheck.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.ShowMemberCategoriesCheckBox}");
 
79
                        _showMemberCategoriesCheck.Click +=  new EventHandler(ShowCatClicked);
 
80
                        panel.Controls.Add(_showMemberCategoriesCheck);
 
81
 
 
82
                        _showBaseCategoriesCheck = new CheckBox();
 
83
                        _showBaseCategoriesCheck.Location = new Point(10, 20);
 
84
                        _showBaseCategoriesCheck.Width = FIELD_WIDTH;
 
85
                        _showBaseCategoriesCheck.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.ShowBaseClassCategoryCheckBox}");
 
86
                        _showBaseCategoriesCheck.Click += new EventHandler(ShowCatClicked);
 
87
                        panel.Controls.Add(_showBaseCategoriesCheck);
 
88
 
 
89
                        _showCatCountPanel = new Panel();
 
90
                        _showCatCountPanel.Location = new Point(27, 45);
 
91
                        _showCatCountPanel.Width = FIELD_WIDTH;
 
92
                        _showCategoriesCount = new NumericTextBox();
 
93
                        _showCategoriesCount.Width = 30;
 
94
                        _showCategoriesCount.Height = 25;
 
95
                        _showCategoriesCount.Dock = DockStyle.Left;
 
96
                        _showCatCountPanel.Controls.Add(_showCategoriesCount);
 
97
                        l = new Label();
 
98
                        l.Dock = DockStyle.Left;
 
99
                        l.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.CategoryCountLabel}");
 
100
                        l.AutoSize = true;
 
101
                        //l.Width = 150;
 
102
                        _showCatCountPanel.Controls.Add(l);
 
103
                        _showCatCountPanel.Height = _showCategoriesCount.Height;
 
104
                        panel.Controls.Add(_showCatCountPanel);
 
105
 
 
106
                        _showObjectAsBaseCheck = new CheckBox();
 
107
                        _showObjectAsBaseCheck.Location = new Point(10, 65);
 
108
                        _showObjectAsBaseCheck.Width = FIELD_WIDTH;
 
109
                        _showObjectAsBaseCheck.Text = StringParser.Parse("${res:ComponentInspector.CustomObjectPanel.ShowObjectAsBaseCheckBox}");
 
110
                        panel.Controls.Add(_showObjectAsBaseCheck);
 
111
 
 
112
                        l = new Label();
 
113
                        l.Dock = DockStyle.Top;
 
114
                        l.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.CategoriesGroupBox}");
 
115
                        l.AutoSize = true;
 
116
                        Controls.Add(l);
 
117
 
 
118
 
 
119
                        // Show panel
 
120
                        panel = new Panel();
 
121
                        panel.Dock = DockStyle.Top;
 
122
                        panel.Height = 70;
 
123
                        Controls.Add(panel);
 
124
 
 
125
                        _showBaseClassesCheck = new CheckBox();
 
126
                        _showBaseClassesCheck.Location = new Point(10, 0);
 
127
                        _showBaseClassesCheck.Width = FIELD_WIDTH;
 
128
                        _showBaseClassesCheck.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.ShowBaseClassMembersCheckBox}");
 
129
                        panel.Controls.Add(_showBaseClassesCheck);
 
130
 
 
131
                        _showPublicOnlyCheck = new CheckBox();
 
132
                        _showPublicOnlyCheck.Location = new Point(10, 20);
 
133
                        _showPublicOnlyCheck.Width = FIELD_WIDTH;
 
134
                        _showPublicOnlyCheck.Text = StringParser.Parse("${res:ComponentInspector.CustomObjectPanel.ShowPublicMembersCheckBox}");
 
135
                        panel.Controls.Add(_showPublicOnlyCheck);
 
136
 
 
137
                        _showPropMethCheck = new CheckBox();
 
138
                        _showPropMethCheck.Location = new Point(10, 40);
 
139
                        _showPropMethCheck.Width = FIELD_WIDTH;
 
140
                        _showPropMethCheck.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.ShowPropertyAccessorsMethodsCheckBox}");
 
141
                        panel.Controls.Add(_showPropMethCheck);
 
142
 
 
143
                        l = new Label();
 
144
                        l.Dock = DockStyle.Top;
 
145
                        l.Text = StringParser.Parse("${res:ComponentInspector.CustomObjectPanel.ShowLabel}");
 
146
                        l.AutoSize = true;
 
147
                        Controls.Add(l);
 
148
 
 
149
 
 
150
                        // Show members panel
 
151
                        panel = new Panel();
 
152
                        panel.Dock = DockStyle.Top;
 
153
                        panel.Height = 50;
 
154
                        Controls.Add(panel);
 
155
 
 
156
                        // Add these using fixed locations
 
157
                        _showFieldsCheck = new CheckBox();
 
158
                        _showFieldsCheck.Location = new Point(10, 0);
 
159
                        _showFieldsCheck.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.ShowFieldsCheckBox}");
 
160
                        panel.Controls.Add(_showFieldsCheck);
 
161
 
 
162
                        _showPropertiesCheck = new CheckBox();
 
163
                        _showPropertiesCheck.Location = new Point(10, 20);
 
164
                        _showPropertiesCheck.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.ShowPropertiesCheckBox}");
 
165
                        panel.Controls.Add(_showPropertiesCheck);
 
166
 
 
167
                        _showMethodsCheck = new CheckBox();
 
168
                        _showMethodsCheck.Location = new Point(120, 0);
 
169
                        _showMethodsCheck.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.ShowMethodsCheckBox}");
 
170
                        panel.Controls.Add(_showMethodsCheck);
 
171
 
 
172
                        _showEventsCheck = new CheckBox();
 
173
                        _showEventsCheck.Location = new Point(120, 20);
 
174
                        _showEventsCheck.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.ShowEventsCheckBox}");
 
175
                        panel.Controls.Add(_showEventsCheck);
 
176
 
 
177
                        l = new Label();
 
178
                        l.Dock = DockStyle.Top;
 
179
                        l.Text = StringParser.Parse("${res:ComponentInspector.ObjectTreeOptionsPanel.ShowMembersGroupBox}");
 
180
                        l.AutoSize = true;
 
181
                        Controls.Add(l);
 
182
 
 
183
                        // Padding
 
184
                        l = new Label();
 
185
                        l.Dock = DockStyle.Top;
 
186
                        l.Height = 5;
 
187
                        Controls.Add(l);
 
188
                }
 
189
 
 
190
                Size ICustPanel.PreferredSize {
 
191
                        get {
 
192
                                return new Size(300, 450);
 
193
                        }
 
194
                }
 
195
                
 
196
                public void BeforeShow()
 
197
                {
 
198
                        // The state of the check box needs to be refreshed
 
199
                        // from the current state in the event the dialog
 
200
                        // was previously cancelled.
 
201
                        _showPropMethCheck.Checked = ComponentInspectorProperties.ShowPropertyAccessorMethods;
 
202
 
 
203
                        _showFieldsCheck.Checked = ComponentInspectorProperties.ShowFields;
 
204
                        _showPropertiesCheck.Checked = (ComponentInspectorProperties.ShowProperties);
 
205
                        _showMethodsCheck.Checked = ComponentInspectorProperties.ShowMethods;
 
206
                        _showEventsCheck.Checked = ComponentInspectorProperties.ShowEvents;
 
207
 
 
208
                        _showBaseClassesCheck.Checked = ComponentInspectorProperties.ShowBaseClasses;
 
209
                        _showPublicOnlyCheck.Checked = ComponentInspectorProperties.ShowPublicMembersOnly;
 
210
 
 
211
                        _showMemberCategoriesCheck.Checked = ComponentInspectorProperties.ShowMemberCategories;
 
212
                        _showObjectAsBaseCheck.Checked = ComponentInspectorProperties.ShowObjectAsBaseClass;
 
213
                        _showBaseCategoriesCheck.Checked = ComponentInspectorProperties.ShowBaseCategories;
 
214
                        _showCategoriesCount.Text = Convert.ToString(ComponentInspectorProperties.CategoryThreshold);
 
215
                        // Compute enable of show cat count
 
216
                        ShowCatClicked(null, null);
 
217
 
 
218
                        _showBaseClassNamesCheck.Checked = ComponentInspectorProperties.ShowBaseClassNames;
 
219
                        _hexDisplayCheck.Checked = ComponentInspectorProperties.DisplayHex;
 
220
                }
 
221
 
 
222
                public bool AfterShow()
 
223
                {
 
224
                        int showMemCat = Convert.ToInt32(_showCategoriesCount.Text);
 
225
 
 
226
                        // Set the properties
 
227
                        ComponentInspectorProperties.ShowPropertyAccessorMethods =_showPropMethCheck.Checked;
 
228
                        ComponentInspectorProperties.ShowFields = _showFieldsCheck.Checked;
 
229
                        ComponentInspectorProperties.ShowProperties = _showPropertiesCheck.Checked;
 
230
                        ComponentInspectorProperties.ShowMethods = _showMethodsCheck.Checked;
 
231
                        ComponentInspectorProperties.ShowEvents = _showEventsCheck.Checked;
 
232
 
 
233
                        ComponentInspectorProperties.ShowBaseClasses = _showBaseClassesCheck.Checked;
 
234
                        ComponentInspectorProperties.ShowPublicMembersOnly = _showPublicOnlyCheck.Checked;
 
235
 
 
236
                        ComponentInspectorProperties.ShowMemberCategories = _showMemberCategoriesCheck.Checked;
 
237
                        ComponentInspectorProperties.ShowBaseCategories = _showBaseCategoriesCheck.Checked;
 
238
                        ComponentInspectorProperties.ShowObjectAsBaseClass = _showObjectAsBaseCheck.Checked;
 
239
                        ComponentInspectorProperties.CategoryThreshold = showMemCat;
 
240
 
 
241
                        ComponentInspectorProperties.ShowBaseClassNames = _showBaseClassNamesCheck.Checked;
 
242
                        ComponentInspectorProperties.DisplayHex = _hexDisplayCheck.Checked;
 
243
                        return true;
 
244
                }
 
245
 
 
246
                protected void ShowCatClicked(Object sender, EventArgs e)
 
247
                {
 
248
                        _showCatCountPanel.Enabled = _showMemberCategoriesCheck.Checked || _showBaseCategoriesCheck.Checked;
 
249
                }
 
250
        }
 
251
}