This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
/
PropertyPage.cs
147 lines (123 loc) · 3.08 KB
/
PropertyPage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell.Interop;
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Xml;
using System.Diagnostics;
namespace Microsoft.Grail
{
[ComVisible(true), Guid("DDE101F3-D1E4-42ab-A1E9-1DD89994DFC8")]
public class PropertyPage :
Microsoft.VisualStudio.Shell.LocalizableProperties,
IPropertyPage
{
#region fields
private Panel panel;
private bool active;
private bool dirty = false;
private IPropertyPageSite site;
private string name;
#endregion
#region properties
[Browsable(false)]
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
protected Panel ThePanel
{
get
{
return this.panel;
}
}
#endregion
#region public methods
#endregion
#region IPropertyPage methods.
public virtual void Activate(IntPtr parent, RECT[] pRect, int bModal)
{
if (this.panel == null)
{
this.panel = new Panel();
this.panel.Size = new Size(pRect[0].right - pRect[0].left, pRect[0].bottom - pRect[0].top);
this.panel.Text = "Settings";// TODO localization
this.panel.Visible = false;
this.panel.Size = new Size(550, 300);
this.panel.CreateControl();
//NativeMethods.SetParent(this.panel.Handle, parent);
}
}
public virtual int Apply()
{
return VSConstants.S_OK;
}
public virtual void Deactivate()
{
this.panel.Dispose();
this.active = false;
}
public virtual void GetPageInfo(PROPPAGEINFO[] arrInfo)
{
PROPPAGEINFO info = new PROPPAGEINFO();
info.cb = (uint)Marshal.SizeOf(typeof(PROPPAGEINFO));
info.dwHelpContext = 0;
info.pszDocString = null;
info.pszHelpFile = null;
info.pszTitle = this.name;
info.SIZE.cx = 550;
info.SIZE.cy = 300;
arrInfo[0] = info;
}
public virtual void Help(string helpDir)
{
}
public virtual int IsPageDirty()
{
// Note this returns an HRESULT not a Bool.
return false ? (int)VSConstants.S_OK : (int)VSConstants.S_FALSE;
}
public virtual void Move(RECT[] arrRect)
{
RECT r = arrRect[0];
this.panel.Location = new Point(r.left, r.top);
this.panel.Size = new Size(r.right - r.left, r.bottom - r.top);
}
public virtual void SetObjects(uint count, object[] punk)
{
}
public virtual void SetPageSite(IPropertyPageSite theSite)
{
this.site = theSite;
}
public virtual void Show(uint cmd)
{
this.panel.Visible = true; // TODO: pass SW_SHOW* flags through
this.panel.Show();
}
public virtual int TranslateAccelerator(MSG[] arrMsg)
{
MSG msg = arrMsg[0];
if ((msg.message < NativeMethods.WM_KEYFIRST || msg.message > NativeMethods.WM_KEYLAST) && (msg.message < NativeMethods.WM_MOUSEFIRST || msg.message > NativeMethods.WM_MOUSELAST))
return 1;
return (NativeMethods.IsDialogMessageA(this.panel.Handle, ref msg)) ? 0 : 1;
}
#endregion
#region helper methods
#endregion
}
}