Form.cs 17 KB

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