~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/WindowsPlatform/structs.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  Copyright (c) 2006, Gustavo Franco
 
2
//  Email:  gustavo_franco@hotmail.com
 
3
//  All rights reserved.
 
4
 
 
5
//  Redistribution and use in source and binary forms, with or without modification, 
 
6
//  are permitted provided that the following conditions are met:
 
7
 
 
8
//  Redistributions of source code must retain the above copyright notice, 
 
9
//  this list of conditions and the following disclaimer. 
 
10
//  Redistributions in binary form must reproduce the above copyright notice, 
 
11
//  this list of conditions and the following disclaimer in the documentation 
 
12
//  and/or other materials provided with the distribution. 
 
13
 
 
14
//  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 
15
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 
16
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 
17
//  PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
 
18
//  REMAINS UNCHANGED.
 
19
 
 
20
using System;
 
21
using System.Text;
 
22
using System.Drawing;
 
23
using System.Collections.Generic;
 
24
using System.Runtime.InteropServices;
 
25
 
 
26
namespace CustomControls.OS
 
27
{
 
28
        #region WINDOWINFO
 
29
    [Author("Franco, Gustavo")]
 
30
    [StructLayout(LayoutKind.Sequential)]
 
31
    public struct WINDOWINFO
 
32
    {
 
33
       public UInt32 cbSize;
 
34
       public RECT rcWindow;
 
35
       public RECT rcClient;
 
36
       public UInt32 dwStyle;
 
37
       public UInt32 dwExStyle;
 
38
       public UInt32 dwWindowStatus;
 
39
       public UInt32 cxWindowBorders;
 
40
       public UInt32 cyWindowBorders;
 
41
       public UInt16 atomWindowType;
 
42
       public UInt16 wCreatorVersion;
 
43
   }
 
44
    #endregion
 
45
 
 
46
    #region POINT
 
47
    [Author("Franco, Gustavo")]
 
48
        [StructLayout(LayoutKind.Sequential)]
 
49
        public struct POINT
 
50
        {
 
51
                public int x;
 
52
                public int y;
 
53
 
 
54
        #region Constructors
 
55
        public POINT(int x, int y)
 
56
                {
 
57
                        this.x = x;
 
58
                        this.y = y;
 
59
                }
 
60
 
 
61
        public POINT(Point point)
 
62
        {
 
63
            x = point.X;
 
64
            y = point.Y;
 
65
        }
 
66
        #endregion
 
67
    }
 
68
        #endregion
 
69
 
 
70
    #region RECT
 
71
    [Author("Franco, Gustavo")]
 
72
    [StructLayout(LayoutKind.Sequential)]
 
73
    public struct RECT 
 
74
    { 
 
75
        public uint left; 
 
76
        public uint top; 
 
77
        public uint right; 
 
78
        public uint bottom;
 
79
 
 
80
        #region Properties
 
81
        public POINT Location
 
82
        {
 
83
            get {return new POINT((int) left, (int) top);}
 
84
            set
 
85
            {
 
86
                right   -= (left - (uint) value.x);
 
87
                bottom  -= (bottom - (uint) value.y);
 
88
                left    = (uint) value.x;
 
89
                top     = (uint) value.y;
 
90
            }
 
91
        }
 
92
 
 
93
        public uint Width
 
94
        {
 
95
            get {return right - left;}
 
96
            set {right = left + value;}
 
97
        }
 
98
 
 
99
        public uint Height
 
100
        {
 
101
            get {return bottom - top;}
 
102
            set {bottom = top + value;}
 
103
        }
 
104
        #endregion
 
105
 
 
106
        #region Overrides
 
107
        public override string ToString()
 
108
        {
 
109
            return left + ":" + top + ":" + right + ":" + bottom;
 
110
        }
 
111
        #endregion
 
112
    }
 
113
    #endregion
 
114
 
 
115
    #region WINDOWPOS
 
116
    [Author("Franco, Gustavo")]
 
117
    [StructLayout(LayoutKind.Sequential)]
 
118
        public struct WINDOWPOS
 
119
        {
 
120
                public IntPtr hwnd;
 
121
                public IntPtr hwndAfter;
 
122
                public int x;
 
123
                public int y;
 
124
                public int cx;
 
125
                public int cy;
 
126
                public uint flags;
 
127
 
 
128
        #region Overrides
 
129
        public override string ToString()
 
130
        {
 
131
            return x + ":" + y + ":" + cx + ":" + cy + ":" + ((SWP_Flags) flags).ToString();
 
132
        }
 
133
        #endregion
 
134
    }
 
135
    #endregion
 
136
 
 
137
    #region NCCALCSIZE_PARAMS
 
138
    public struct NCCALCSIZE_PARAMS
 
139
    {
 
140
        public RECT rgrc1;
 
141
        public RECT rgrc2;
 
142
        public RECT rgrc3;
 
143
        public IntPtr lppos;
 
144
    }
 
145
    #endregion
 
146
 
 
147
    #region
 
148
    public struct NMHDR 
 
149
    {
 
150
        public IntPtr  hwndFrom;
 
151
        public IntPtr  idFrom;
 
152
        public uint    code;
 
153
    } 
 
154
    #endregion
 
155
 
 
156
    #region OFNOTIFY
 
157
    [Author("Franco, Gustavo")]
 
158
    [StructLayout(LayoutKind.Sequential)]
 
159
    public struct OFNOTIFY 
 
160
    {
 
161
        public NMHDR hdr;
 
162
        public IntPtr OPENFILENAME;
 
163
        public IntPtr fileNameShareViolation;
 
164
    }
 
165
    #endregion
 
166
 
 
167
    [StructLayout(LayoutKind.Sequential)]
 
168
    public struct SHFILEINFO
 
169
    {
 
170
        public IntPtr hIcon;
 
171
        public IntPtr iIcon;
 
172
        public uint dwAttributes;
 
173
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
 
174
        public string szDisplayName;
 
175
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
 
176
        public string szTypeName;
 
177
    };
 
178
}