PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/libs/perl/Choicetool/Widgets/Checkbox.pm

#
Perl | 130 lines | 77 code | 29 blank | 24 comment | 2 complexity | fa23923d5c78fda04b2c1efb258e5ae1 MD5 | raw file
Possible License(s): GPL-2.0
  1. # -*- perl -*-
  2. #
  3. # Checkbox.pm
  4. #
  5. # Copyright (C) 2008, 2009 Francesco Salvestrini
  6. # Alessandro Massignan
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License along
  19. # with this program; if not, write to the Free Software Foundation, Inc.,
  20. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. #
  22. package Choicetool::Widgets::Checkbox;
  23. use 5.8.0;
  24. use warnings;
  25. use strict;
  26. use diagnostics;
  27. use Choicetool::Base::Debug;
  28. use Choicetool::Base::Trace;
  29. use Choicetool::Widgets::Widget;
  30. use vars qw(@ISA);
  31. @ISA = qw(Choicetool::Widgets::Widget);
  32. sub new ($$)
  33. {
  34. my $class = shift;
  35. my $id = shift;
  36. assert(defined($class));
  37. my $self = $class->SUPER::new($id);
  38. return bless($self, $class);
  39. }
  40. sub title {
  41. my $self = shift;
  42. my $value = shift;
  43. assert(defined($self));
  44. if (defined($value)) {
  45. $self->{TITLE} = $value;
  46. }
  47. return $self->{TITLE};
  48. }
  49. sub symbol {
  50. my $self = shift;
  51. my $value = shift;
  52. assert(defined($self));
  53. if (defined($value)) {
  54. $self->{SYMBOL} = $value;
  55. }
  56. return $self->{SYMBOL};
  57. }
  58. #
  59. # M4 related methods
  60. #
  61. sub m4ify_linear_body ($$)
  62. {
  63. my $self = shift;
  64. my $prefix = shift;
  65. assert(defined($self));
  66. assert(defined($prefix));
  67. assert(defined($self->id()));
  68. return
  69. $prefix .
  70. "CT_UI_CHECKBOX_DATA([" .
  71. $self->id() .
  72. "])\n";
  73. }
  74. sub m4ify_hierarchical_header ($$)
  75. {
  76. my $self = shift;
  77. my $prefix = shift;
  78. assert(defined($self));
  79. assert(defined($prefix));
  80. assert(defined($self->id()));
  81. assert(defined($self->title()));
  82. assert(defined($self->symbol()));
  83. return
  84. $prefix .
  85. "CT_UI_CHECKBOX_WIDGET([" .
  86. $self->id() .
  87. "],[" .
  88. $self->title() .
  89. "],[" .
  90. $self->symbol() .
  91. "])\n";
  92. }
  93. sub m4ify_hierarchical_footer ($$)
  94. {
  95. my $self = shift;
  96. my $prefix = shift;
  97. assert(defined($self));
  98. assert(defined($prefix));
  99. return "";
  100. }
  101. 1;