Form.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  1. //
  2. // System.Windows.Forms.Form
  3. //
  4. // Author:
  5. // Miguel de Icaza ([email protected])
  6. // stubbed out by Daniel Carrera ([email protected])
  7. //
  8. // (C) 2002 Ximian, Inc
  9. //
  10. using System;
  11. using System.Drawing;
  12. using Gtk;
  13. using GtkSharp;
  14. namespace System.Windows.Forms {
  15. public class Form : ContainerControl {
  16. Window win;
  17. string caption;
  18. public Form () : base ()
  19. {
  20. }
  21. static Form ()
  22. {
  23. Gtk.Application.Init ();
  24. }
  25. void delete_cb (object o, DeleteEventArgs args)
  26. {
  27. //if (Closing != null)
  28. //Closing (o, args);
  29. if (Closed != null)
  30. Closed (o, args);
  31. }
  32. internal override Widget CreateWidget ()
  33. {
  34. Widget contents = base.CreateWidget ();
  35. win = new Window (WindowType.Toplevel);
  36. win.DeleteEvent += new DeleteEventHandler (delete_cb);
  37. win.Title = Text;
  38. win.Add (contents);
  39. return (Widget) win;
  40. }
  41. // --- Public Properties
  42. //
  43. // [MonoTODO]
  44. // public IButtonControl AcceptButton {
  45. // get {
  46. // throw new NotImplementedException ();
  47. // }
  48. // set {
  49. // throw new NotImplementedException ();
  50. // }
  51. //}
  52. // [MonoTODO]
  53. // public static Form ActiveForm {
  54. // get {
  55. // throw new NotImplementedException ();
  56. // }
  57. //}
  58. // [MonoTODO]
  59. // public Form ActiveMdiChild {
  60. // get {
  61. // throw new NotImplementedException ();
  62. // }
  63. //}
  64. // [MonoTODO]
  65. // public bool AutoScale {
  66. // get {
  67. // throw new NotImplementedException ();
  68. // }
  69. // set {
  70. // throw new NotImplementedException ();
  71. // }
  72. //}
  73. // [MonoTODO]
  74. // public virtual Size AtoScaleBaseSize {
  75. // get {
  76. // throw new NotImplementedException ();
  77. // }
  78. // set {
  79. // throw new NotImplementedException ();
  80. // }
  81. //}
  82. // [MonoTODO]
  83. // public override bool AutoScroll {
  84. // get {
  85. // throw new NotImplementedException ();
  86. // }
  87. // set {
  88. // throw new NotImplementedException ();
  89. // }
  90. //}
  91. // [MonoTODO]
  92. // public virtual Color BackColor {
  93. // get {
  94. // throw new NotImplementedException ();
  95. // }
  96. // set {
  97. // throw new NotImplementedException ();
  98. // }
  99. //}
  100. // [MonoTODO]
  101. // public IButtonControl CancelButton {
  102. // get {
  103. // throw new NotImplementedException ();
  104. // }
  105. // set {
  106. // throw new NotImplementedException ();
  107. // }
  108. //}
  109. // [MonoTODO]
  110. // public new Size ClientSize {
  111. // get {
  112. // throw new NotImplementedException ();
  113. // }
  114. // set {
  115. // throw new NotImplementedException ();
  116. // }
  117. //}
  118. // [MonoTODO]
  119. // public bool ControlBox {
  120. // get {
  121. // throw new NotImplementedException ();
  122. // }
  123. // set {
  124. // throw new NotImplementedException ();
  125. // }
  126. //}
  127. // [MonoTODO]
  128. // public Rectangle DesktopBounds {
  129. // get {
  130. // throw new NotImplementedException ();
  131. // }
  132. // set {
  133. // throw new NotImplementedException ();
  134. // }
  135. //}
  136. // [MonoTODO]
  137. // public Point DesktopLocation {
  138. // get {
  139. // throw new NotImplementedException ();
  140. // }
  141. // set {
  142. // throw new NotImplementedException ();
  143. // }
  144. //}
  145. // [MonoTODO]
  146. // public DialogResult DialogResult {
  147. // get {
  148. // throw new NotImplementedException ();
  149. // }
  150. // set {
  151. // throw new NotImplementedException ();
  152. // }
  153. //}
  154. // [MonoTODO]
  155. // public FormBorderStyle FormBorderStyle {
  156. // get {
  157. // throw new NotImplementedException ();
  158. // }
  159. // set {
  160. // throw new NotImplementedException ();
  161. // }
  162. //}
  163. // [MonoTODO]
  164. // public bool HelpButton {
  165. // get {
  166. // throw new NotImplementedException ();
  167. // }
  168. // set {
  169. // throw new NotImplementedException ();
  170. // }
  171. //}
  172. // [MonoTODO]
  173. // public Icon Icon {
  174. // get {
  175. // throw new NotImplementedException ();
  176. // }
  177. // set {
  178. // throw new NotImplementedException ();
  179. // }
  180. //}
  181. // [MonoTODO]
  182. // public bool IsMidiChild {
  183. // get {
  184. // throw new NotImplementedException ();
  185. // }
  186. // set {
  187. // throw new NotImplementedException ();
  188. // }
  189. //}
  190. // [MonoTODO]
  191. // public bool IsMidiContainer {
  192. // get {
  193. // throw new NotImplementedException ();
  194. // }
  195. // set {
  196. // throw new NotImplementedException ();
  197. // }
  198. //}
  199. // [MonoTODO]
  200. // public bool KeyPreview {
  201. // get {
  202. // throw new NotImplementedException ();
  203. // }
  204. // set {
  205. // throw new NotImplementedException ();
  206. // }
  207. //}
  208. // [MonoTODO]
  209. // public bool MaximizeBox {
  210. // get {
  211. // throw new NotImplementedException ();
  212. // }
  213. // set {
  214. // throw new NotImplementedException ();
  215. // }
  216. //}
  217. // [MonoTODO]
  218. // public Size MaximumSize {
  219. // get {
  220. // throw new NotImplementedException ();
  221. // }
  222. // set {
  223. // throw new NotImplementedException ();
  224. // }
  225. //}
  226. // [MonoTODO]
  227. // public Form[] MdiChildren {
  228. // get {
  229. // throw new NotImplementedException ();
  230. // }
  231. // set {
  232. // throw new NotImplementedException ();
  233. // }
  234. //}
  235. // [MonoTODO]
  236. // public Form MdiParent {
  237. // get {
  238. // throw new NotImplementedException ();
  239. // }
  240. // set {
  241. // throw new NotImplementedException ();
  242. // }
  243. //}
  244. // [MonoTODO]
  245. // public MainMenu Menu {
  246. // get {
  247. // throw new NotImplementedException ();
  248. // }
  249. // set {
  250. // throw new NotImplementedException ();
  251. // }
  252. //}
  253. // [MonoTODO]
  254. // public MainMenu MergedMenu {
  255. // get {
  256. // throw new NotImplementedException ();
  257. // }
  258. //}
  259. // [MonoTODO]
  260. // public bool MinimizeBox {
  261. // get {
  262. // throw new NotImplementedException ();
  263. // }
  264. // set {
  265. // throw new NotImplementedException ();
  266. // }
  267. //}
  268. // [MonoTODO]
  269. // public Size MinimumSize {
  270. // get {
  271. // throw new NotImplementedException ();
  272. // }
  273. // set {
  274. // throw new NotImplementedException ();
  275. // }
  276. //}
  277. // [MonoTODO]
  278. // public bool Modal {
  279. // get {
  280. // throw new NotImplementedException ();
  281. // }
  282. //}
  283. // [MonoTODO]
  284. // public double Opacity {
  285. // get {
  286. // throw new NotImplementedException ();
  287. // }
  288. // set {
  289. // throw new NotImplementedException ();
  290. // }
  291. //}
  292. // [MonoTODO]
  293. // public Form[] OwnedForms {
  294. // get {
  295. // throw new NotImplementedException ();
  296. // }
  297. //}
  298. // [MonoTODO]
  299. // public Form Owner {
  300. // get {
  301. // throw new NotImplementedException ();
  302. // }
  303. // set {
  304. // throw new NotImplementedException ();
  305. // }
  306. //}
  307. // [MonoTODO]
  308. // public bool ShowInTaskbar {
  309. // get {
  310. // throw new NotImplementedException ();
  311. // }
  312. // set {
  313. // throw new NotImplementedException ();
  314. // }
  315. //}
  316. // [MonoTODO]
  317. // public override ISite Site {
  318. // get {
  319. // throw new NotImplementedException ();
  320. // }
  321. // set {
  322. // throw new NotImplementedException ();
  323. // }
  324. //}
  325. // [MonoTODO]
  326. // public SizeGripStyle SizeGripStyle {
  327. // get {
  328. // throw new NotImplementedException ();
  329. // }
  330. // set {
  331. // throw new NotImplementedException ();
  332. // }
  333. //}
  334. // [MonoTODO]
  335. // public FormStartPosition StartPosition {
  336. // get {
  337. // throw new NotImplementedException ();
  338. // }
  339. // set {
  340. // throw new NotImplementedException ();
  341. // }
  342. //}
  343. // [MonoTODO]
  344. // public bool TopLevel {
  345. // get {
  346. // throw new NotImplementedException ();
  347. // }
  348. // set {
  349. // throw new NotImplementedException ();
  350. // }
  351. //}
  352. // [MonoTODO]
  353. // public bool TopMost {
  354. // get {
  355. // throw new NotImplementedException ();
  356. // }
  357. // set {
  358. // throw new NotImplementedException ();
  359. // }
  360. //}
  361. // [MonoTODO]
  362. // public Color TransparencyKey {
  363. // get {
  364. // throw new NotImplementedException ();
  365. // }
  366. // set {
  367. // throw new NotImplementedException ();
  368. // }
  369. //}
  370. // [MonoTODO]
  371. // public FormWindowState WindowState {
  372. // get {
  373. // throw new NotImplementedException ();
  374. // }
  375. // set {
  376. // throw new NotImplementedException ();
  377. // }
  378. //}
  379. //
  380. // --- Public Methods
  381. //
  382. // [MonoTODO]
  383. // public void Activate()
  384. // {
  385. // throw new NotImplementedException ();
  386. // }
  387. // [MonoTODO]
  388. // public void AddOwnedForm(Form ownedForm)
  389. // {
  390. // throw new NotImplementedException ();
  391. // }
  392. // [MonoTODO]
  393. // public void Close()
  394. // {
  395. // throw new NotImplementedException ();
  396. // }
  397. // [MonoTODO]
  398. // public void Dispose()
  399. // {
  400. // throw new NotImplementedException ();
  401. // }
  402. // [MonoTODO]
  403. // public virtual bool Equals(object o);
  404. // {
  405. // throw new NotImplementedException ();
  406. // }
  407. // [MonoTODO]
  408. // public static bool Equals(object o1, object o2);
  409. // {
  410. // throw new NotImplementedException ();
  411. // }
  412. // [MonoTODO]
  413. // public static SizeF GetAutoScaleSize(Font font)
  414. // {
  415. // throw new NotImplementedException ();
  416. // }
  417. // [MonoTODO]
  418. // public void Invalidate()
  419. // {
  420. // throw new NotImplementedException ();
  421. // }
  422. // [MonoTODO]
  423. // public object Invoke()
  424. // {
  425. // throw new NotImplementedException ();
  426. // }
  427. // [MonoTODO]
  428. // public void LayoutMdi(MdiLayout value)
  429. // {
  430. // throw new NotImplementedException ();
  431. // }
  432. // [MonoTODO]
  433. // public void PerformLayout()
  434. // {
  435. // throw new NotImplementedException ();
  436. // }
  437. // [MonoTODO]
  438. // public void RemoveOwnedForm(Form ownedForm)
  439. // {
  440. // throw new NotImplementedException ();
  441. // }
  442. // [MonoTODO]
  443. // public void ResumeLayout()
  444. // {
  445. // throw new NotImplementedException ();
  446. // }
  447. // [MonoTODO]
  448. // public void Scale(float f)
  449. // {
  450. // throw new NotImplementedException ();
  451. // }
  452. // [MonoTODO]
  453. // public void Select()
  454. // {
  455. // throw new NotImplementedException ();
  456. // }
  457. // [MonoTODO]
  458. // public void SetBounds(int, int, int, int)
  459. // {
  460. // throw new NotImplementedException ();
  461. // }
  462. // [MonoTODO]
  463. // public void SetDesktopLocation(int x, int y)
  464. // {
  465. // throw new NotImplementedException ();
  466. // }
  467. // [MonoTODO]
  468. // public DialogResult ShowDialog()
  469. // {
  470. // throw new NotImplementedException ();
  471. // }
  472. // [MonoTODO]
  473. // public override string ToString()
  474. // {
  475. // throw new NotImplementedException ();
  476. // }
  477. //
  478. // --- Public Events
  479. //
  480. // [MonoTODO]
  481. // public event EventHandler Activated {
  482. // add {
  483. // throw new NotImplementedException ();
  484. // }
  485. // remove {
  486. // throw new NotImplementedException ();
  487. // }
  488. //}
  489. public event EventHandler Closed;
  490. // public event CancelEventHandler Closing;
  491. // [MonoTODO]
  492. // public event EventHandler Deactivate {
  493. // add {
  494. // throw new NotImplementedException ();
  495. // }
  496. // remove {
  497. // throw new NotImplementedException ();
  498. // }
  499. //}
  500. // [MonoTODO]
  501. // public event InputLanguageChangedEventHandler InputLanguageChanged {
  502. // add {
  503. // throw new NotImplementedException ();
  504. // }
  505. // remove {
  506. // throw new NotImplementedException ();
  507. // }
  508. //}
  509. // [MonoTODO]
  510. // public event InputLanguageChangingEventHandler InputLanguageChanging {
  511. // add {
  512. // throw new NotImplementedException ();
  513. // }
  514. // remove {
  515. // throw new NotImplementedException ();
  516. // }
  517. //}
  518. // [MonoTODO]
  519. // public event EventHandler Load {
  520. // add {
  521. // throw new NotImplementedException ();
  522. // }
  523. // remove {
  524. // throw new NotImplementedException ();
  525. // }
  526. //}
  527. // [MonoTODO]
  528. // public event EventHandler MaximizedBoundsChanged {
  529. // add {
  530. // throw new NotImplementedException ();
  531. // }
  532. // remove {
  533. // throw new NotImplementedException ();
  534. // }
  535. //}
  536. // [MonoTODO]
  537. // public event EventHandler MaximumSizeChanged {
  538. // add {
  539. // throw new NotImplementedException ();
  540. // }
  541. // remove {
  542. // throw new NotImplementedException ();
  543. // }
  544. //}
  545. // [MonoTODO]
  546. // public event EventHandler MdiChildActivate {
  547. // add {
  548. // throw new NotImplementedException ();
  549. // }
  550. // remove {
  551. // throw new NotImplementedException ();
  552. // }
  553. //}
  554. // [MonoTODO]
  555. // public event EventHandler MenuComplete {
  556. // add {
  557. // throw new NotImplementedException ();
  558. // }
  559. // remove {
  560. // throw new NotImplementedException ();
  561. // }
  562. //}
  563. // [MonoTODO]
  564. // public event EventHandler MenuStart {
  565. // add {
  566. // throw new NotImplementedException ();
  567. // }
  568. // remove {
  569. // throw new NotImplementedException ();
  570. // }
  571. //}
  572. // [MonoTODO]
  573. // public event EventHandler MinimumSizedChanged {
  574. // add {
  575. // throw new NotImplementedException ();
  576. // }
  577. // remove {
  578. // throw new NotImplementedException ();
  579. // }
  580. //}
  581. //
  582. // --- Protected Properties
  583. //
  584. // [MonoTODO]
  585. // protected override CreateParams CreateParams {
  586. // get {
  587. // throw new NotImplementedException ();
  588. // }
  589. //}
  590. // [MonoTODO]
  591. // protected override ImeMode DefaultImeMode {
  592. // get {
  593. // throw new NotImplementedException ();
  594. // }
  595. //}
  596. // [MonoTODO]
  597. // protected override Size DefaultSize {
  598. //}
  599. // [MonoTODO]
  600. // protected Rectangle MaximizedBounds {
  601. // get {
  602. // throw new NotImplementedException ();
  603. // }
  604. // set {
  605. // throw new NotImplementedException ();
  606. // }
  607. //}
  608. //
  609. // --- Protected Methods
  610. //
  611. // [MonoTODO]
  612. // protected override void AdjustFormScrollbars(bool displayScrollbars)
  613. // {
  614. // throw new NotImplementedException ();
  615. // }
  616. // [MonoTODO]
  617. // protected override ControlCollection CreateControlsInstnace()
  618. // {
  619. // throw new NotImplementedException ();
  620. // }
  621. // [MonoTODO]
  622. // protected override void CreateHandle()
  623. // {
  624. // throw new NotImplementedException ();
  625. // }
  626. // [MonoTODO]
  627. // protected override void DefWndProc(ref Message m)
  628. // {
  629. // throw new NotImplementedException ();
  630. // }
  631. // [MonoTODO]
  632. // protected override void Dispose(bool b)
  633. // {
  634. // throw new NotImplementedException ();
  635. // }
  636. // [MonoTODO]
  637. // protected virtual void OnClosed(EventArgs e)
  638. // {
  639. // throw new NotImplementedException ();
  640. // }
  641. // [MonoTODO]
  642. // protected virtual void OnClosing(CancelEventArgs e)
  643. // {
  644. // throw new NotImplementedException ();
  645. // }
  646. // [MonoTODO]
  647. // protected override void OnCreateControl()
  648. // {
  649. // throw new NotImplementedException ();
  650. // }
  651. // [MonoTODO]
  652. // protected override void OnFontChanged(EventArgs e)
  653. // {
  654. // throw new NotImplementedException ();
  655. // }
  656. // [MonoTODO]
  657. // protected override void OnHandleCreated(EventArgs e)
  658. // {
  659. // throw new NotImplementedException ();
  660. // }
  661. // [MonoTODO]
  662. // protected override void OnHandleDestroyed(EventArgs e)
  663. // {
  664. // throw new NotImplementedException ();
  665. // }
  666. // [MonoTODO]
  667. // protected virtual void OnInputLanguageChanged( OnInputLanguageChangedEventArgs e)
  668. // {
  669. // throw new NotImplementedException ();
  670. // }
  671. // [MonoTODO]
  672. // protected virtual void OnInputLanguagedChanging( OnInputLanguagedChangingEventArgs e)
  673. // {
  674. // throw new NotImplementedException ();
  675. // }
  676. // [MonoTODO]
  677. // protected virtual void OnLoad(EventArgs e)
  678. // {
  679. // throw new NotImplementedException ();
  680. // }
  681. // [MonoTODO]
  682. // protected virtual void OnMaximizedBoundsChanged(EventArgs e)
  683. // {
  684. // throw new NotImplementedException ();
  685. // }
  686. // [MonoTODO]
  687. // protected virtual void OnMaximumSizedChanged(EventArgs e)
  688. // {
  689. // throw new NotImplementedException ();
  690. // }
  691. // [MonoTODO]
  692. // protected virtual void OnMdiChildActive(EventArgs e)
  693. // {
  694. // throw new NotImplementedException ();
  695. // }
  696. // [MonoTODO]
  697. // protected virtual void OnMenuComplete(EventArgs e)
  698. // {
  699. // throw new NotImplementedException ();
  700. // }
  701. // [MonoTODO]
  702. // protected virtual void OnMenuStart(EventArgs e)
  703. // {
  704. // throw new NotImplementedException ();
  705. // }
  706. // [MonoTODO]
  707. // protected virtual void OnMinimumSizeChanged(EventArgs e)
  708. // {
  709. // throw new NotImplementedException ();
  710. // }
  711. // [MonoTODO]
  712. // protected override void OnPaint(EventArgs e)
  713. // {
  714. // throw new NotImplementedException ();
  715. // }
  716. // [MonoTODO]
  717. // protected override void OnResize(EventArgs e)
  718. // {
  719. // throw new NotImplementedException ();
  720. // }
  721. // [MonoTODO]
  722. // protected override void OnStyleChanged(EventArgs e)
  723. // {
  724. // throw new NotImplementedException ();
  725. // }
  726. protected override void OnTextChanged(EventArgs e)
  727. {
  728. if (win != null)
  729. win.Title = Text;
  730. }
  731. // [MonoTODO]
  732. // protected override void OnVisibleChanged(EventArgs e)
  733. // {
  734. // throw new NotImplementedException ();
  735. // }
  736. // [MonoTODO]
  737. // protected override bool ProcessCmdKey( ref Message msg, Keys keyData)
  738. // {
  739. // throw new NotImplementedException ();
  740. // }
  741. // [MonoTODO]
  742. // protected override bool ProcessDialogKey(Keys keyData)
  743. // {
  744. // throw new NotImplementedException ();
  745. // }
  746. // [MonoTODO]
  747. // protected override bool ProcessKeyPreview(ref Message m)
  748. // {
  749. // throw new NotImplementedException ();
  750. // }
  751. // [MonoTODO]
  752. // protected override bool ProcessTabKey(bool forward)
  753. // {
  754. // throw new NotImplementedException ();
  755. // }
  756. // [MonoTODO]
  757. // protected override void ScaleScore(float x, float y)
  758. // {
  759. // throw new NotImplementedException ();
  760. // }
  761. // [MonoTODO]
  762. // protected override void Select(bool b1, bool b2)
  763. // {
  764. // throw new NotImplementedException ();
  765. // }
  766. // [MonoTODO]
  767. // protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
  768. // {
  769. // throw new NotImplementedException ();
  770. // }
  771. // [MonoTODO]
  772. // protected override void SelectClientSizeCore(int x, int y)
  773. // {
  774. // throw new NotImplementedException ();
  775. // }
  776. // [MonoTODO]
  777. // protected override void SetVisibleCore(bool value)
  778. // {
  779. // throw new NotImplementedException ();
  780. // }
  781. // [MonoTODO]
  782. // protected void UpdateBounds()
  783. // {
  784. // throw new NotImplementedException ();
  785. // }
  786. // [MonoTODO]
  787. // protected override void WndProc(ref Message m)
  788. // {
  789. // throw new NotImplementedException ();
  790. // }
  791. }
  792. }