Form.cs 17 KB

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