StatusBar.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. //
  2. // System.Windows.Forms.StatusBar.cs
  3. //
  4. // Author:
  5. // stubbed out by Daniel Carrera ([email protected])
  6. // stubbed out by Richard Baumann ([email protected])
  7. // Dennis Hayes ([email protected])
  8. //
  9. // (C) 2002 Ximian, Inc
  10. //
  11. using System;
  12. using System.Collections;
  13. using System.Drawing;
  14. using System.ComponentModel;
  15. namespace System.Windows.Forms {
  16. // <summary>
  17. // This is only a template. Nothing is implemented yet.
  18. // Represents a Windows status bar control.
  19. // </summary>
  20. public class StatusBar : Control {
  21. //
  22. // --- Private Fields
  23. //
  24. private bool showPanels;
  25. private bool sizingGrip;
  26. //
  27. // --- Constructors/Destructors
  28. //
  29. [MonoTODO]
  30. public StatusBar() : base()
  31. {
  32. Dock = DockStyle.Bottom;
  33. showPanels = false;
  34. sizingGrip = true;
  35. throw new NotImplementedException ();
  36. }
  37. //
  38. // --- Public Methods
  39. //
  40. [MonoTODO]
  41. public override string ToString()
  42. {
  43. throw new NotImplementedException ();
  44. }
  45. //
  46. // --- Protected Methods
  47. //
  48. [MonoTODO]
  49. protected override void CreateHandle()
  50. {
  51. throw new NotImplementedException ();
  52. }
  53. //inherited
  54. //protected override void Dispose(bool disposing)
  55. //{
  56. // throw new NotImplementedException ();
  57. //}
  58. [MonoTODO]
  59. protected virtual void OnDrawItem(StatusBarDrawItemEventArgs e)
  60. {
  61. throw new NotImplementedException ();
  62. }
  63. [MonoTODO]
  64. protected override void OnHandleCreated(EventArgs e)
  65. {
  66. throw new NotImplementedException ();
  67. }
  68. [MonoTODO]
  69. protected override void OnHandleDestroyed(EventArgs e)
  70. {
  71. throw new NotImplementedException ();
  72. }
  73. [MonoTODO]
  74. protected override void OnLayout(LayoutEventArgs e)
  75. {
  76. throw new NotImplementedException ();
  77. }
  78. [MonoTODO]
  79. protected override void OnMouseDown(MouseEventArgs e)
  80. {
  81. throw new NotImplementedException ();
  82. }
  83. [MonoTODO]
  84. protected virtual void OnPanelClick(StatusBarPanelClickEventArgs e)
  85. {
  86. throw new NotImplementedException ();
  87. }
  88. [MonoTODO]
  89. protected override void OnResize(EventArgs e)
  90. {
  91. throw new NotImplementedException ();
  92. }
  93. [MonoTODO]
  94. protected override void WndProc(ref Message m)
  95. {
  96. throw new NotImplementedException ();
  97. }
  98. //
  99. // --- Public Events
  100. //
  101. public event StatusBarDrawItemEventHandler DrawItem;
  102. public event StatusBarPanelClickEventHandler PanelClick;
  103. //
  104. // --- Public Properties
  105. //
  106. [MonoTODO]
  107. public override Color BackColor {
  108. get { throw new NotImplementedException (); }
  109. set { throw new NotImplementedException (); }
  110. }
  111. [MonoTODO]
  112. public override Image BackgroundImage {
  113. get { throw new NotImplementedException (); }
  114. set { throw new NotImplementedException (); }
  115. }
  116. [MonoTODO]
  117. public override DockStyle Dock {
  118. get { throw new NotImplementedException (); }
  119. set { throw new NotImplementedException (); }
  120. }
  121. [MonoTODO]
  122. public override Font Font {
  123. get { throw new NotImplementedException (); }
  124. set { throw new NotImplementedException (); }
  125. }
  126. [MonoTODO]
  127. public override Color ForeColor {
  128. get { throw new NotImplementedException (); }
  129. set { throw new NotImplementedException (); }
  130. }
  131. [MonoTODO]
  132. public new ImeMode ImeMode {
  133. get { throw new NotImplementedException (); }
  134. set { throw new NotImplementedException (); }
  135. }
  136. [MonoTODO]
  137. public StatusBar.StatusBarPanelCollection Panels {
  138. get { throw new NotImplementedException (); }
  139. }
  140. [MonoTODO]
  141. public bool ShowPanels {// default false {
  142. get { throw new NotImplementedException (); }
  143. set { throw new NotImplementedException (); }
  144. }
  145. [MonoTODO]
  146. public bool SizingGrip // default true {
  147. {
  148. get { throw new NotImplementedException (); }
  149. set { throw new NotImplementedException (); }
  150. }
  151. [MonoTODO]
  152. public new bool TabStop {
  153. get { throw new NotImplementedException (); }
  154. set { throw new NotImplementedException (); }
  155. }
  156. [MonoTODO]
  157. public override string Text {
  158. get { throw new NotImplementedException (); }
  159. set { throw new NotImplementedException (); }
  160. }
  161. //
  162. // --- Protected Properties
  163. //
  164. [MonoTODO]
  165. protected override CreateParams CreateParams {
  166. get { throw new NotImplementedException (); }
  167. }
  168. [MonoTODO]
  169. protected override ImeMode DefaultImeMode {
  170. get { throw new NotImplementedException (); }
  171. }
  172. [MonoTODO]
  173. protected override Size DefaultSize {
  174. get { throw new NotImplementedException (); }
  175. }
  176. //
  177. // System.Windows.Forms.StatusBar.StatusBarPanelCollection
  178. //
  179. // Author:
  180. // stubbed out by Richard Baumann ([email protected])
  181. // stub ammended by Jaak Simm ([email protected])
  182. // Implemented by Richard Baumann <[email protected]>
  183. // (C) Ximian, Inc., 2002
  184. //
  185. // <summary>
  186. // Represents the collection of panels in a StatusBar control.
  187. // </summary>
  188. public class StatusBarPanelCollection : IList, ICollection, IEnumerable {
  189. //
  190. // --- Private Fields
  191. //
  192. private ArrayList list;
  193. private StatusBar owner;
  194. private static string class_string = "System.Windows.Forms.StatusBar.StatusBarPanelCollection::";
  195. //
  196. // --- Constructors/Destructors
  197. //
  198. StatusBarPanelCollection(StatusBar owner) : base()
  199. {
  200. list = new ArrayList();
  201. this.owner = owner;
  202. }
  203. //
  204. // --- Public Methods
  205. //
  206. [MonoTODO]
  207. public virtual int Add(StatusBarPanel panel)
  208. {
  209. string method_string = "Add(StatusBarPanel) ";
  210. if (panel == null) {
  211. throw new ArgumentNullException(class_string + method_string + "panel == null");
  212. }
  213. if (panel.Parent == null) {
  214. throw new ArgumentException(class_string + method_string + "panel.Parent != null");
  215. }
  216. // FIXME: StatusBarPanel.Parent is readonly!
  217. //panel.Parent = owner;
  218. return list.Add(panel);
  219. }
  220. [MonoTODO]
  221. public virtual StatusBarPanel Add(string s)
  222. {
  223. throw new NotImplementedException ();
  224. // StatusBarPanel tmp = new StatusBarPanel();
  225. // tmp.Text = s;
  226. // // FIXME: StatusBarPanel.Parent is readonly!
  227. // //tmp.Parent = owner;
  228. // list.Add(tmp);
  229. // return tmp;
  230. }
  231. [MonoTODO]
  232. public virtual void AddRange(StatusBarPanel[] panels)
  233. {
  234. string method_string = "AddRange(StatusBarPanel[]) ";
  235. if (panels == null) {
  236. throw new ArgumentNullException(class_string + method_string + "panels == null");
  237. }
  238. for (int i = 0; i < panels.Length; i++) {
  239. // FIXME: StatusBarPanel.Parent is readonly!
  240. //panels[i].Parent = owner;
  241. }
  242. list.AddRange(panels);
  243. }
  244. public virtual void Clear()
  245. {
  246. list.Clear();
  247. }
  248. public bool Contains(StatusBarPanel panel)
  249. {
  250. return list.Contains(panel);
  251. }
  252. public IEnumerator GetEnumerator()
  253. {
  254. return list.GetEnumerator();
  255. }
  256. public int IndexOf(StatusBarPanel panel)
  257. {
  258. return list.IndexOf(panel);
  259. }
  260. [MonoTODO]
  261. public virtual void Insert(int index, StatusBarPanel panel)
  262. {
  263. string method_string = "Insert(int,StatusBarPanel) ";
  264. if (panel == null) {
  265. throw new ArgumentNullException(class_string + method_string + "panel == null");
  266. }
  267. if (panel.Parent == null) {
  268. throw new ArgumentException(class_string + method_string + "panel.Parent != null");
  269. }
  270. if (panel.AutoSize != StatusBarPanelAutoSize.None &&
  271. panel.AutoSize != StatusBarPanelAutoSize.Contents &&
  272. panel.AutoSize != StatusBarPanelAutoSize.Spring)
  273. {
  274. throw new InvalidEnumArgumentException(class_string + method_string + "panel.AutoSize is not a valid StatusBarPanelAutoSize value");
  275. }
  276. list.Insert(index,panel);
  277. // do this after insert because insert does the range checking and might throw an exception
  278. // FIXME: StatusBarPanel.Parent is readonly!
  279. // panel.Parent = owner; // a rethrow for a better exception message, or an extra range check, would incur an unnecessary performance cost
  280. }
  281. public virtual void Remove(StatusBarPanel panel)
  282. {
  283. string method_string = "Remove(StatusBarPanel) ";
  284. if (panel == null) {
  285. throw new ArgumentNullException(class_string + method_string + "panel == null");
  286. }
  287. list.Remove(panel);
  288. }
  289. public virtual void RemoveAt(int index)
  290. {
  291. list.RemoveAt(index);
  292. }
  293. void ICollection.CopyTo(Array dest, int index)
  294. {
  295. string method_string = "ICollection.CopyTo(Array,int) ";
  296. if (dest == null) {
  297. throw new ArgumentNullException(class_string + method_string + "array == null");
  298. }
  299. if (index < 0) {
  300. throw new ArgumentOutOfRangeException(class_string + method_string + "index < 0");
  301. }
  302. if (dest.Rank != 1) {
  303. throw new ArgumentException(class_string + method_string + "array is multidimensional");
  304. }
  305. if (index >= dest.Length) {
  306. throw new ArgumentException(class_string + method_string + "index >= array.Length");
  307. }
  308. if (Count+index >= dest.Length) {
  309. throw new ArgumentException(class_string + method_string + "insufficient array capacity");
  310. }
  311. // easier/quicker to let the runtime throw the invalid cast exception if necessary
  312. for (int i = 0; index < dest.Length; i++, index++) {
  313. dest.SetValue(list[i], index);
  314. }
  315. }
  316. int IList.Add(object panel)
  317. {
  318. string method_string = "IList.Add(object) ";
  319. if (!(panel is StatusBarPanel)) {
  320. throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
  321. }
  322. return Add((StatusBarPanel) panel);
  323. }
  324. bool IList.Contains(object panel)
  325. {
  326. if (!(panel is StatusBarPanel)) {
  327. return false;
  328. }
  329. return Contains((StatusBarPanel) panel);
  330. }
  331. int IList.IndexOf(object panel)
  332. {
  333. if (!(panel is StatusBarPanel)) {
  334. return -1;
  335. }
  336. return IndexOf((StatusBarPanel) panel);
  337. }
  338. void IList.Insert(int index, object panel)
  339. {
  340. string method_string = "IList.Insert(int,object) ";
  341. if (!(panel is StatusBarPanel)) {
  342. throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
  343. }
  344. Insert(index, (StatusBarPanel) panel);
  345. }
  346. void IList.Remove(object panel)
  347. {
  348. string method_string = "IList.Remove(object) ";
  349. if (!(panel is StatusBarPanel)) {
  350. throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
  351. }
  352. Remove((StatusBarPanel) panel);
  353. }
  354. // --- Public Properties
  355. [MonoTODO]
  356. public int Count {
  357. get { throw new NotImplementedException (); }
  358. //get { return list.Count; }
  359. }
  360. public bool IsReadOnly {
  361. get { return false; }
  362. }
  363. object IList.this[int index] {
  364. get { return this[index]; }
  365. set { this[index]=(StatusBarPanel)value; }
  366. }
  367. public virtual StatusBarPanel this[int index] {
  368. get
  369. {
  370. // The same checks are done by the list, so this is redundant
  371. // This is left here in case you prefer better exception messages over performance
  372. //string method_string = "get_Item(int) ";
  373. //if (index < 0)
  374. //{
  375. // throw new ArgumentOutOfRangeException(class_string + method_string + "index < 0");
  376. //}
  377. //if (index >= Count)
  378. //{
  379. // throw new ArgumentOutOfRangeException(class_string + method_string + "index >= Count");
  380. //}
  381. return (StatusBarPanel)list[index];
  382. }
  383. set
  384. {
  385. // The same checks are done by the list, so this is redundant
  386. // This is left here in case you prefer better exception messages over performance
  387. //string method_string = "set_Item(int,StatusBarPanel) ";
  388. //if (index < 0)
  389. //{
  390. // throw new ArgumentOutOfRangeException(class_string + method_string + "index < 0");
  391. //}
  392. //if (index >= Count)
  393. //{
  394. // throw new ArgumentOutOfRangeException(class_string + method_string + "index >= Count");
  395. //}
  396. //if (value == null)
  397. //{
  398. // throw new ArgumentNullException(class_string + method_string + "panel == null");
  399. //}
  400. list[index] = value;
  401. }
  402. }
  403. bool IList.IsFixedSize {
  404. [MonoTODO] get { throw new NotImplementedException (); }
  405. }
  406. object ICollection.SyncRoot {
  407. [MonoTODO] get { throw new NotImplementedException (); }
  408. }
  409. bool ICollection.IsSynchronized {
  410. [MonoTODO] get { throw new NotImplementedException (); }
  411. }
  412. // --- Private Properties
  413. private bool IsFixedSize { get { return false; } }
  414. // private object ILList.this[int index]
  415. // {
  416. // get { return (StatusBarPanel) this[index]; }
  417. // set
  418. // {
  419. // string method_string = "IList.set_Item(int,object) ";
  420. // if (!(value is StatusBarPanel))
  421. // {
  422. // throw new ArgumentException(class_string + method_string + "panel is not a StatusBarPanel");
  423. // }
  424. // this[index] = (StatusBarPanel) value;
  425. // }
  426. // }
  427. }
  428. }
  429. }