ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.46 by root, Sun Apr 9 22:21:02 2006 UTC vs.
Revision 1.56 by root, Mon Apr 10 22:16:34 2006 UTC

7use SDL::OpenGL; 7use SDL::OpenGL;
8use SDL::OpenGL::Constants; 8use SDL::OpenGL::Constants;
9 9
10use Crossfire::Client; 10use Crossfire::Client;
11 11
12our $FOCUS; # the widget with current focus 12our ($FOCUS, $HOVER, $GRAB); # various widgets
13
14our $TOPLEVEL;
15our $BUTTON_STATE;
13 16
14# class methods for events 17# class methods for events
15sub feed_sdl_key_down_event { $FOCUS->key_down ($_[0]) if $FOCUS } 18sub feed_sdl_key_down_event {
16sub feed_sdl_key_up_event { $FOCUS->key_up ($_[0]) if $FOCUS } 19 $FOCUS->key_down ($_[0]) if $FOCUS;
20}
21
22sub feed_sdl_key_up_event {
23 $FOCUS->key_up ($_[0]) if $FOCUS;
24}
25
17sub feed_sdl_button_down_event { } 26sub feed_sdl_button_down_event {
27 my ($ev) = @_;
28 my ($x, $y) = ($ev->motion_x, $ev->motion_y);
29
30 if (!$BUTTON_STATE) {
31 my $widget = $TOPLEVEL->find_widget ($x, $y);
32
33 $GRAB = $widget;
34 $GRAB->update if $GRAB;
35 }
36
37 $BUTTON_STATE |= 1 << ($ev->button - 1);
38
39 $GRAB->button_down ($ev) if $GRAB;
40}
41
18sub feed_sdl_button_up_event { } 42sub feed_sdl_button_up_event {
43 my ($ev) = @_;
44 my ($x, $y) = ($ev->motion_x, $ev->motion_y);
45
46 my $widget = $GRAB || $TOPLEVEL->find_widget ($x, $y);
47
48 $BUTTON_STATE &= ~(1 << ($ev->button - 1));
49
50 if (!$BUTTON_STATE) {
51 my $grab = $GRAB; undef $GRAB;
52 $grab->update if $grab;
53 $GRAB->update if $GRAB;
54 }
55}
56
57sub feed_sdl_motion_event {
58 my ($ev) = @_;
59 my ($x, $y) = ($ev->motion_x, $ev->motion_y);
60
61 my $widget = $GRAB || $TOPLEVEL->find_widget ($x, $y);
62
63 if ($widget != $HOVER) {
64 my $hover = $HOVER; $HOVER = $widget;
65
66 $hover->update if $hover;
67 $HOVER->update if $HOVER;
68 }
69
70 $HOVER->mouse_motion ($ev) if $HOVER;
71}
19 72
20sub new { 73sub new {
21 my $class = shift; 74 my $class = shift;
22 75
23 bless { @_ }, $class 76 bless { @_ }, $class
45 $self->{w} = $w; 98 $self->{w} = $w;
46 $self->{h} = $h; 99 $self->{h} = $h;
47} 100}
48 101
49sub focus_in { 102sub focus_in {
50 my ($widget) = @_; 103 my ($self) = @_;
51 $FOCUS = $widget; 104
105 my $focus = $FOCUS; $FOCUS = $self;
106 $focus->update if $focus;
107 $FOCUS->update;
52} 108}
53 109
54sub focus_out { 110sub focus_out {
55 my ($widget) = @_; 111 my ($self) = @_;
56}
57 112
58sub key_down { 113 return unless $FOCUS == $self;
59 my ($widget, $sdlev) = @_;
60}
61 114
62sub key_up { 115 my $focus = $FOCUS; undef $FOCUS;
63 my ($widget, $sdlev) = @_; 116 $focus->update if $focus; #?
64} 117}
65 118
119sub mouse_motion { }
120sub button_up { }
66sub button_down { 121sub button_down { }
67 my ($widget, $sdlev) = @_; 122sub key_down { }
68} 123sub key_up { }
69 124
70sub button_up {
71 my ($widget, $sdlev) = @_;
72}
73
74sub w { $_[0]->{w} = $_[1] if $_[1]; $_[0]->{w} } 125sub w { $_[0]{w} = $_[1] if @_ > 1; $_[0]{w} }
75sub h { $_[0]->{h} = $_[1] if $_[1]; $_[0]->{h} } 126sub h { $_[0]{h} = $_[1] if @_ > 1; $_[0]{h} }
76sub x { $_[0]->{x} = $_[1] if $_[1]; $_[0]->{x} } 127sub x { $_[0]{x} = $_[1] if @_ > 1; $_[0]{x} }
77sub y { $_[0]->{y} = $_[1] if $_[1]; $_[0]->{y} } 128sub y { $_[0]{y} = $_[1] if @_ > 1; $_[0]{y} }
78sub z { $_[0]->{z} = $_[1] if $_[1]; $_[0]->{z} } 129sub z { $_[0]{z} = $_[1] if @_ > 1; $_[0]{z} }
79 130
80sub draw { 131sub draw {
81 my ($self) = @_; 132 my ($self) = @_;
82 133
83 glPushMatrix; 134 glPushMatrix;
84 glTranslate $self->{x}, $self->{y}, 0; 135 glTranslate $self->{x}, $self->{y}, 0;
85 $self->_draw; 136 $self->_draw;
137 if ($self == $HOVER) {
138 glColor 1, 1, 1, 0.4;
139 glEnable GL_BLEND;
140 glBegin GL_QUADS;
141 glVertex 0 , 0;
142 glVertex $self->{w}, 0;
143 glVertex $self->{w}, $self->{h};
144 glVertex 0 , $self->{h};
145 glEnd;
146 glDisable GL_BLEND;
147 }
86 glPopMatrix; 148 glPopMatrix;
87} 149}
88 150
89sub _draw { 151sub _draw {
90 my ($self) = @_; 152 my ($self) = @_;
218 if $self->{children}[0] 280 if $self->{children}[0]
219} 281}
220 282
221############################################################################# 283#############################################################################
222 284
223package Crossfire::Client::Widget::Toplevel;
224
225our @ISA = Crossfire::Client::Widget::Container::;
226
227sub update {
228 my ($self) = @_;
229
230 ::refresh ();
231}
232
233sub add {
234 my ($self, $widget) = @_;
235
236 $self->SUPER::add ($widget);
237
238 $widget->size_allocate ($widget->size_request);
239}
240
241#############################################################################
242
243package Crossfire::Client::Widget::Window; 285package Crossfire::Client::Widget::Window;
244 286
245our @ISA = Crossfire::Client::Widget::Bin::; 287our @ISA = Crossfire::Client::Widget::Bin::;
246 288
247use SDL::OpenGL; 289use SDL::OpenGL;
290 or return; 332 or return;
291 333
292 glEnable GL_BLEND; 334 glEnable GL_BLEND;
293 glEnable GL_TEXTURE_2D; 335 glEnable GL_TEXTURE_2D;
294 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 336 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
295 glBindTexture GL_TEXTURE_2D, $tex->{name};
296 337
297 glBegin GL_QUADS; 338 $tex->draw_quad (0, 0, $w, $h);
298 glTexCoord 0, 0; glVertex 0, 0;
299 glTexCoord 0, 1; glVertex 0, $h;
300 glTexCoord 1, 1; glVertex $w, $h;
301 glTexCoord 1, 0; glVertex $w, 0;
302 glEnd;
303 339
304 glDisable GL_BLEND; 340 glDisable GL_BLEND;
305 glDisable GL_TEXTURE_2D; 341 glDisable GL_TEXTURE_2D;
306} 342}
307 343
340 376
341 my ($w, $h) = $chld->size_request; 377 my ($w, $h) = $chld->size_request;
342 378
343 glBegin GL_QUADS; 379 glBegin GL_QUADS;
344 glColor 0, 0, 0; 380 glColor 0, 0, 0;
345 glTexCoord 0, 0; glVertex 0 , 0; 381 glVertex 0 , 0;
346 glTexCoord 0, 1; glVertex 0 , $h + 4; 382 glVertex 0 , $h + 4;
347 glTexCoord 1, 1; glVertex $w + 4 , $h + 4; 383 glVertex $w + 4 , $h + 4;
348 glTexCoord 1, 0; glVertex $w + 4 , 0; 384 glVertex $w + 4 , 0;
349 glEnd; 385 glEnd;
350 386
351 $chld->draw; 387 $chld->draw;
352} 388}
353 389
403 glEnable GL_TEXTURE_2D; 439 glEnable GL_TEXTURE_2D;
404 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 440 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
405 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 441 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
406 442
407 my $top = $tex[1]; 443 my $top = $tex[1];
408 glBindTexture GL_TEXTURE_2D, $top->{name}; 444 $top->draw_quad (0, 0, $w, $top->{height});
409
410 glBegin GL_QUADS;
411 glTexCoord 0, 0; glVertex 0 , 0;
412 glTexCoord 0, 1; glVertex 0 , $top->{height};
413 glTexCoord 1, 1; glVertex $w , $top->{height};
414 glTexCoord 1, 0; glVertex $w , 0;
415 glEnd;
416 445
417 my $left = $tex[3]; 446 my $left = $tex[3];
418 glBindTexture GL_TEXTURE_2D, $left->{name}; 447 $left->draw_quad (0, $top->{height}, $left->{width}, $ch);
419
420 glBegin GL_QUADS;
421 glTexCoord 0, 0; glVertex 0 , $top->{height};
422 glTexCoord 0, 1; glVertex 0 , $top->{height} + $ch;
423 glTexCoord 1, 1; glVertex $left->{width}, $top->{height} + $ch;
424 glTexCoord 1, 0; glVertex $left->{width}, $top->{height};
425 glEnd;
426 448
427 my $right = $tex[2]; 449 my $right = $tex[2];
428 glBindTexture GL_TEXTURE_2D, $right->{name}; 450 $right->draw_quad ($w - $right->{width}, $top->{height}, $right->{width}, $ch);
429
430 glBegin GL_QUADS;
431 glTexCoord 0, 0; glVertex $w - $right->{width}, $top->{height};
432 glTexCoord 0, 1; glVertex $w - $right->{width}, $top->{height} + $ch;
433 glTexCoord 1, 1; glVertex $w , $top->{height} + $ch;
434 glTexCoord 1, 0; glVertex $w , $top->{height};
435 glEnd;
436 451
437 my $bottom = $tex[4]; 452 my $bottom = $tex[4];
438 glBindTexture GL_TEXTURE_2D, $bottom->{name}; 453 $bottom->draw_quad (0, $h - $bottom->{height}, $w, $bottom->{height});
439
440 glBegin GL_QUADS;
441 glTexCoord 0, 0; glVertex 0 , $h - $bottom->{height};
442 glTexCoord 0, 1; glVertex 0 , $h;
443 glTexCoord 1, 1; glVertex $w , $h;
444 glTexCoord 1, 0; glVertex $w , $h - $bottom->{height};
445 glEnd;
446 454
447 my $bg = $tex[0]; 455 my $bg = $tex[0];
448 glBindTexture GL_TEXTURE_2D, $bg->{name}; 456 glBindTexture GL_TEXTURE_2D, $bg->{name};
449 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 457 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
450 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT; 458 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT;
451 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT; 459 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT;
452 460
453 my $rep_x = $cw / $bg->{width}; 461 my $rep_x = $cw / $bg->{width};
454 my $rep_y = $ch / $bg->{height}; 462 my $rep_y = $ch / $bg->{height};
455 463
456 glBegin GL_QUADS; 464 $bg->draw_quad ($left->{width}, $top->{height}, $cw, $ch);
457 glTexCoord 0, 0; glVertex $left->{width}, $top->{height};
458 glTexCoord 0, $rep_y; glVertex $left->{width}, $top->{height} + $ch;
459 glTexCoord $rep_x, $rep_y; glVertex $left->{width} + $cw , $top->{height} + $ch;
460 glTexCoord $rep_x, 0; glVertex $left->{width} + $cw , $top->{height};
461 glEnd;
462 465
463 glDisable GL_BLEND; 466 glDisable GL_BLEND;
464 glDisable GL_TEXTURE_2D; 467 glDisable GL_TEXTURE_2D;
465 468
466 $self->child->draw; 469 $self->child->draw;
623use SDL::OpenGL; 626use SDL::OpenGL;
624 627
625sub new { 628sub new {
626 my ($class, $x, $y, $z, $height, $text) = @_; 629 my ($class, $x, $y, $z, $height, $text) = @_;
627 630
631 $height ||= $::FONTSIZE;
632
628 # TODO: color, and make height, xyz etc. optional 633 # TODO: color, and make height, xyz etc. optional
629 my $self = $class->SUPER::new (x => $x, y => $y, z => $z, height => $height); 634 my $self = $class->SUPER::new (x => $x, y => $y, z => $z, height => $height);
630 635
631 $self->set_text ($text); 636 $self->set_text ($text);
632 637
649} 654}
650 655
651sub size_request { 656sub size_request {
652 my ($self) = @_; 657 my ($self) = @_;
653 658
654 ( 659 if ($self->{texture}{width} > 1 && $self->{texture}{height} > 1) { #TODO: hack
660 (
655 $self->{texture}{width}, 661 $self->{texture}{width},
656 $self->{texture}{height}, 662 $self->{texture}{height},
663 )
664 } else {
665 my ($w, $h, $data) = Crossfire::Client::font_render "Yy", $self->{height};
666
667 ($w, $h)
657 ) 668 }
669
658} 670}
659 671
660sub _draw { 672sub _draw {
661 my ($self) = @_; 673 my ($self) = @_;
662 674
664 676
665 glEnable GL_BLEND; 677 glEnable GL_BLEND;
666 glEnable GL_TEXTURE_2D; 678 glEnable GL_TEXTURE_2D;
667 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 679 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
668 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 680 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
669 glBindTexture GL_TEXTURE_2D, $tex->{name};
670 681
671 glColor 1, 0, 0, 1; # TODO color 682 glColor 1, 0, 0, 1; # TODO color
672 683
673 glBegin GL_QUADS; 684 $tex->draw_quad (0, 0);
674 glTexCoord 0, 0; glVertex 0 , 0;
675 glTexCoord 0, 1; glVertex 0 , $tex->{height};
676 glTexCoord 1, 1; glVertex $tex->{width}, $tex->{height};
677 glTexCoord 1, 0; glVertex $tex->{width}, 0;
678 glEnd;
679 685
680 glDisable GL_BLEND; 686 glDisable GL_BLEND;
681 glDisable GL_TEXTURE_2D; 687 glDisable GL_TEXTURE_2D;
682} 688}
683 689
684############################################################################# 690#############################################################################
685 691
686package Crossfire::Client::Widget::TextEntry; 692package Crossfire::Client::Widget::Entry;
687 693
688our @ISA = Crossfire::Client::Widget::Label::; 694our @ISA = Crossfire::Client::Widget::Label::;
689 695
690use SDL; 696use SDL;
691use SDL::OpenGL; 697use SDL::OpenGL;
694 my ($self, $ev) = @_; 700 my ($self, $ev) = @_;
695 701
696 my $mod = $ev->key_mod; 702 my $mod = $ev->key_mod;
697 my $sym = $ev->key_sym; 703 my $sym = $ev->key_sym;
698 704
699 $ev->set_unicode (1);
700 my $uni = $ev->key_unicode; 705 my $uni = $ev->key_unicode;
701 706
702 my $text = $self->get_text; 707 my $text = $self->get_text;
703 708
704 if ($sym == SDLK_BACKSPACE) { 709 if ($sym == SDLK_BACKSPACE) {
705 substr $text, -1, 1, ''; 710 substr $text, -1, 1, '';
706
707 } elsif ($uni) { 711 } elsif ($uni) {
708 $text .= chr $uni; 712 $text .= chr $uni;
713 print "$uni <$text>\n";#d#
709 } 714 }
715
710 $self->set_text ($text); 716 $self->set_text ($text);
717}
718
719sub button_down {
720 my ($self, $ev) = @_;
721
722 $self->focus_in;
723}
724
725sub _draw {
726 my ($self) = @_;
727
728 if ($FOCUS == $self) {
729 glColor 1, 1, 1;
730 } else {
731 glColor 0.7, 0.7, 0.7;
732 }
733
734 glBegin GL_QUADS;
735 glVertex 0 , 0;
736 glVertex 0 , $self->{h} - 1;
737 glVertex $self->{w} - 1, $self->{h} - 1;
738 glVertex $self->{w} - 1, 0;
739 glEnd;
740
741 $self->SUPER::_draw;
711} 742}
712 743
713############################################################################# 744#############################################################################
714 745
715package Crossfire::Client::Widget::MapWidget; 746package Crossfire::Client::Widget::MapWidget;
730 761
731sub key_up { 762sub key_up {
732} 763}
733 764
734sub size_request { 765sub size_request {
735 766 (
736} 767 1 + int $::WIDTH / 32,
737 768 1 + int $::HEIGHT / 32,
738sub size_allocate { 769 )
739} 770}
740 771
741sub _draw { 772sub _draw {
742 my ($self) = @_; 773 my ($self) = @_;
743 774
776 my $cell = $map->[$x + $xofs][$y + $yofs] 807 my $cell = $map->[$x + $xofs][$y + $yofs]
777 or next; 808 or next;
778 809
779 my $darkness = $cell->[0] * (1 / 255); 810 my $darkness = $cell->[0] * (1 / 255);
780 if ($darkness < 0) { 811 if ($darkness < 0) {
781 $darkness = 0.15; 812 $darkness = $cell->[1] ? 0.1 : 0;
782 } 813 }
783 substr $lighting, $y * $sw4 + $x, 1, chr 255 - $darkness * 255; 814 substr $lighting, $y * $sw4 + $x, 1, chr 255 - $darkness * 255;
784 815
785 for my $num (grep $_, @$cell[1,2,3]) { 816 for my $num (grep $_, @$cell[1,2,3]) {
786 my $tex = $::CONN->{face}[$num]{texture} || next; 817 my $tex = $::CONN->{face}[$num]{texture} || next;
787 818
788 glBindTexture GL_TEXTURE_2D, $tex->{name};
789
790 my $w = $tex->{width}; 819 my $w = $tex->{width};
791 my $h = $tex->{height}; 820 my $h = $tex->{height};
792 821
793 my $px = ($x + 1) * 32 - $w; 822 my $px = ($x + 1) * 32 - $w;
794 my $py = ($y + 1) * 32 - $h; 823 my $py = ($y + 1) * 32 - $h;
795 824
796 glBegin GL_QUADS; 825 $tex->draw_quad ($px, $py, $w, $h);
797 glTexCoord 0, 0; glVertex $px , $py;
798 glTexCoord 0, 1; glVertex $px , $py + $h;
799 glTexCoord 1, 1; glVertex $px + $w, $py + $h;
800 glTexCoord 1, 0; glVertex $px + $w, $py;
801 glEnd;
802 } 826 }
803 } 827 }
804 } 828 }
805 829
806# if (1) { # higher quality darkness 830# if (1) { # higher quality darkness
815 839
816 $lighting = new Crossfire::Client::Texture 840 $lighting = new Crossfire::Client::Texture
817 width => $sw4, 841 width => $sw4,
818 height => $sh, 842 height => $sh,
819 data => $lighting, 843 data => $lighting,
820 internalformat => GL_ALPHA4, 844 internalformat => GL_ALPHA,
821 format => GL_ALPHA; 845 format => GL_ALPHA;
822 846
823 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 847 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
824 glColor 0, 0, 0, 0.75; 848 glColor 0.45, 0.45, 0.45, 1;
825 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 849 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
826 glBindTexture GL_TEXTURE_2D, $lighting->{name}; 850 glBindTexture GL_TEXTURE_2D, $lighting->{name};
827 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR; 851 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR;
828 glBegin GL_QUADS; 852
829 glTexCoord 0, 0; glVertex 0 , 0; 853 $lighting->draw_quad (0, 0, $sw4 * 32, $sh * 32);
830 glTexCoord 0, 1; glVertex 0 , $sh * 32;
831 glTexCoord 1, 1; glVertex $sw4 * 32, $sh * 32;
832 glTexCoord 1, 0; glVertex $sw4 * 32, 0;
833 glEnd;
834 854
835 glDisable GL_TEXTURE_2D; 855 glDisable GL_TEXTURE_2D;
836 glDisable GL_BLEND; 856 glDisable GL_BLEND;
837} 857}
838 858
897 917
898sub moveto { 918sub moveto {
899 my ($self, $x, $y) = @_; 919 my ($self, $x, $y) = @_;
900 920
901 $self->{moveto} = [$self->{x}, $self->{y}, $x, $y]; 921 $self->{moveto} = [$self->{x}, $self->{y}, $x, $y];
902 $self->{speed} = 0.2; 922 $self->{speed} = 0.001;
903 $self->{time} = 1; 923 $self->{time} = 1;
904 924
905 ::animation_start $self; 925 ::animation_start $self;
906} 926}
907 927
908sub animate { 928sub animate {
909 my ($self, $interval) = @_; 929 my ($self, $interval) = @_;
930
931 printf "%5.2f\n", 1 / $interval;#d#
910 932
911 $self->{time} -= $interval * $self->{speed}; 933 $self->{time} -= $interval * $self->{speed};
912 if ($self->{time} <= 0) { 934 if ($self->{time} <= 0) {
913 $self->{time} = 0; 935 $self->{time} = 0;
914 ::animation_stop $self; 936 ::animation_stop $self;
922 944
923sub _draw { 945sub _draw {
924 my ($self) = @_; 946 my ($self) = @_;
925 947
926 glPushMatrix; 948 glPushMatrix;
927 glRotate $self->{time} * 10000, 0, 1, 0; 949 glRotate $self->{time} * 1000, 0, 1, 0;
928 $self->{children}[0]->draw; 950 $self->{children}[0]->draw;
929 glPopMatrix; 951 glPopMatrix;
930} 952}
931 953
9321; 954#############################################################################
933 955
956package Crossfire::Client::Widget::Toplevel;
957
958our @ISA = Crossfire::Client::Widget::Container::;
959
960sub size_request {
961 ($::WIDTH, $::HEIGHT)
962}
963
964sub size_allocate {
965 my ($self, $w, $h) = @_;
966
967 $self->SUPER::size_allocate ($w, $h);
968
969 $_->size_allocate ($_->size_request)
970 for @{$self->{children}};
971}
972
973sub update {
974 my ($self) = @_;
975
976 $self->size_allocate ($self->size_request);
977 ::refresh ();
978}
979
980sub add {
981 my ($self, $widget) = @_;
982
983 $self->SUPER::add ($widget);
984
985 $widget->size_allocate ($widget->size_request);
986}
987
988sub draw {
989 my ($self) = @_;
990
991 $self->_draw;
992}
993
994#############################################################################
995
996package Crossfire::Client::Widget;
997
998$TOPLEVEL = new Crossfire::Client::Widget::Toplevel;
999
10001
1001

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines