Control.cs 74 KB

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