RadioButton.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // System.Windows.Forms.Frame
  3. //
  4. // Author:
  5. // Joel Basson ([email protected])
  6. //
  7. //
  8. using System;
  9. using System.Drawing;
  10. using System.Drawing.Printing;
  11. using System.ComponentModel;
  12. namespace System.Windows.Forms {
  13. /// <summary>
  14. /// Represents a Windows RadioButton control.
  15. ///
  16. /// </summary>
  17. /// This doesn't work properly. The "else" statement never seems
  18. /// to get invoked, causing the grouping to not work.
  19. ///
  20. class RadioButton : ButtonBase {
  21. private static bool initialized;
  22. private static Gtk.RadioButton first_radio_button;
  23. public RadioButton()
  24. {
  25. initialized = false;
  26. }
  27. private static Gtk.Widget MakeWidget() {
  28. if ( initialized == false ) {
  29. initialized = true;
  30. first_radio_button = new Gtk.RadioButton(null, "");
  31. return first_radio_button;
  32. }
  33. else {
  34. return Gtk.RadioButton.NewWithLabelFromWidget(first_radio_button, "");
  35. }
  36. }
  37. internal override Gtk.Widget CreateWidget() {
  38. return MakeWidget();
  39. }
  40. public override string Text {
  41. get {
  42. return ((Gtk.RadioButton)Widget).Label;
  43. }
  44. set {
  45. ((Gtk.RadioButton)Widget).Label = value;
  46. }
  47. }
  48. }
  49. }