home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / perl5 / Debconf / Element / Kde.pm < prev    next >
Encoding:
Perl POD Document  |  2006-07-24  |  2.9 KB  |  168 lines

  1. #!/usr/bin/perl -w
  2. # This file was preprocessed, do not edit!
  3.  
  4.  
  5. package Debconf::Element::Kde::ElementWidget;
  6. use Qt;
  7. use Qt::isa @ISA = qw(Qt::Widget);
  8. use Qt::attributes qw(layout mytop toplayout);
  9.  
  10.  
  11. sub NEW {
  12.     shift->SUPER::NEW (@_[0..2]);
  13.     mytop = undef;
  14. }
  15.  
  16.  
  17. sub settop {
  18.     mytop = shift;
  19. }
  20.  
  21.  
  22. sub init {
  23.     setSizePolicy(Qt::SizePolicy(1, &Qt::SizePolicy::Preferred, 0, 
  24.                                  0, sizePolicy()->hasHeightForWidth()));
  25.     toplayout = layout = Qt::VBoxLayout(this, 0, 10, "TopVBox");
  26.     if (mytop) {
  27.         toplayout->addWidget (mytop);
  28.         layout = Qt::VBoxLayout(mytop, 15, 5, "TopVBox");
  29.     }
  30.     else {
  31.         mytop = this;
  32.     }
  33. }
  34.  
  35.  
  36. sub destroy {
  37.     toplayout -> remove (mytop);
  38.     undef mytop;
  39. }
  40.  
  41.  
  42. sub top {
  43.     return mytop;
  44. }
  45.  
  46.  
  47. sub addwidget {
  48.     layout->addWidget(@_);
  49. }
  50.  
  51.  
  52. sub addlayout {
  53.     layout->addLayout (@_);
  54. }
  55.  
  56.  
  57. sub additem {
  58.     my $item=shift;
  59.     layout->addItem($item);
  60. }
  61.  
  62.  
  63.  
  64.  
  65.  
  66. package Debconf::Element::Kde;
  67. use strict;
  68. use Qt;
  69. use Debconf::Gettext;
  70. use base qw(Debconf::Element);
  71. use Debconf::Element::Kde::ElementWidget;
  72. use Debconf::Encoding qw(to_Unicode);
  73.  
  74.  
  75. sub create {
  76.     my $this=shift;
  77.     $this->parent(shift);
  78.     $this->top(Debconf::Element::Kde::ElementWidget($this->parent, undef,
  79.                                                     undef, undef));
  80.     $this->top->init;
  81.     $this->top->show;
  82. }
  83.  
  84.  
  85. sub destroy {
  86.     my $this=shift;
  87.     $this->top->destroy;
  88.     $this->top->reparent(undef, 0, Qt::Point(0, 0), 0);
  89.     $this->top->DESTROY;
  90.     $this->top(undef);
  91. }
  92.  
  93.  
  94. sub addhbox {
  95.     my $this=shift;
  96.     my $hbox = Qt::HBoxLayout(undef, 0, 8, "SubHBox");
  97.     $this->cur->addlayout($hbox);
  98.     return $hbox;
  99. }
  100.  
  101.  
  102. sub addwidget {
  103.     my $this=shift;
  104.     my $widget=shift;
  105.     $this->cur->addwidget($widget);
  106. }
  107.  
  108.  
  109. sub description {
  110.     my $this=shift;
  111.     my $label=Qt::Label($this->cur->top);
  112.     $label->setText(to_Unicode($this->question->description));
  113.     $label->setSizePolicy(Qt::SizePolicy(1, 1, 0, 0, $label->sizePolicy()->hasHeightForWidth()));
  114.     $label->show;
  115.     return $label;
  116. }
  117.  
  118.  
  119. sub startsect {
  120.     my $this = shift;
  121.     my $ew = Debconf::Element::Kde::ElementWidget($this->top);
  122.     my $mytop = Qt::GroupBox($ew);
  123.     $ew->settop($mytop);
  124.     $ew->init;
  125.     $this->cur($ew);
  126.     $this->top->addwidget($ew);
  127.     $ew->show;
  128. }
  129.  
  130.  
  131. sub endsect {
  132.     my $this = shift;
  133.     $this->cur($this->top);
  134. }
  135.  
  136.  
  137. sub adddescription {
  138.     my $this=shift;
  139.     my $label=$this->description;
  140.     $this->addwidget($label);
  141. }
  142.  
  143.  
  144. sub addhelp {
  145.     my $this=shift;
  146.     
  147.     my $help=to_Unicode($this->question->extended_description);
  148.     return unless length $help;
  149.     my $label=Qt::Label($this->cur->top);
  150.     $label->setText($help);
  151.     $label->setTextFormat(&Qt::AutoText);
  152.     $label->setAlignment(&Qt::WordBreak | &Qt::AlignJustify);
  153.     $label->setSizePolicy(Qt::SizePolicy(&Qt::SizePolicy::Minimum,
  154.                                          &Qt::SizePolicy::Fixed,
  155.                                          0, 0, $label->sizePolicy()->hasHeightForWidth()));
  156.     $this->addwidget($label); # line1
  157.     $label->show;
  158. }
  159.  
  160.  
  161. sub value {
  162.     my $this=shift;
  163.     return '';
  164. }
  165.  
  166.  
  167. 1
  168.