123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Drawing;
- using System.Runtime.InteropServices;
- namespace PaintDotNet.SystemLayer.FileDlgExtenders.Win32Types
- {
- #region WINDOWINFO
- [StructLayout(LayoutKind.Sequential)]
- internal struct WINDOWINFO
- {
- public UInt32 cbSize;
- public RECT rcWindow;
- public RECT rcClient;
- public UInt32 dwStyle;
- public UInt32 dwExStyle;
- public UInt32 dwWindowStatus;
- public UInt32 cxWindowBorders;
- public UInt32 cyWindowBorders;
- public UInt16 atomWindowType;
- public UInt16 wCreatorVersion;
- }
- #endregion
- #region POINT
- [StructLayout(LayoutKind.Sequential)]
- internal struct POINT
- {
- public int x;
- public int y;
- #region Constructors
- public POINT(int x, int y)
- {
- this.x = x;
- this.y = y;
- }
- public POINT(Point point)
- {
- x = point.X;
- y = point.Y;
- }
- #endregion
- }
- #endregion
- #region RECT
- [StructLayout(LayoutKind.Sequential)]
- internal struct RECT
- {
- public int left;
- public int top;
- public int right;
- public int bottom;
- #region Properties
- public POINT Location
- {
- get { return new POINT((int)left, (int)top); }
- set
- {
- right -= (left - value.x);
- bottom -= (bottom - value.y);
- left = value.x;
- top = value.y;
- }
- }
- internal uint Width
- {
- get { return (uint)Math.Abs(right - left); }
- set { right = left + (int)value; }
- }
- internal uint Height
- {
- get { return (uint)Math.Abs(bottom - top); }
- set { bottom = top + (int)value; }
- }
- #endregion
- #region Overrides
- public override string ToString()
- {
- return left + ":" + top + ":" + right + ":" + bottom;
- }
- #endregion
- }
- #endregion
- #region WINDOWPOS
- [StructLayout(LayoutKind.Sequential)]
- internal struct WINDOWPOS
- {
- public IntPtr hwnd;
- public IntPtr hwndAfter;
- public int x;
- public int y;
- public int cx;
- public int cy;
- public uint flags;
- #region Overrides
- public override string ToString()
- {
- return x + ":" + y + ":" + cx + ":" + cy + ":" + ((SWP_Flags)flags).ToString();
- }
- #endregion
- }
- #endregion
- //#region NCCALCSIZE_PARAMS
- //internal struct NCCALCSIZE_PARAMS
- //{
- // public RECT rgrc1;
- // public RECT rgrc2;
- // public RECT rgrc3;
- // public IntPtr lppos;
- //}
- //#endregion
- #region NMHDR
- [StructLayout(LayoutKind.Sequential)]
- internal struct NMHDR
- {
- public IntPtr hwndFrom;
- public IntPtr idFrom;
- public uint code;
- }
- #endregion
- #region NMHEADER
- [StructLayout(LayoutKind.Sequential)]
- internal struct NMHEADER
- {
- internal NMHDR hdr;
- internal int iItem;
- internal int iButton;
- internal IntPtr pItem;
- }
- #endregion
- #region OPENFILENAME
- /// <summary>
- /// Defines the shape of hook procedures that can be called by the OpenFileDialog
- /// </summary>
- internal delegate IntPtr OfnHookProc(IntPtr hWnd, UInt16 msg, Int32 wParam, Int32 lParam);
- /// <summary>
- /// See the documentation for OPENFILENAME
- /// </summary>
- //typedef struct tagOFN {
- // DWORD lStructSize;
- // HWND hwndOwner;
- // HINSTANCE hInstance;
- // LPCTSTR lpstrFilter;
- // LPTSTR lpstrCustomFilter;
- // DWORD nMaxCustFilter;
- // DWORD nFilterIndex;
- // LPTSTR lpstrFile;
- // DWORD nMaxFile;
- // LPTSTR lpstrFileTitle;
- // DWORD nMaxFileTitle;
- // LPCTSTR lpstrInitialDir;
- // LPCTSTR lpstrTitle;
- // DWORD Flags;
- // WORD nFileOffset;
- // WORD nFileExtension;
- // LPCTSTR lpstrDefExt;
- // LPARAM lCustData;
- // LPOFNHOOKPROC lpfnHook;
- // LPCTSTR lpTemplateName;
- //#if (_WIN32_WINNT >= 0x0500)
- // void * pvReserved;
- // DWORD dwReserved;
- // DWORD FlagsEx;
- //#endif // (_WIN32_WINNT >= 0x0500)
- //} OPENFILENAME, *LPOPENFILENAME;
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- internal struct OPENFILENAME
- {
- public UInt32 lStructSize;
- public IntPtr hwndOwner;
- public IntPtr hInstance;
- public String lpstrFilter;
- public String lpstrCustomFilter;
- public UInt32 nMaxCustFilter;
- public Int32 nFilterIndex;
- public String lpstrFile;
- public UInt32 nMaxFile;
- public String lpstrFileTitle;
- public UInt32 nMaxFileTitle;
- public String lpstrInitialDir;
- public String lpstrTitle;
- public UInt32 Flags;
- public UInt16 nFileOffset;
- public UInt16 nFileExtension;
- public String lpstrDefExt;
- public IntPtr lCustData;
- public OfnHookProc lpfnHook;
- public String lpTemplateName;
- public IntPtr pvReserved;
- public UInt32 dwReserved;
- public UInt32 FlagsEx;
- };
- #endregion
- #region OFNOTIFY
- [StructLayout(LayoutKind.Sequential)]
- internal struct OFNOTIFY
- {
- public NMHDR hdr;
- public IntPtr OpenFileName;
- public IntPtr fileNameShareViolation;
- }
- #endregion
- }
|