Control.cs 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886
  1. //
  2. // System.Windows.Forms.Control.cs
  3. //
  4. // Author:
  5. // stubbed out by Jaak Simm ([email protected])
  6. // Dennis Hayes ([email protected])
  7. // WINELib implementation started by John Sohn ([email protected])
  8. //
  9. // (C) Ximian, Inc., 2002
  10. //
  11. using System.ComponentModel;
  12. using System.Drawing;
  13. using System.Collections;
  14. namespace System.Windows.Forms {
  15. /// <summary>
  16. /// Defines the base class for controls, which are components with
  17. /// visual representation.
  18. /// </summary>
  19. public class Control : Component , ISynchronizeInvoke, IWin32Window {
  20. // Helper NativeWindow class to dispatch messages back
  21. // to the Control class
  22. protected class ControlNativeWindow : NativeWindow {
  23. private Control control;
  24. public ControlNativeWindow (Control control) : base() {
  25. this.control = control;
  26. }
  27. protected override void WndProc (ref Message m) {
  28. base.WndProc (ref m);
  29. if (m.Msg == Win32.WM_CREATE)
  30. Console.WriteLine ("CNW WndProc WM_CREATE");
  31. control.WndProc (ref m);
  32. }
  33. }
  34. // FIXME: not sure if dervied classes should have access
  35. protected ControlNativeWindow window;
  36. private ControlCollection childControls;
  37. private Control parent;
  38. // private fields
  39. // it seems these are stored in case the window is not created,
  40. // corresponding properties (below) need to check if window
  41. // is created or not and react accordingly
  42. string accessibleDefaultActionDescription;
  43. string accessibleDescription;
  44. string accessibleName;
  45. AccessibleRole accessibleRole;
  46. bool allowDrop;
  47. AnchorStyles anchor;
  48. Color backColor;
  49. Image backgroundImage;
  50. //BindingContext bindingContext;
  51. Rectangle bounds;
  52. bool causesValidation;
  53. //ContextMenu contextMenu;
  54. DockStyle dock;
  55. bool enabled;
  56. Font font;
  57. Color foreColor;
  58. ImeMode imeMode;
  59. bool isAccessible;
  60. // Point location; // using bounds to store location
  61. string name;
  62. Region region;
  63. RightToLeft rightToLeft;
  64. bool tabStop;
  65. string text;
  66. bool visible;
  67. CreateParams createParams;
  68. // --- Constructors ---
  69. public Control ()
  70. {
  71. CreateControlsInstance ();
  72. accessibleDefaultActionDescription = null;
  73. accessibleDescription = null;
  74. accessibleName = null;
  75. accessibleRole = AccessibleRole.Default;
  76. allowDrop = false;
  77. anchor = AnchorStyles.Top | AnchorStyles.Left;
  78. //backColor = Control.DefaultBackColor;
  79. backgroundImage = null;
  80. bounds = new Rectangle();
  81. // bindingContext = null;
  82. causesValidation = true;
  83. // contextMenu = null;
  84. dock = DockStyle.None;
  85. enabled = true;
  86. // font = Control.DefaultFont;
  87. // foreColor = Control.DefaultForeColor;
  88. imeMode = ImeMode.Inherit;
  89. isAccessible = false;
  90. // location = new Point (0,0); should be from OS
  91. name = "";
  92. region = null;
  93. rightToLeft = RightToLeft.Inherit;
  94. tabStop = false;
  95. text = "";
  96. visible = true;
  97. parent = null;
  98. window = null;
  99. createParams = new CreateParams ();
  100. }
  101. // according to docs, the constructors do not create
  102. // the (HWND) window
  103. public Control (string text) : this()
  104. {
  105. Text = text;
  106. // Win32.SetWindowTextA (Handle, text);
  107. }
  108. public Control (Control parent, string text) : this (text)
  109. {
  110. Parent = parent;
  111. // Win32.SetParent (Handle, parent.Handle);
  112. }
  113. public Control (string text, int left, int top,
  114. int width, int height) : this(text)
  115. {
  116. Left = left;
  117. Top = top;
  118. Width = width;
  119. Height = height;
  120. //Win32.SetWindowPos (Handle, (IntPtr) 0, left, top,
  121. // width, height, 0);
  122. }
  123. public Control (Control parent,string text,int left, int top,
  124. int width,int height) : this (parent, text)
  125. {
  126. Left = left;
  127. Top = top;
  128. Width = width;
  129. Height = height;
  130. // Win32.SetWindowPos (Handle, (IntPtr) 0, left, top,
  131. // width, height, 0);
  132. }
  133. // for internal use only, create a control class
  134. // for an existing, created HWND
  135. private Control (IntPtr existingHandle)
  136. {
  137. window = (ControlNativeWindow) NativeWindow.FromHandle (
  138. existingHandle);
  139. }
  140. // --- Properties ---
  141. // Properties only supporting .NET framework, not stubbed out:
  142. // - protected bool RenderRightToLeft {get;}
  143. // - public IWindowTarget WindowTarget {get; set;}
  144. //[MonoTODO]
  145. //public AccessibleObject AccessibilityObject {
  146. // get {
  147. // throw new NotImplementedException ();
  148. // }
  149. //}
  150. public string AccessibleDefaultActionDescription {
  151. get {
  152. return accessibleDefaultActionDescription;
  153. }
  154. set {
  155. accessibleDefaultActionDescription = value;
  156. }
  157. }
  158. public string AccessibleDescription {
  159. get {
  160. return accessibleDescription;
  161. }
  162. set {
  163. accessibleDescription=value;
  164. }
  165. }
  166. public string AccessibleName {
  167. get {
  168. return accessibleName;
  169. }
  170. set {
  171. accessibleName=value;
  172. }
  173. }
  174. public AccessibleRole AccessibleRole {
  175. get {
  176. return accessibleRole;
  177. }
  178. set {
  179. accessibleRole=value;
  180. }
  181. }
  182. public virtual bool AllowDrop {
  183. get {
  184. return allowDrop;
  185. }
  186. set {
  187. allowDrop=value;
  188. }
  189. }
  190. public virtual AnchorStyles Anchor {
  191. get {
  192. return anchor;
  193. }
  194. set {
  195. anchor=value;
  196. }
  197. }
  198. public virtual Color BackColor {
  199. get {
  200. if (IsHandleCreated) {
  201. IntPtr dc = Win32.GetDC (Handle);
  202. uint bgColor = Win32.GetBkColor (dc);
  203. Win32.ReleaseDC (Handle, dc);
  204. int r = (int) (bgColor & 0xFF);
  205. int g = (int) ((bgColor >> 8) & 0xFF);
  206. int b = (int) ((bgColor >> 16) & 0xFF);
  207. return Color.FromArgb (r, g, b);
  208. } else return backColor;
  209. }
  210. set {
  211. backColor = value;
  212. if (IsHandleCreated) {
  213. IntPtr dc = Win32.GetDC (Handle);
  214. Win32.SetBkColor (dc, (uint) value.ToArgb());
  215. Win32.ReleaseDC (Handle, dc);
  216. }
  217. }
  218. }
  219. public virtual Image BackgroundImage {
  220. get {
  221. return backgroundImage;
  222. }
  223. set {
  224. backgroundImage = value;
  225. // FIXME: force redraw
  226. }
  227. }
  228. // waiting for BindingContext
  229. //public virtual BindingContext BindingContext {
  230. // get {
  231. // //return bindingContext;
  232. // throw new NotImplementedException ();
  233. // }
  234. // set {
  235. // //bindingContext=value;
  236. // throw new NotImplementedException ();
  237. // }
  238. //}
  239. public int Bottom {
  240. get {
  241. return Top + Height;
  242. }
  243. }
  244. public Rectangle Bounds {
  245. get {
  246. if (IsHandleCreated) {
  247. Win32.RECT rect = new Win32.RECT();
  248. Win32.GetWindowRect (Handle, ref rect);
  249. return new Rectangle ((int) rect.left,
  250. (int) rect.top,
  251. (int) rect.right,
  252. (int) rect.bottom);
  253. } else return bounds;
  254. }
  255. set {
  256. if (IsHandleCreated)
  257. Win32.SetWindowPos (
  258. Handle, (IntPtr) 0, value.X, value.Y,
  259. value.Width, value.Height, 0);
  260. else bounds = value;
  261. }
  262. }
  263. public bool CanFocus {
  264. get {
  265. if (IsHandleCreated && Visible && Enabled)
  266. return true;
  267. return false;
  268. }
  269. }
  270. [MonoTODO]
  271. public bool CanSelect {
  272. get {
  273. // if (ControlStyles.Selectable &&
  274. // isContainedInAnotherControl &&
  275. // parentIsVisiable && isVisialbe &&
  276. // parentIsEnabled && isEnabled) {
  277. // return true;
  278. // }
  279. // return false;
  280. throw new NotImplementedException ();
  281. }
  282. }
  283. public bool Capture {
  284. get {
  285. if (IsHandleCreated) {
  286. IntPtr captured = Win32.GetCapture ();
  287. if (Handle == captured)
  288. return true;
  289. }
  290. return false;
  291. }
  292. set {
  293. if (IsHandleCreated) {
  294. if (value)
  295. Win32.SetCapture (Handle);
  296. else {
  297. IntPtr captured = Win32.GetCapture ();
  298. // if this window is in capture state
  299. // release it
  300. if (Handle == captured)
  301. Win32.ReleaseCapture ();
  302. }
  303. }
  304. }
  305. }
  306. public bool CausesValidation {
  307. get {
  308. return causesValidation;
  309. }
  310. set {
  311. causesValidation=value;
  312. }
  313. }
  314. public Rectangle ClientRectangle {
  315. get {
  316. if (IsHandleCreated) {
  317. Win32.RECT rect = new Win32.RECT();
  318. Win32.GetClientRect (Handle, ref rect);
  319. return new Rectangle ((int) rect.left,
  320. (int) rect.top,
  321. (int) rect.right,
  322. (int) rect.bottom);
  323. }
  324. // FIXME: is the correct return value for
  325. // window who's handle is not created
  326. return new Rectangle (0, 0, 0, 0);
  327. }
  328. }
  329. [MonoTODO]
  330. public Size ClientSize {
  331. get {
  332. // FIXME: use GetSystemMetrics and/or
  333. // GetClientRect here?
  334. throw new NotImplementedException ();
  335. }
  336. set {
  337. throw new NotImplementedException ();
  338. }
  339. }
  340. [MonoTODO]
  341. public string CompanyName {
  342. get {
  343. throw new NotImplementedException ();
  344. }
  345. }
  346. public bool ContainsFocus {
  347. get {
  348. if (IsHandleCreated) {
  349. IntPtr focusedWindow = Win32.GetFocus();
  350. if (focusedWindow == Handle)
  351. return true;
  352. }
  353. return false;
  354. }
  355. }
  356. //[MonoTODO]
  357. //public virtual ContextMenu ContextMenu {
  358. // get {
  359. // //return contextMenu;
  360. // throw new NotImplementedException ();
  361. // }
  362. // set {
  363. // //contextMenu=value;
  364. // throw new NotImplementedException ();
  365. // }
  366. //}
  367. public ControlCollection Controls {
  368. get { return childControls; }
  369. }
  370. public bool Created {
  371. get {
  372. if (Handle != (IntPtr) 0)
  373. return true;
  374. return false;
  375. }
  376. }
  377. protected virtual CreateParams CreateParams {
  378. get {
  379. return createParams;
  380. }
  381. }
  382. [MonoTODO]
  383. public virtual Cursor Cursor {
  384. get {
  385. throw new NotImplementedException ();
  386. }
  387. set {
  388. throw new NotImplementedException ();
  389. }
  390. }
  391. //[MonoTODO]
  392. // waiting for BindingContext
  393. //public ControlBindingsCollection DataBindings {
  394. // get {
  395. // throw new NotImplementedException ();
  396. // }
  397. //}
  398. public static Color DefaultBackColor {
  399. get {
  400. // FIXME: use GetSystemMetrics?
  401. //return SystemColors.Control;
  402. throw new NotImplementedException ();
  403. }
  404. }
  405. //[MonoTODO]
  406. // FIXME: use GetSystemMetrics?
  407. //public static Font DefaultFont {
  408. // FIXME: get current system font from GenericSansSerif
  409. // call ArgumentException not called
  410. // get {
  411. // throw new NotImplementedException ();
  412. //return (FontFamily.GenericSansSerif);
  413. // }
  414. //}
  415. public static Color DefaultForeColor {
  416. get {
  417. // FIXME: use GetSystemMetrics?
  418. //return SystemColors.ControlText;
  419. throw new NotImplementedException ();
  420. }
  421. }
  422. protected virtual ImeMode DefaultImeMode {
  423. get {
  424. //return ImeMode.Inherit;
  425. throw new NotImplementedException ();
  426. }
  427. }
  428. [MonoTODO]
  429. protected virtual Size DefaultSize {
  430. get {
  431. // FIXME: use GetSystemMetrics?
  432. throw new NotImplementedException ();
  433. }
  434. }
  435. public virtual Rectangle DisplayRectangle {
  436. get {
  437. return ClientRectangle;
  438. }
  439. }
  440. [MonoTODO]
  441. public bool Disposing {
  442. get {
  443. throw new NotImplementedException ();
  444. }
  445. }
  446. public virtual DockStyle Dock {
  447. get {
  448. return dock;
  449. }
  450. set {
  451. dock=value;
  452. }
  453. }
  454. public virtual bool Enabled {
  455. get {
  456. return Win32.IsWindowEnabled (Handle);
  457. }
  458. set {
  459. Win32.EnableWindow (Handle, value);
  460. }
  461. }
  462. public virtual bool Focused {
  463. get {
  464. return ContainsFocus;
  465. }
  466. }
  467. // [MonoTODO]
  468. //public virtual Font Font {
  469. // CHECKME:
  470. // get {
  471. //return font;
  472. // throw new NotImplementedException ();
  473. // }
  474. // set {
  475. //font=value;
  476. // throw new NotImplementedException ();
  477. // }
  478. //}
  479. [MonoTODO]
  480. protected int FontHeight {
  481. get {
  482. throw new NotImplementedException ();
  483. }
  484. set {
  485. throw new NotImplementedException ();
  486. }
  487. }
  488. public virtual Color ForeColor {
  489. get {
  490. return foreColor;
  491. }
  492. set {
  493. foreColor = value;
  494. }
  495. }
  496. public bool HasChildren {
  497. get {
  498. if (childControls.Count >0)
  499. return true;
  500. return false;
  501. }
  502. }
  503. public int Height {
  504. get {
  505. if (IsHandleCreated) {
  506. // FIXME: GetWindowPos
  507. }
  508. return bounds.Height;
  509. }
  510. set {
  511. bounds.Height = value;
  512. if (IsHandleCreated) {
  513. // FIXME: SetWindowPos
  514. }
  515. }
  516. }
  517. public ImeMode ImeMode {
  518. // CHECKME:
  519. get {
  520. return imeMode;
  521. }
  522. set {
  523. imeMode=value;
  524. }
  525. }
  526. public bool IsAccessible {
  527. // CHECKME:
  528. get {
  529. return isAccessible;
  530. } // default is false
  531. set {
  532. isAccessible=value;
  533. }
  534. }
  535. public bool IsDisposed {
  536. get {
  537. if (Handle == (IntPtr) 0)
  538. return true;
  539. return false;
  540. }
  541. }
  542. public bool IsHandleCreated {
  543. get {
  544. if (Handle != (IntPtr) 0)
  545. return true;
  546. return false;
  547. }
  548. }
  549. public int Left {
  550. get {
  551. if (IsHandleCreated) {
  552. // FIXME: GetWindowPos
  553. }
  554. return Bounds.X;
  555. }
  556. set {
  557. if (IsHandleCreated) {
  558. // FIXME: SetWindowPos
  559. }
  560. Bounds.X = value;
  561. }
  562. }
  563. public Point Location {
  564. // CHECKME:
  565. get {
  566. return new Point (Top, Left);
  567. }
  568. set {
  569. bounds.X = value.X;
  570. bounds.Y = value.Y;
  571. if (IsHandleCreated) {
  572. // FIXME: SetWindowPos
  573. }
  574. }
  575. }
  576. [MonoTODO]
  577. public static Keys ModifierKeys {
  578. get {
  579. throw new NotImplementedException ();
  580. }
  581. }
  582. [MonoTODO]
  583. public static MouseButtons MouseButtons {
  584. get {
  585. // FIXME: use GetAsycKeyState?
  586. throw new NotImplementedException ();
  587. }
  588. }
  589. public static Point MousePosition {
  590. get {
  591. Win32.POINT point = new Win32.POINT();
  592. Win32.GetCursorPos (ref point);
  593. return new Point ( (int) point.x, (int) point.y);
  594. }
  595. }
  596. public string Name {
  597. // CHECKME:
  598. get {
  599. return name;
  600. }
  601. set {
  602. name=value;
  603. }
  604. }
  605. public Control Parent {
  606. get {
  607. return parent;
  608. //IntPtr parent = Win32.GetParent (Handle);
  609. //return FromHandle (parent);
  610. }
  611. set {
  612. Console.WriteLine ("setting parent");
  613. parent = value;
  614. Console.WriteLine ("add ourself to the parents control");
  615. // add ourself to the parents control
  616. parent.Controls.Add (this);
  617. Console.WriteLine ("SetParent");
  618. if (IsHandleCreated) {
  619. Console.WriteLine ("Handle created");
  620. Win32.SetParent (Handle, value.Handle);
  621. }
  622. }
  623. }
  624. [MonoTODO]
  625. public string ProductName {
  626. get {
  627. throw new NotImplementedException ();
  628. }
  629. }
  630. [MonoTODO]
  631. public string ProductVersion {
  632. get {
  633. throw new NotImplementedException ();
  634. }
  635. }
  636. [MonoTODO]
  637. public bool RecreatingHandle {
  638. get {
  639. throw new NotImplementedException ();
  640. }
  641. }
  642. public Region Region {
  643. // CHECKME:
  644. get {
  645. return region;
  646. }
  647. set {
  648. region=value;
  649. }
  650. }
  651. [MonoTODO]
  652. protected bool ResizeRedraw {
  653. get {
  654. throw new NotImplementedException ();
  655. }
  656. set {
  657. throw new NotImplementedException ();
  658. }
  659. }
  660. public int Right {
  661. get {
  662. return Left + Width;
  663. }
  664. }
  665. [MonoTODO]
  666. public virtual RightToLeft RightToLeft {
  667. // CHECKME:
  668. get {
  669. return rightToLeft;
  670. }
  671. set {
  672. rightToLeft=value;
  673. }
  674. }
  675. [MonoTODO]
  676. protected virtual bool ShowFocusCues {
  677. get {
  678. throw new NotImplementedException ();
  679. }
  680. }
  681. [MonoTODO]
  682. protected bool ShowKeyboardCues {
  683. get {
  684. throw new NotImplementedException ();
  685. }
  686. }
  687. [MonoTODO]
  688. public override ISite Site {
  689. get {
  690. throw new NotImplementedException ();
  691. }
  692. set {
  693. throw new NotImplementedException ();
  694. }
  695. }
  696. [MonoTODO]
  697. public Size Size {
  698. get {
  699. throw new NotImplementedException ();
  700. }
  701. set {
  702. throw new NotImplementedException ();
  703. }
  704. }
  705. [MonoTODO]
  706. public int TabIndex {
  707. get {
  708. throw new NotImplementedException ();
  709. }
  710. set {
  711. throw new NotImplementedException ();
  712. }
  713. }
  714. public bool TabStop {
  715. // CHECKME:
  716. get {
  717. return tabStop;
  718. }
  719. set {
  720. tabStop = value;
  721. }
  722. }
  723. [MonoTODO]
  724. public object Tag {
  725. get {
  726. throw new NotImplementedException ();
  727. }
  728. set {
  729. throw new NotImplementedException ();
  730. }
  731. }
  732. public virtual string Text {
  733. get {
  734. if (IsHandleCreated) {
  735. String text = "";
  736. int length = Win32.GetWindowTextLengthA (Handle);
  737. Win32.GetWindowTextA (Handle, ref text, length);
  738. return text;
  739. } else return text;
  740. }
  741. set {
  742. text = value;
  743. if (IsHandleCreated)
  744. Win32.SetWindowTextA (Handle, value);
  745. }
  746. }
  747. public int Top {
  748. get {
  749. if (IsHandleCreated) {
  750. // FIXME: GetWindowPos
  751. return 0;
  752. } else return bounds.Top;
  753. }
  754. set {
  755. bounds.X = value;
  756. if (IsHandleCreated) {
  757. // FIXME: SetWindowPos
  758. }
  759. }
  760. }
  761. [MonoTODO]
  762. public Control TopLevelControl {
  763. get {
  764. throw new NotImplementedException ();
  765. }
  766. }
  767. public bool Visible {
  768. get {
  769. throw new NotImplementedException ();
  770. }
  771. set {
  772. if (value)
  773. Win32.ShowWindow (
  774. Handle, Win32.SW_SHOW);
  775. else
  776. Win32.ShowWindow (
  777. Handle, Win32.SW_HIDE);
  778. }
  779. }
  780. public int Width {
  781. get {
  782. if (IsHandleCreated) {
  783. // FIXME: GetWindowPos
  784. }
  785. return bounds.Width;
  786. }
  787. set {
  788. bounds.Width = value;
  789. if (IsHandleCreated) {
  790. // FIXME: SetWindowPos
  791. }
  792. }
  793. }
  794. /// --- methods ---
  795. /// internal .NET framework supporting methods, not stubbed out:
  796. /// - protected virtual void NotifyInvalidate(Rectangle invalidatedArea)
  797. /// - protected void RaiseDragEvent(object key,DragEventArgs e);
  798. /// - protected void RaiseKeyEvent(object key,KeyEventArgs e);
  799. /// - protected void RaiseMouseEvent(object key,MouseEventArgs e);
  800. /// - protected void RaisePaintEvent(object key,PaintEventArgs e);
  801. /// - protected void ResetMouseEventArgs();
  802. [MonoTODO]
  803. protected void AccessibilityNotifyClients (
  804. AccessibleEvents accEvent,int childID)
  805. {
  806. throw new NotImplementedException ();
  807. }
  808. [MonoTODO]
  809. public void BringToFront ()
  810. {
  811. throw new NotImplementedException ();
  812. }
  813. public bool Contains (Control ctl)
  814. {
  815. return childControls.Contains (ctl);
  816. }
  817. public void CreateControl ()
  818. {
  819. CreateHandle ();
  820. }
  821. //[MonoTODO]
  822. //AccessibleObject not ready
  823. //protected virtual AccessibleObject CreateAccessibilityInstance() {
  824. // throw new NotImplementedException ();
  825. //}
  826. protected virtual ControlCollection CreateControlsInstance ()
  827. {
  828. childControls = new ControlCollection (this);
  829. return childControls;
  830. }
  831. [MonoTODO]
  832. public Graphics CreateGraphics ()
  833. {
  834. throw new NotImplementedException ();
  835. }
  836. protected virtual void CreateHandle ()
  837. {
  838. window = new ControlNativeWindow (this);
  839. createParams.Caption = Text;
  840. createParams.ClassName = "mono_native_window";
  841. createParams.X = Top;
  842. createParams.Y = Left;
  843. createParams.Width = Width;
  844. createParams.Height = Height;
  845. createParams.ClassStyle = 0;
  846. createParams.ExStyle = 0;
  847. createParams.Param = 0;
  848. if (parent != null)
  849. createParams.Parent = parent.Handle;
  850. else
  851. createParams.Parent = (IntPtr) 0;
  852. createParams.Style = (int) Win32.WS_OVERLAPPEDWINDOW;
  853. window.CreateHandle (createParams);
  854. }
  855. protected virtual void DefWndProc (ref Message m)
  856. {
  857. window.DefWndProc(ref m);
  858. }
  859. protected virtual void DestroyHandle ()
  860. {
  861. window.DestroyHandle ();
  862. }
  863. [MonoTODO]
  864. protected override void Dispose (bool disposing)
  865. {
  866. throw new NotImplementedException ();
  867. }
  868. [MonoTODO]
  869. public DragDropEffects DoDragDrop (
  870. object data, DragDropEffects allowedEffects)
  871. {
  872. throw new NotImplementedException ();
  873. }
  874. //public object EndInvoke(IAsyncResult asyncResult):
  875. //look under ISynchronizeInvoke methods
  876. [MonoTODO]
  877. public Form FindForm ()
  878. {
  879. throw new NotImplementedException ();
  880. }
  881. public bool Focus ()
  882. {
  883. if (Win32.SetFocus (Handle) != (IntPtr) 0)
  884. return true;
  885. return false;
  886. }
  887. [MonoTODO]
  888. public static Control FromChildHandle (IntPtr handle)
  889. {
  890. throw new NotImplementedException ();
  891. }
  892. public static Control FromHandle (IntPtr handle)
  893. {
  894. Control control = new Control (handle);
  895. return control;
  896. }
  897. [MonoTODO]
  898. public Control GetChildAtPoint (Point pt)
  899. {
  900. throw new NotImplementedException ();
  901. }
  902. // [MonoTODO]
  903. //public IContainerControl GetContainerControl ()
  904. //{
  905. // throw new NotImplementedException ();
  906. //}
  907. [MonoTODO]
  908. public Control GetNextControl (Control ctl, bool forward)
  909. {
  910. throw new NotImplementedException ();
  911. }
  912. [MonoTODO]
  913. protected bool GetStyle (ControlStyles flag)
  914. {
  915. throw new NotImplementedException ();
  916. }
  917. [MonoTODO]
  918. protected bool GetTopLevel ()
  919. {
  920. throw new NotImplementedException ();
  921. }
  922. public void Hide ()
  923. {
  924. if (IsHandleCreated)
  925. Win32.ShowWindow (Handle, Win32.SW_HIDE);
  926. }
  927. [MonoTODO]
  928. protected virtual void InitLayout ()
  929. {
  930. throw new NotImplementedException ();
  931. }
  932. public void Invalidate ()
  933. {
  934. if (IsHandleCreated) {
  935. Win32.RECT rect = (Win32.RECT) null;
  936. Win32.InvalidateRect (Handle, ref rect, true);
  937. }
  938. }
  939. [MonoTODO]
  940. public void Invalidate (bool invalidateChildren)
  941. {
  942. throw new NotImplementedException ();
  943. }
  944. public void Invalidate (Rectangle rc)
  945. {
  946. if (IsHandleCreated) {
  947. Win32.RECT rect = new Win32.RECT();
  948. rect.left = rc.Left;
  949. rect.top = rc.Top;
  950. rect.right = rc.Right;
  951. rect.bottom = rc.Bottom;
  952. Win32.InvalidateRect (Handle, ref rect, true);
  953. }
  954. }
  955. //[MonoTODO]
  956. public void Invalidate(Region region)
  957. {
  958. throw new NotImplementedException ();
  959. }
  960. [MonoTODO]
  961. public void Invalidate (Rectangle rc, bool invalidateChildren)
  962. {
  963. throw new NotImplementedException ();
  964. }
  965. //[MonoTODO]
  966. public void Invalidate(Region region,bool invalidateChildren)
  967. {
  968. throw new NotImplementedException ();
  969. }
  970. [MonoTODO]
  971. protected void InvokeGotFocus (Control toInvoke, EventArgs e)
  972. {
  973. throw new NotImplementedException ();
  974. }
  975. [MonoTODO]
  976. protected void InvokeLostFocus (Control toInvoke, EventArgs e)
  977. {
  978. throw new NotImplementedException ();
  979. }
  980. [MonoTODO]
  981. protected void InvokeOnClick (Control toInvoke, EventArgs e)
  982. {
  983. throw new NotImplementedException ();
  984. }
  985. [MonoTODO]
  986. protected void InvokePaint (Control c, PaintEventArgs e)
  987. {
  988. throw new NotImplementedException ();
  989. }
  990. [MonoTODO]
  991. protected void InvokePaintBackground (
  992. Control c,PaintEventArgs e)
  993. {
  994. throw new NotImplementedException ();
  995. }
  996. [MonoTODO]
  997. protected virtual bool IsInputChar (char charCode)
  998. {
  999. throw new NotImplementedException ();
  1000. }
  1001. [MonoTODO]
  1002. protected virtual bool IsInputKey (Keys keyData)
  1003. {
  1004. throw new NotImplementedException ();
  1005. }
  1006. [MonoTODO]
  1007. public static bool IsMnemonic (char charCode,string text)
  1008. {
  1009. throw new NotImplementedException ();
  1010. }
  1011. // methods used with events:
  1012. protected virtual void OnBackColorChanged (EventArgs e)
  1013. {
  1014. if (BackColorChanged != null)
  1015. BackColorChanged (this, e);
  1016. }
  1017. protected virtual void OnBackgroundImageChanged (EventArgs e)
  1018. {
  1019. if (BackgroundImageChanged != null)
  1020. BackgroundImageChanged (this, e);
  1021. }
  1022. protected virtual void OnBindingContextChanged (EventArgs e)
  1023. {
  1024. if (BindingContextChanged != null)
  1025. BindingContextChanged (this, e);
  1026. }
  1027. protected virtual void OnCausesValidationChanged (EventArgs e)
  1028. {
  1029. if (CausesValidationChanged != null)
  1030. CausesValidationChanged (this, e);
  1031. }
  1032. protected virtual void OnChangeUICues(UICuesEventArgs e)
  1033. {
  1034. if (ChangeUICues != null)
  1035. ChangeUICues (this, e);
  1036. }
  1037. protected virtual void OnClick (EventArgs e)
  1038. {
  1039. if (Click != null)
  1040. Click (this, e);
  1041. }
  1042. protected virtual void OnContextMenuChanged (EventArgs e)
  1043. {
  1044. if (ContextMenuChanged != null)
  1045. ContextMenuChanged (this, e);
  1046. }
  1047. protected virtual void OnControlAdded (ControlEventArgs e)
  1048. {
  1049. if (ControlAdded != null)
  1050. ControlAdded (this, e);
  1051. }
  1052. protected virtual void OnControlRemoved (ControlEventArgs e)
  1053. {
  1054. if (ControlRemoved != null)
  1055. ControlRemoved (this, e);
  1056. }
  1057. protected virtual void OnCreateControl ()
  1058. {
  1059. }
  1060. protected virtual void OnCursorChanged (EventArgs e)
  1061. {
  1062. if (CursorChanged != null)
  1063. CursorChanged (this, e);
  1064. }
  1065. protected virtual void OnDockChanged (EventArgs e)
  1066. {
  1067. if (DockChanged != null)
  1068. DockChanged (this, e);
  1069. }
  1070. protected virtual void OnDoubleClick (EventArgs e)
  1071. {
  1072. if (DoubleClick != null)
  1073. DoubleClick (this, e);
  1074. }
  1075. protected virtual void OnDragDrop (DragEventArgs e)
  1076. {
  1077. if (DragDrop != null)
  1078. DragDrop (this, e);
  1079. }
  1080. protected virtual void OnDragEnter (DragEventArgs e)
  1081. {
  1082. if (DragEnter != null)
  1083. DragEnter (this, e);
  1084. }
  1085. protected virtual void OnDragLeave (EventArgs e)
  1086. {
  1087. if (DragLeave != null)
  1088. DragLeave (this, e);
  1089. }
  1090. protected virtual void OnDragOver (DragEventArgs e)
  1091. {
  1092. if (DragOver != null)
  1093. DragOver (this, e);
  1094. }
  1095. protected virtual void OnEnabledChanged (EventArgs e)
  1096. {
  1097. if (EnabledChanged != null)
  1098. EnabledChanged (this, e);
  1099. }
  1100. protected virtual void OnEnter (EventArgs e)
  1101. {
  1102. if (Enter != null)
  1103. Enter (this, e);
  1104. }
  1105. protected virtual void OnFontChanged (EventArgs e)
  1106. {
  1107. if (FontChanged != null)
  1108. FontChanged (this, e);
  1109. }
  1110. protected virtual void OnForeColorChanged (EventArgs e)
  1111. {
  1112. if (ForeColorChanged != null)
  1113. ForeColorChanged (this, e);
  1114. }
  1115. protected virtual void OnGiveFeedback (GiveFeedbackEventArgs e)
  1116. {
  1117. if (GiveFeedback != null)
  1118. GiveFeedback (this, e);
  1119. }
  1120. protected virtual void OnGotFocus (EventArgs e)
  1121. {
  1122. if (GotFocus != null)
  1123. GotFocus (this, e);
  1124. }
  1125. protected virtual void OnHandleCreated (EventArgs e)
  1126. {
  1127. Console.WriteLine ("OnHandleCreated");
  1128. if (HandleCreated != null)
  1129. HandleCreated (this, e);
  1130. // create all child windows
  1131. IEnumerator cw = childControls.GetEnumerator();
  1132. while (cw.MoveNext()) {
  1133. Console.WriteLine ("Adding Control");
  1134. Control control = (Control) cw.Current;
  1135. control.CreateControl ();
  1136. control.Show ();
  1137. }
  1138. }
  1139. protected virtual void OnHandleDestroyed (EventArgs e)
  1140. {
  1141. if (HandleDestroyed != null)
  1142. HandleDestroyed (this, e);
  1143. }
  1144. protected virtual void OnHelpRequested (HelpEventArgs e)
  1145. {
  1146. if (HelpRequested != null)
  1147. HelpRequested (this, e);
  1148. }
  1149. protected virtual void OnImeModeChanged (EventArgs e)
  1150. {
  1151. if (ImeModeChanged != null)
  1152. ImeModeChanged (this, e);
  1153. }
  1154. protected virtual void OnInvalidated (InvalidateEventArgs e)
  1155. {
  1156. if (Invalidated != null)
  1157. Invalidated (this, e);
  1158. }
  1159. protected virtual void OnKeyDown (KeyEventArgs e)
  1160. {
  1161. if (KeyDown != null)
  1162. KeyDown (this, e);
  1163. }
  1164. protected virtual void OnKeyPress (KeyPressEventArgs e)
  1165. {
  1166. if (KeyPress != null)
  1167. KeyPress (this, e);
  1168. }
  1169. protected virtual void OnKeyUp (KeyEventArgs e)
  1170. {
  1171. if (KeyUp != null)
  1172. KeyUp (this, e);
  1173. }
  1174. protected virtual void OnLayout (LayoutEventArgs e)
  1175. {
  1176. if (Layout != null)
  1177. Layout (this, e);
  1178. }
  1179. protected virtual void OnLeave (EventArgs e)
  1180. {
  1181. if (Leave != null)
  1182. Leave (this, e);
  1183. }
  1184. protected virtual void OnLocationChanged (EventArgs e)
  1185. {
  1186. if (LocationChanged != null)
  1187. LocationChanged (this, e);
  1188. }
  1189. protected virtual void OnLostFocus (EventArgs e)
  1190. {
  1191. if (LostFocus != null)
  1192. LostFocus (this, e);
  1193. }
  1194. protected virtual void OnMouseDown (MouseEventArgs e)
  1195. {
  1196. if (MouseDown != null)
  1197. MouseDown (this, e);
  1198. }
  1199. protected virtual void OnMouseEnter (EventArgs e)
  1200. {
  1201. if (MouseEnter != null)
  1202. MouseEnter (this, e);
  1203. }
  1204. protected virtual void OnMouseHover (EventArgs e)
  1205. {
  1206. if (MouseHover != null)
  1207. MouseHover (this, e);
  1208. }
  1209. protected virtual void OnMouseLeave (EventArgs e)
  1210. {
  1211. if (MouseLeave != null)
  1212. MouseLeave (this, e);
  1213. }
  1214. protected virtual void OnMouseMove (MouseEventArgs e)
  1215. {
  1216. if (MouseMove != null)
  1217. MouseMove (this, e);
  1218. }
  1219. protected virtual void OnMouseUp (MouseEventArgs e)
  1220. {
  1221. if (MouseUp != null)
  1222. MouseUp (this, e);
  1223. }
  1224. protected virtual void OnMouseWheel (MouseEventArgs e)
  1225. {
  1226. if (MouseWheel != null)
  1227. MouseWheel (this, e);
  1228. }
  1229. protected virtual void OnMove (EventArgs e)
  1230. {
  1231. if (Move != null)
  1232. Move (this, e);
  1233. }
  1234. protected virtual void OnNotifyMessage (Message m)
  1235. {
  1236. }
  1237. protected virtual void OnPaint (PaintEventArgs e)
  1238. {
  1239. if (Paint != null)
  1240. Paint (this, e);
  1241. }
  1242. protected virtual void OnPaintBackground (PaintEventArgs e)
  1243. {
  1244. }
  1245. protected virtual void OnParentBackColorChanged (EventArgs e)
  1246. {
  1247. if (BackColorChanged != null)
  1248. BackColorChanged (this, e);
  1249. }
  1250. protected virtual void OnParentBackgroundImageChanged (
  1251. EventArgs e)
  1252. {
  1253. if (BackgroundImageChanged != null)
  1254. BackgroundImageChanged (this, e);
  1255. }
  1256. protected virtual void OnParentBindingContextChanged (
  1257. EventArgs e)
  1258. {
  1259. if (BindingContextChanged != null)
  1260. BindingContextChanged (this, e);
  1261. }
  1262. protected virtual void OnParentChanged (EventArgs e)
  1263. {
  1264. if (ParentChanged != null)
  1265. ParentChanged (this, e);
  1266. }
  1267. protected virtual void OnParentEnabledChanged (EventArgs e)
  1268. {
  1269. if (EnabledChanged != null)
  1270. EnabledChanged (this, e);
  1271. }
  1272. protected virtual void OnParentFontChanged (EventArgs e)
  1273. {
  1274. if (FontChanged != null)
  1275. FontChanged (this, e);
  1276. }
  1277. protected virtual void OnParentForeColorChanged (EventArgs e)
  1278. {
  1279. if (ForeColorChanged != null)
  1280. ForeColorChanged (this, e);
  1281. }
  1282. protected virtual void OnParentRightToLeftChanged (
  1283. EventArgs e)
  1284. {
  1285. if (RightToLeftChanged != null)
  1286. RightToLeftChanged (this, e);
  1287. }
  1288. protected virtual void OnParentVisibleChanged (EventArgs e)
  1289. {
  1290. if (VisibleChanged != null)
  1291. VisibleChanged (this, e);
  1292. }
  1293. protected virtual void OnQueryContinueDrag (
  1294. QueryContinueDragEventArgs e)
  1295. {
  1296. if (QueryContinueDrag != null)
  1297. QueryContinueDrag (this, e);
  1298. }
  1299. protected virtual void OnResize (EventArgs e)
  1300. {
  1301. if (Resize != null)
  1302. Resize (this, e);
  1303. }
  1304. protected virtual void OnRightToLeftChanged (EventArgs e)
  1305. {
  1306. if (RightToLeftChanged != null)
  1307. RightToLeftChanged (this, e);
  1308. }
  1309. protected virtual void OnSizeChanged (EventArgs e)
  1310. {
  1311. if (SizeChanged != null)
  1312. SizeChanged (this, e);
  1313. }
  1314. protected virtual void OnStyleChanged (EventArgs e)
  1315. {
  1316. if (StyleChanged != null)
  1317. StyleChanged (this, e);
  1318. }
  1319. protected virtual void OnSystemColorsChanged (EventArgs e)
  1320. {
  1321. if (SystemColorsChanged != null)
  1322. SystemColorsChanged (this, e);
  1323. }
  1324. protected virtual void OnTabIndexChanged (EventArgs e)
  1325. {
  1326. if (TabIndexChanged != null)
  1327. TabIndexChanged (this, e);
  1328. }
  1329. protected virtual void OnTabStopChanged (EventArgs e)
  1330. {
  1331. if (TabStopChanged != null)
  1332. TabStopChanged (this, e);
  1333. }
  1334. protected virtual void OnTextChanged (EventArgs e)
  1335. {
  1336. if (TextChanged != null)
  1337. TextChanged (this, e);
  1338. }
  1339. [MonoTODO] // this doesn't seem to be documented
  1340. // protected virtual void OnTextAlignChanged (EventArgs e) {
  1341. // TextAlignChanged (this, e);
  1342. // }
  1343. protected virtual void OnValidated (EventArgs e)
  1344. {
  1345. if (Validated != null)
  1346. Validated (this, e);
  1347. }
  1348. [MonoTODO]
  1349. // CancelEventArgs not ready
  1350. //protected virtual void OnValidating(CancelEventArgs e)
  1351. //{
  1352. // throw new NotImplementedException ();
  1353. //}
  1354. [MonoTODO]
  1355. protected virtual void OnVisibleChanged (EventArgs e)
  1356. {
  1357. if (VisibleChanged != null)
  1358. VisibleChanged (this, e);
  1359. }
  1360. // --- end of methods for events ---
  1361. [MonoTODO]
  1362. public void PerformLayout ()
  1363. {
  1364. throw new NotImplementedException ();
  1365. }
  1366. [MonoTODO]
  1367. public void PerformLayout (Control affectedControl,
  1368. string affectedProperty)
  1369. {
  1370. throw new NotImplementedException ();
  1371. }
  1372. [MonoTODO]
  1373. public Point PointToClient (Point p)
  1374. {
  1375. throw new NotImplementedException ();
  1376. }
  1377. [MonoTODO]
  1378. public Point PointToScreen (Point p)
  1379. {
  1380. throw new NotImplementedException ();
  1381. }
  1382. [MonoTODO]
  1383. public virtual bool PreProcessMessage (ref Message msg)
  1384. {
  1385. throw new NotImplementedException ();
  1386. }
  1387. [MonoTODO]
  1388. protected virtual bool ProcessCmdKey (ref Message msg,
  1389. Keys keyData)
  1390. {
  1391. throw new NotImplementedException ();
  1392. }
  1393. [MonoTODO]
  1394. protected virtual bool ProcessDialogChar (char charCode)
  1395. {
  1396. throw new NotImplementedException ();
  1397. }
  1398. [MonoTODO]
  1399. protected virtual bool ProcessDialogKey (Keys keyData)
  1400. {
  1401. throw new NotImplementedException ();
  1402. }
  1403. [MonoTODO]
  1404. protected virtual bool ProcessKeyEventArgs (ref Message m)
  1405. {
  1406. throw new NotImplementedException ();
  1407. }
  1408. [MonoTODO]
  1409. protected internal virtual bool ProcessKeyMessage (
  1410. ref Message m)
  1411. {
  1412. throw new NotImplementedException ();
  1413. }
  1414. [MonoTODO]
  1415. protected virtual bool ProcessKeyPreview (ref Message m)
  1416. {
  1417. throw new NotImplementedException ();
  1418. }
  1419. [MonoTODO]
  1420. protected virtual bool ProcessMnemonic (char charCode)
  1421. {
  1422. throw new NotImplementedException ();
  1423. }
  1424. // used when properties/values of Control
  1425. // are big enough to warrant recreating the HWND
  1426. protected void RecreateHandle()
  1427. {
  1428. CreateHandle ();
  1429. }
  1430. [MonoTODO]
  1431. public Rectangle RectangleToClient (Rectangle r)
  1432. {
  1433. throw new NotImplementedException ();
  1434. }
  1435. [MonoTODO]
  1436. public Rectangle RectangleToScreen (Rectangle r)
  1437. {
  1438. throw new NotImplementedException ();
  1439. }
  1440. [MonoTODO]
  1441. protected static bool ReflectMessage (IntPtr hWnd,
  1442. ref Message m)
  1443. {
  1444. throw new NotImplementedException ();
  1445. }
  1446. public virtual void Refresh ()
  1447. {
  1448. Win32.RECT rect = (Win32.RECT) null;
  1449. Win32.InvalidateRect (Handle, ref rect, true);
  1450. Win32.UpdateWindow (Handle);
  1451. }
  1452. [MonoTODO]
  1453. public virtual void ResetBackColor ()
  1454. {
  1455. throw new NotImplementedException ();
  1456. }
  1457. [MonoTODO]
  1458. public void ResetBindings ()
  1459. {
  1460. throw new NotImplementedException ();
  1461. }
  1462. [MonoTODO]
  1463. public virtual void ResetFont ()
  1464. {
  1465. throw new NotImplementedException ();
  1466. }
  1467. [MonoTODO]
  1468. public virtual void ResetForeColor ()
  1469. {
  1470. throw new NotImplementedException ();
  1471. }
  1472. [MonoTODO]
  1473. public void ResetImeMode ()
  1474. {
  1475. throw new NotImplementedException ();
  1476. }
  1477. [MonoTODO]
  1478. public virtual void ResetRightToLeft ()
  1479. {
  1480. throw new NotImplementedException ();
  1481. }
  1482. [MonoTODO]
  1483. public virtual void ResetText ()
  1484. {
  1485. throw new NotImplementedException ();
  1486. }
  1487. [MonoTODO]
  1488. public void ResumeLayout ()
  1489. {
  1490. throw new NotImplementedException ();
  1491. }
  1492. [MonoTODO]
  1493. public void ResumeLayout (bool performLayout)
  1494. {
  1495. throw new NotImplementedException ();
  1496. }
  1497. [MonoTODO]
  1498. protected ContentAlignment RtlTranslateAlignment (
  1499. ContentAlignment align)
  1500. {
  1501. throw new NotImplementedException ();
  1502. }
  1503. [MonoTODO]
  1504. protected HorizontalAlignment RtlTranslateAlignment (
  1505. HorizontalAlignment align)
  1506. {
  1507. throw new NotImplementedException ();
  1508. }
  1509. [MonoTODO]
  1510. protected LeftRightAlignment RtlTranslateAlignment (
  1511. LeftRightAlignment align)
  1512. {
  1513. throw new NotImplementedException ();
  1514. }
  1515. [MonoTODO]
  1516. protected ContentAlignment RtlTranslateContent (
  1517. ContentAlignment align)
  1518. {
  1519. throw new NotImplementedException ();
  1520. }
  1521. [MonoTODO]
  1522. protected HorizontalAlignment RtlTranslateHorizontal (
  1523. HorizontalAlignment align)
  1524. {
  1525. throw new NotImplementedException ();
  1526. }
  1527. [MonoTODO]
  1528. protected LeftRightAlignment RtlTranslateLeftRight (
  1529. LeftRightAlignment align)
  1530. {
  1531. throw new NotImplementedException ();
  1532. }
  1533. [MonoTODO]
  1534. public void Scale (float ratio)
  1535. {
  1536. throw new NotImplementedException ();
  1537. }
  1538. [MonoTODO]
  1539. public void Scale (float dx,float dy)
  1540. {
  1541. throw new NotImplementedException ();
  1542. }
  1543. [MonoTODO]
  1544. protected virtual void ScaleCore (float dx, float dy)
  1545. {
  1546. throw new NotImplementedException ();
  1547. }
  1548. [MonoTODO]
  1549. public void Select ()
  1550. {
  1551. throw new NotImplementedException ();
  1552. }
  1553. [MonoTODO]
  1554. protected virtual void Select (bool directed,bool forward)
  1555. {
  1556. throw new NotImplementedException ();
  1557. }
  1558. [MonoTODO]
  1559. public bool SelectNextControl (Control ctl, bool forward,
  1560. bool tabStopOnly,
  1561. bool nested, bool wrap)
  1562. {
  1563. throw new NotImplementedException ();
  1564. }
  1565. [MonoTODO]
  1566. public void SendToBack ()
  1567. {
  1568. throw new NotImplementedException ();
  1569. }
  1570. [MonoTODO]
  1571. public void SetBounds (int x, int y, int width, int height)
  1572. {
  1573. throw new NotImplementedException ();
  1574. }
  1575. [MonoTODO]
  1576. public void SetBounds (int x, int y, int width, int height,
  1577. BoundsSpecified specified)
  1578. {
  1579. throw new NotImplementedException ();
  1580. }
  1581. [MonoTODO]
  1582. protected virtual void SetBoundsCore (
  1583. int x, int y, int width, int height,
  1584. BoundsSpecified specified)
  1585. {
  1586. throw new NotImplementedException ();
  1587. }
  1588. [MonoTODO]
  1589. protected virtual void SetClientSizeCore (int x, int y)
  1590. {
  1591. throw new NotImplementedException ();
  1592. }
  1593. [MonoTODO]
  1594. protected void SetStyle (ControlStyles flag, bool value)
  1595. {
  1596. throw new NotImplementedException ();
  1597. }
  1598. protected void SetTopLevel (bool value)
  1599. {
  1600. if (value)
  1601. // FIXME: verify on whether this is supposed
  1602. // to activate/deactive the window
  1603. Win32.SetWindowPos (Handle,
  1604. (IntPtr) Win32.HWND_NOTOPMOST,
  1605. 0, 0, 0, 0, 0);
  1606. else
  1607. // FIXME: this does not make sense but
  1608. // the docs say the window is hidden
  1609. Win32.ShowWindow (Handle, Win32.SW_HIDE);
  1610. }
  1611. [MonoTODO]
  1612. protected virtual void SetVisibleCore (bool value)
  1613. {
  1614. throw new NotImplementedException ();
  1615. }
  1616. public void Show ()
  1617. {
  1618. Win32.ShowWindow (Handle, Win32.SW_SHOW);
  1619. }
  1620. [MonoTODO]
  1621. public void SuspendLayout ()
  1622. {
  1623. throw new NotImplementedException ();
  1624. }
  1625. public void Update ()
  1626. {
  1627. Win32.UpdateWindow (Handle);
  1628. }
  1629. [MonoTODO]
  1630. protected void UpdateBounds ()
  1631. {
  1632. throw new NotImplementedException ();
  1633. }
  1634. [MonoTODO]
  1635. protected void UpdateBounds (int x, int y, int width, int height)
  1636. {
  1637. throw new NotImplementedException ();
  1638. }
  1639. [MonoTODO]
  1640. protected void UpdateBounds (
  1641. int x, int y, int width, int height, int clientWidth,
  1642. int clientHeight)
  1643. {
  1644. throw new NotImplementedException ();
  1645. }
  1646. [MonoTODO]
  1647. protected void UpdateStyles ()
  1648. {
  1649. throw new NotImplementedException ();
  1650. }
  1651. [MonoTODO]
  1652. protected void UpdateZOrder ()
  1653. {
  1654. throw new NotImplementedException ();
  1655. }
  1656. // WndProc - calls appriate On... function for the give
  1657. // message
  1658. //
  1659. // These On... functions do not appear to be called by
  1660. // WndProc:
  1661. //
  1662. // background color/image handled by WinForms
  1663. // OnBackColorChanged
  1664. // OnBackgroundImageChanged
  1665. // OnForeColorChanged
  1666. // OnPaintBackground
  1667. //
  1668. // controls are added/removed by WinForms
  1669. // OnControlAdded
  1670. // OnControlRemoved
  1671. // OnCreateControl
  1672. //
  1673. // OnBindingContextChanged
  1674. // OnCausesValidationChanged
  1675. // OnChangeUICues
  1676. // OnContextMenuChanged
  1677. // OnRightToLeftChanged
  1678. // OnGiveFeedback
  1679. // OnLayout
  1680. // OnDockChanged
  1681. // OnCursorChanged
  1682. // OnTextAlignChanged
  1683. // OnValidated
  1684. // OnValidating
  1685. // OnTabIndexChanged
  1686. // OnTabStopChanged
  1687. // OnLocationChanged
  1688. //
  1689. // FIXME: may be one of the WM_IME_ messages
  1690. // OnImeModeChanged
  1691. //
  1692. // InvalidateRect is called by no Invalidate message exists
  1693. // OnInvalidated
  1694. //
  1695. // these messages ARE not called by WNDPROC according to docs
  1696. // OnParentBackColorChanged
  1697. // OnParentBackgroundImageChanged
  1698. // OnParentBindingContextChanged
  1699. // OnParentChanged
  1700. // OnParentEnabledChanged
  1701. // OnParentFontChanged
  1702. // OnParentForeColorChanged
  1703. // OnParentRightToLeftChanged
  1704. // OnParentVisibleChanged
  1705. //
  1706. protected virtual void WndProc(ref Message m)
  1707. {
  1708. EventArgs eventArgs = new EventArgs ();
  1709. // FIXME: paintEventArgs is not being created properly
  1710. PaintEventArgs paintEventArgs = new PaintEventArgs (
  1711. new Graphics(), new Rectangle());
  1712. switch (m.Msg) {
  1713. case Win32.WM_CREATE:
  1714. Console.WriteLine ("WM_CREATE");
  1715. OnHandleCreated (eventArgs);
  1716. break;
  1717. case Win32.WM_LBUTTONDBLCLK:
  1718. OnDoubleClick (eventArgs);
  1719. break;
  1720. // OnDragDrop
  1721. // OnDragEnter
  1722. // OnDragLeave
  1723. // OnDragOver
  1724. // OnQueryContinueDrag
  1725. case Win32.WM_ENABLE:
  1726. OnEnabledChanged (eventArgs);
  1727. break;
  1728. case Win32.WM_SETFOCUS:
  1729. OnEnter (eventArgs);
  1730. OnGotFocus (eventArgs);
  1731. break;
  1732. case Win32.WM_FONTCHANGE:
  1733. OnFontChanged (eventArgs);
  1734. break;
  1735. case Win32.WM_DESTROY:
  1736. OnHandleDestroyed (eventArgs);
  1737. break;
  1738. case Win32.WM_HELP:
  1739. // FIXME:
  1740. //OnHelpRequested (eventArgs);
  1741. break;
  1742. case Win32.WM_KEYDOWN:
  1743. // FIXME:
  1744. // OnKeyDown (eventArgs);
  1745. break;
  1746. case Win32.WM_CHAR:
  1747. // FIXME:
  1748. // OnKeyPress (eventArgs);
  1749. break;
  1750. case Win32.WM_KEYUP:
  1751. // FIXME:
  1752. // OnKeyUp (eventArgs);
  1753. break;
  1754. case Win32.WM_KILLFOCUS:
  1755. OnLeave (eventArgs);
  1756. OnLostFocus (eventArgs);
  1757. break;
  1758. case Win32.WM_LBUTTONDOWN:
  1759. // FIXME:
  1760. // OnMouseDown (eventArgs);
  1761. break;
  1762. case Win32.WM_MOUSEACTIVATE:
  1763. OnMouseEnter (eventArgs);
  1764. break;
  1765. case Win32.WM_MOUSEHOVER: // called by TrackMouseEvent
  1766. OnMouseHover (eventArgs);
  1767. break;
  1768. case Win32.WM_MOUSELEAVE: // called by TrackMouseEvent
  1769. OnMouseLeave (eventArgs);
  1770. break;
  1771. case Win32.WM_MOUSEMOVE:
  1772. // FIXME:
  1773. // OnMouseMove (eventArgs);
  1774. break;
  1775. case Win32.WM_LBUTTONUP:
  1776. // FIXME:
  1777. // OnMouseUp (eventArgs);
  1778. break;
  1779. case Win32.WM_MOUSEWHEEL:
  1780. // FIXME:
  1781. // OnMouseWheel (eventArgs);
  1782. break;
  1783. case Win32.WM_MOVE:
  1784. OnMove (eventArgs);
  1785. break;
  1786. case Win32.WM_NOTIFY:
  1787. // FIXME: get NM_CLICKED msg from pnmh
  1788. // OnClick (eventArgs);
  1789. // OnNotifyMessage (eventArgs);
  1790. case Win32.WM_PAINT:
  1791. OnPaint (paintEventArgs);
  1792. break;
  1793. case Win32.WM_SIZE:
  1794. OnResize (eventArgs);
  1795. OnSizeChanged (eventArgs);
  1796. break;
  1797. case Win32.WM_STYLECHANGED:
  1798. OnStyleChanged (eventArgs);
  1799. break;
  1800. case Win32.WM_SYSCOLORCHANGE:
  1801. OnSystemColorsChanged (eventArgs);
  1802. break;
  1803. case Win32.WM_SETTEXT:
  1804. OnTextChanged (eventArgs);
  1805. break;
  1806. case Win32.WM_SHOWWINDOW:
  1807. OnVisibleChanged (eventArgs);
  1808. break;
  1809. // default:
  1810. // DefWndProc (ref m);
  1811. // break;
  1812. }
  1813. }
  1814. /// --- Control: events ---
  1815. public event EventHandler BackColorChanged;// {
  1816. // add {
  1817. // throw new NotImplementedException ();
  1818. // }
  1819. // remove {
  1820. // throw new NotImplementedException ();
  1821. // }
  1822. // }
  1823. public event EventHandler BackgroundImageChanged; //{
  1824. // add {
  1825. // throw new NotImplementedException ();
  1826. // }
  1827. // remove {
  1828. // throw new NotImplementedException ();
  1829. // }
  1830. // }
  1831. public event EventHandler BindingContextChanged; // {
  1832. // add {
  1833. // throw new NotImplementedException ();
  1834. // }
  1835. // remove {
  1836. // throw new NotImplementedException ();
  1837. // }
  1838. // }
  1839. public event EventHandler CausesValidationChanged; // {
  1840. // add {
  1841. // throw new NotImplementedException ();
  1842. // }
  1843. // remove {
  1844. // throw new NotImplementedException ();
  1845. // }
  1846. // }
  1847. public event UICuesEventHandler ChangeUICues; // {
  1848. // add {
  1849. // throw new NotImplementedException ();
  1850. // }
  1851. // remove {
  1852. // throw new NotImplementedException ();
  1853. // }
  1854. // }
  1855. public event EventHandler Click; // {
  1856. // add {
  1857. // throw new NotImplementedException ();
  1858. // }
  1859. // remove {
  1860. // throw new NotImplementedException ();
  1861. // }
  1862. // }
  1863. public event EventHandler ContextMenuChanged;
  1864. public event ControlEventHandler ControlAdded; // {
  1865. // add {
  1866. // throw new NotImplementedException ();
  1867. // }
  1868. // remove {
  1869. // throw new NotImplementedException ();
  1870. // }
  1871. // }
  1872. public event ControlEventHandler ControlRemoved; // {
  1873. // add {
  1874. // throw new NotImplementedException ();
  1875. // }
  1876. // remove {
  1877. // throw new NotImplementedException ();
  1878. // }
  1879. // }
  1880. public event EventHandler CursorChanged; // {
  1881. // add {
  1882. // throw new NotImplementedException ();
  1883. // }
  1884. // remove {
  1885. // throw new NotImplementedException ();
  1886. // }
  1887. // }
  1888. public event EventHandler DockChanged; // {
  1889. // add {
  1890. // throw new NotImplementedException ();
  1891. // }
  1892. // remove {
  1893. // throw new NotImplementedException ();
  1894. // }
  1895. // }
  1896. public event EventHandler DoubleClick; // {
  1897. // add {
  1898. // throw new NotImplementedException ();
  1899. // }
  1900. // remove {
  1901. // throw new NotImplementedException ();
  1902. // }
  1903. // }
  1904. public event DragEventHandler DragDrop; // {
  1905. // add {
  1906. // throw new NotImplementedException ();
  1907. // }
  1908. // remove {
  1909. // throw new NotImplementedException ();
  1910. // }
  1911. // }
  1912. public event DragEventHandler DragEnter; // {
  1913. // add {
  1914. // throw new NotImplementedException ();
  1915. // }
  1916. // remove {
  1917. // throw new NotImplementedException ();
  1918. // }
  1919. // }
  1920. public event EventHandler DragLeave; // {
  1921. // add {
  1922. // throw new NotImplementedException ();
  1923. // }
  1924. // remove {
  1925. // throw new NotImplementedException ();
  1926. // }
  1927. // }
  1928. public event DragEventHandler DragOver; // {
  1929. // add {
  1930. // throw new NotImplementedException ();
  1931. // }
  1932. // remove {
  1933. // throw new NotImplementedException ();
  1934. // }
  1935. // }
  1936. public event EventHandler EnabledChanged; // {
  1937. // add {
  1938. // throw new NotImplementedException ();
  1939. // }
  1940. // remove {
  1941. // throw new NotImplementedException ();
  1942. // }
  1943. // }
  1944. public event EventHandler Enter; // {
  1945. // add {
  1946. // throw new NotImplementedException ();
  1947. // }
  1948. // remove {
  1949. // throw new NotImplementedException ();
  1950. // }
  1951. // }
  1952. public event EventHandler FontChanged; // {
  1953. // add {
  1954. // throw new NotImplementedException ();
  1955. // }
  1956. // remove {
  1957. // throw new NotImplementedException ();
  1958. // }
  1959. // }
  1960. public event EventHandler ForeColorChanged; // {
  1961. // add {
  1962. // throw new NotImplementedException ();
  1963. // }
  1964. // remove {
  1965. // throw new NotImplementedException ();
  1966. // }
  1967. // }
  1968. public event GiveFeedbackEventHandler GiveFeedback; // {
  1969. // add {
  1970. // throw new NotImplementedException ();
  1971. // }
  1972. // remove {
  1973. // throw new NotImplementedException ();
  1974. // }
  1975. // }
  1976. public event EventHandler GotFocus; // {
  1977. // add {
  1978. // throw new NotImplementedException ();
  1979. // }
  1980. // remove {
  1981. // throw new NotImplementedException ();
  1982. // }
  1983. // }
  1984. public event EventHandler HandleCreated; // {
  1985. // add {
  1986. // throw new NotImplementedException ();
  1987. // }
  1988. // remove {
  1989. // throw new NotImplementedException ();
  1990. // }
  1991. // }
  1992. public event EventHandler HandleDestroyed; // {
  1993. // add {
  1994. // throw new NotImplementedException ();
  1995. // }
  1996. // remove {
  1997. // throw new NotImplementedException ();
  1998. // }
  1999. // }
  2000. public event HelpEventHandler HelpRequested; // {
  2001. // add {
  2002. // throw new NotImplementedException ();
  2003. // }
  2004. // remove {
  2005. // throw new NotImplementedException ();
  2006. // }
  2007. // }
  2008. public event EventHandler ImeModeChanged; // {
  2009. // add {
  2010. // throw new NotImplementedException ();
  2011. // }
  2012. // remove {
  2013. // throw new NotImplementedException ();
  2014. // }
  2015. // }
  2016. public event InvalidateEventHandler Invalidated; // {
  2017. // add {
  2018. // throw new NotImplementedException ();
  2019. // }
  2020. // remove {
  2021. // throw new NotImplementedException ();
  2022. // }
  2023. // }
  2024. public event KeyEventHandler KeyDown; // {
  2025. // add {
  2026. // throw new NotImplementedException ();
  2027. // }
  2028. // remove {
  2029. // throw new NotImplementedException ();
  2030. // }
  2031. // }
  2032. public event KeyPressEventHandler KeyPress; // {
  2033. // add {
  2034. // throw new NotImplementedException ();
  2035. // }
  2036. // remove {
  2037. // throw new NotImplementedException ();
  2038. // }
  2039. // }
  2040. public event KeyEventHandler KeyUp; // {
  2041. // add {
  2042. // throw new NotImplementedException ();
  2043. // }
  2044. // remove {
  2045. // throw new NotImplementedException ();
  2046. // }
  2047. // }
  2048. public event LayoutEventHandler Layout; // {
  2049. // add {
  2050. // throw new NotImplementedException ();
  2051. // }
  2052. // remove {
  2053. // throw new NotImplementedException ();
  2054. // }
  2055. // }
  2056. public event EventHandler Leave; // {
  2057. // add {
  2058. // throw new NotImplementedException ();
  2059. // }
  2060. // remove {
  2061. // throw new NotImplementedException ();
  2062. // }
  2063. // }
  2064. public event EventHandler LocationChanged; // {
  2065. // add {
  2066. // throw new NotImplementedException ();
  2067. // }
  2068. // remove {
  2069. // throw new NotImplementedException ();
  2070. // }
  2071. // }
  2072. public event EventHandler LostFocus; // {
  2073. // add {
  2074. // throw new NotImplementedException ();
  2075. // }
  2076. // remove {
  2077. // throw new NotImplementedException ();
  2078. // }
  2079. // }
  2080. public event MouseEventHandler MouseDown; // {
  2081. // add {
  2082. // throw new NotImplementedException ();
  2083. // }
  2084. // remove {
  2085. // throw new NotImplementedException ();
  2086. // }
  2087. // }
  2088. public event EventHandler MouseEnter; // {
  2089. // add {
  2090. // throw new NotImplementedException ();
  2091. // }
  2092. // remove {
  2093. // throw new NotImplementedException ();
  2094. // }
  2095. // }
  2096. public event EventHandler MouseHover; // {
  2097. // add {
  2098. // throw new NotImplementedException ();
  2099. // }
  2100. // remove {
  2101. // throw new NotImplementedException ();
  2102. // }
  2103. // }
  2104. public event EventHandler MouseLeave; // {
  2105. // add {
  2106. // throw new NotImplementedException ();
  2107. // }
  2108. // remove {
  2109. // throw new NotImplementedException ();
  2110. // }
  2111. // }
  2112. public event MouseEventHandler MouseMove; // {
  2113. // add {
  2114. // throw new NotImplementedException ();
  2115. // }
  2116. // remove {
  2117. // throw new NotImplementedException ();
  2118. // }
  2119. // }
  2120. public event MouseEventHandler MouseUp; // {
  2121. // add {
  2122. // throw new NotImplementedException ();
  2123. // }
  2124. // remove {
  2125. // throw new NotImplementedException ();
  2126. // }
  2127. // }
  2128. public event MouseEventHandler MouseWheel; // {
  2129. // add {
  2130. // throw new NotImplementedException ();
  2131. // }
  2132. // remove {
  2133. // throw new NotImplementedException ();
  2134. // }
  2135. // }
  2136. public event EventHandler Move; // {
  2137. // add {
  2138. // throw new NotImplementedException ();
  2139. // }
  2140. // remove {
  2141. // throw new NotImplementedException ();
  2142. // }
  2143. // }
  2144. public event PaintEventHandler Paint; // {
  2145. // add {
  2146. // throw new NotImplementedException ();
  2147. // }
  2148. // remove {
  2149. // throw new NotImplementedException ();
  2150. // }
  2151. // }
  2152. public event EventHandler ParentChanged; // {
  2153. // add {
  2154. // throw new NotImplementedException ();
  2155. // }
  2156. // remove {
  2157. // throw new NotImplementedException ();
  2158. // }
  2159. // }
  2160. public event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp; // {
  2161. // add {
  2162. // throw new NotImplementedException ();
  2163. // }
  2164. // remove {
  2165. // throw new NotImplementedException ();
  2166. // }
  2167. // }
  2168. public event QueryContinueDragEventHandler QueryContinueDrag; // {
  2169. // add {
  2170. // throw new NotImplementedException ();
  2171. // }
  2172. // remove {
  2173. // throw new NotImplementedException ();
  2174. // }
  2175. // }
  2176. public event EventHandler Resize; // {
  2177. // add {
  2178. // throw new NotImplementedException ();
  2179. // }
  2180. // remove {
  2181. // throw new NotImplementedException ();
  2182. // }
  2183. // }
  2184. public event EventHandler RightToLeftChanged; // {
  2185. // add {
  2186. // throw new NotImplementedException ();
  2187. // }
  2188. // remove {
  2189. // throw new NotImplementedException ();
  2190. // }
  2191. // }
  2192. public event EventHandler SizeChanged; // {
  2193. // add {
  2194. // throw new NotImplementedException ();
  2195. // }
  2196. // remove {
  2197. // throw new NotImplementedException ();
  2198. // }
  2199. // }
  2200. public event EventHandler StyleChanged; // {
  2201. // add {
  2202. // throw new NotImplementedException ();
  2203. // }
  2204. // remove {
  2205. // throw new NotImplementedException ();
  2206. // }
  2207. // }
  2208. public event EventHandler SystemColorsChanged; // {
  2209. // add {
  2210. // throw new NotImplementedException ();
  2211. // }
  2212. // remove {
  2213. // throw new NotImplementedException ();
  2214. // }
  2215. // }
  2216. public event EventHandler TabIndexChanged; // {
  2217. // add {
  2218. // throw new NotImplementedException ();
  2219. // }
  2220. // remove {
  2221. // throw new NotImplementedException ();
  2222. // }
  2223. // }
  2224. public event EventHandler TabStopChanged; // {
  2225. // add {
  2226. // throw new NotImplementedException ();
  2227. // }
  2228. // remove {
  2229. // throw new NotImplementedException ();
  2230. // }
  2231. // }
  2232. public event EventHandler TextChanged; // {
  2233. // add {
  2234. // throw new NotImplementedException ();
  2235. // }
  2236. // remove {
  2237. // throw new NotImplementedException ();
  2238. // }
  2239. // }
  2240. public event EventHandler Validated; // {
  2241. // add {
  2242. // throw new NotImplementedException ();
  2243. // }
  2244. // remove {
  2245. // throw new NotImplementedException ();
  2246. // }
  2247. // }
  2248. [MonoTODO]
  2249. // CancelEventHandler not yet defined
  2250. //public event CancelEventHandler Validating {
  2251. // add {
  2252. // throw new NotImplementedException ();
  2253. // }
  2254. // remove {
  2255. // throw new NotImplementedException ();
  2256. // }
  2257. //}
  2258. public event EventHandler VisibleChanged; // {
  2259. // add {
  2260. // throw new NotImplementedException ();
  2261. // }
  2262. // remove {
  2263. // throw new NotImplementedException ();
  2264. // }
  2265. // }
  2266. /// --- IWin32Window properties
  2267. public IntPtr Handle {
  2268. get {
  2269. if (window != null)
  2270. return window.Handle;
  2271. return (IntPtr) 0;
  2272. }
  2273. }
  2274. /// --- ISynchronizeInvoke properties ---
  2275. [MonoTODO]
  2276. public bool InvokeRequired {
  2277. get { throw new NotImplementedException (); }
  2278. }
  2279. /// --- ISynchronizeInvoke methods ---
  2280. [MonoTODO]
  2281. public IAsyncResult BeginInvoke (Delegate method)
  2282. {
  2283. throw new NotImplementedException ();
  2284. }
  2285. [MonoTODO]
  2286. public IAsyncResult BeginInvoke (Delegate method,
  2287. object[] args)
  2288. {
  2289. throw new NotImplementedException ();
  2290. }
  2291. [MonoTODO]
  2292. public object EndInvoke (IAsyncResult asyncResult)
  2293. {
  2294. throw new NotImplementedException ();
  2295. }
  2296. [MonoTODO]
  2297. public object Invoke (Delegate method)
  2298. {
  2299. throw new NotImplementedException ();
  2300. }
  2301. [MonoTODO]
  2302. public object Invoke (Delegate method,object[] args)
  2303. {
  2304. throw new NotImplementedException ();
  2305. }
  2306. /// sub-class: Control.ControlAccessibleObject
  2307. /// <summary>
  2308. /// Provides information about a control that can be used by an accessibility application.
  2309. /// </summary>
  2310. public class ControlAccessibleObject /*: AccessibleObject*/ {
  2311. // AccessibleObject not ready to be base class
  2312. /// --- ControlAccessibleObject.constructor ---
  2313. [MonoTODO]
  2314. public ControlAccessibleObject (Control ownerControl)
  2315. {
  2316. throw new NotImplementedException ();
  2317. }
  2318. /// --- ControlAccessibleObject Properties ---
  2319. [MonoTODO]
  2320. // public override string DefaultAction {
  2321. // get { throw new NotImplementedException (); }
  2322. // }
  2323. [MonoTODO]
  2324. // public override string Description {
  2325. // get { throw new NotImplementedException (); }
  2326. // }
  2327. [MonoTODO]
  2328. public IntPtr Handle {
  2329. get { throw new NotImplementedException (); }
  2330. set { throw new NotImplementedException (); }
  2331. }
  2332. [MonoTODO]
  2333. // public override string Help {
  2334. // get { throw new NotImplementedException (); }
  2335. // }
  2336. [MonoTODO]
  2337. // public override string KeyboardShortcut {
  2338. // get { throw new NotImplementedException (); }
  2339. // }
  2340. [MonoTODO]
  2341. // public override string Name {
  2342. // get { throw new NotImplementedException (); }
  2343. // set { throw new NotImplementedException (); }
  2344. // }
  2345. [MonoTODO]
  2346. public Control Owner {
  2347. get { throw new NotImplementedException (); }
  2348. }
  2349. [MonoTODO]
  2350. // public override AccessibleRole Role {
  2351. // get { throw new NotImplementedException (); }
  2352. // }
  2353. /// --- ControlAccessibleObject Methods ---
  2354. [MonoTODO]
  2355. // public override int GetHelpTopic(out string fileName)
  2356. // {
  2357. // throw new NotImplementedException ();
  2358. // }
  2359. [MonoTODO]
  2360. public void NotifyClients (AccessibleEvents accEvent)
  2361. {
  2362. throw new NotImplementedException ();
  2363. }
  2364. [MonoTODO]
  2365. public void NotifyClients (AccessibleEvents accEvent,
  2366. int childID)
  2367. {
  2368. throw new NotImplementedException ();
  2369. }
  2370. [MonoTODO]
  2371. public override string ToString ()
  2372. {
  2373. throw new NotImplementedException ();
  2374. }
  2375. }
  2376. /// sub-class: Control.ControlCollection
  2377. /// <summary>
  2378. /// Represents a collection of Control objects
  2379. /// </summary>
  2380. public class ControlCollection : IList, ICollection, IEnumerable, ICloneable {
  2381. private ArrayList collection = new ArrayList ();
  2382. private Control owner;
  2383. /// --- ControlCollection.constructor ---
  2384. public ControlCollection (Control owner)
  2385. {
  2386. this.owner = owner;
  2387. }
  2388. /// --- ControlCollection Properties ---
  2389. public int Count {
  2390. get { return collection.Count; }
  2391. }
  2392. public bool IsReadOnly {
  2393. get { return collection.IsReadOnly; }
  2394. }
  2395. public virtual Control this [int index] {
  2396. get { return (Control) collection[index]; }
  2397. }
  2398. public virtual void Add (Control value)
  2399. {
  2400. collection.Add (value);
  2401. }
  2402. public virtual void AddRange (Control[] controls)
  2403. {
  2404. collection.AddRange (controls);
  2405. }
  2406. public virtual void Clear ()
  2407. {
  2408. collection.Clear ();
  2409. }
  2410. public bool Contains (Control control)
  2411. {
  2412. return collection.Contains (control);
  2413. }
  2414. public void CopyTo (Array dest,int index)
  2415. {
  2416. collection.CopyTo (dest, index);
  2417. }
  2418. [MonoTODO]
  2419. public override bool Equals (object other)
  2420. {
  2421. throw new NotImplementedException ();
  2422. }
  2423. //inherited
  2424. //public static bool Equals(object o1, object o2) {
  2425. // throw new NotImplementedException ();
  2426. //}
  2427. [MonoTODO]
  2428. public int GetChildIndex (Control child)
  2429. {
  2430. throw new NotImplementedException ();
  2431. }
  2432. public IEnumerator GetEnumerator ()
  2433. {
  2434. return collection.GetEnumerator ();
  2435. }
  2436. [MonoTODO]
  2437. public override int GetHashCode ()
  2438. {
  2439. throw new NotImplementedException ();
  2440. }
  2441. public int IndexOf (Control control)
  2442. {
  2443. return collection.IndexOf (control);
  2444. }
  2445. public virtual void Remove (Control value)
  2446. {
  2447. collection.Remove (value);
  2448. }
  2449. public void RemoveAt (int index)
  2450. {
  2451. collection.RemoveAt (index);
  2452. }
  2453. [MonoTODO]
  2454. public void SetChildIndex (Control child,int newIndex)
  2455. {
  2456. throw new NotImplementedException ();
  2457. }
  2458. /// --- ControlCollection.IClonable methods ---
  2459. [MonoTODO]
  2460. object ICloneable.Clone ()
  2461. {
  2462. throw new NotImplementedException ();
  2463. }
  2464. /// --- ControlCollection.IList properties ---
  2465. bool IList.IsFixedSize {
  2466. get { return collection.IsFixedSize; }
  2467. }
  2468. object IList.this [int index] {
  2469. get { return collection[index]; }
  2470. set { collection[index] = value; }
  2471. }
  2472. object ICollection.SyncRoot {
  2473. get { return collection.SyncRoot; }
  2474. }
  2475. bool ICollection.IsSynchronized {
  2476. get { return collection.IsSynchronized; }
  2477. }
  2478. /// --- ControlCollection.IList methods ---
  2479. int IList.Add (object control)
  2480. {
  2481. return collection.Add (control);
  2482. }
  2483. bool IList.Contains (object control)
  2484. {
  2485. return collection.Contains (control);
  2486. }
  2487. int IList.IndexOf (object control)
  2488. {
  2489. return collection.IndexOf (control);
  2490. }
  2491. void IList.Insert (int index,object value)
  2492. {
  2493. collection.Insert (index, value);
  2494. }
  2495. void IList.Remove (object control)
  2496. {
  2497. collection.Remove (control);
  2498. }
  2499. } // --- end of Control.ControlCollection ---
  2500. }
  2501. }