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.57 by root, Mon Apr 10 22:53:49 2006 UTC vs.
Revision 1.74 by root, Tue Apr 11 19:31:18 2006 UTC

1package Crossfire::Client::Widget; 1package CFClient::UI;
2 2
3use strict; 3use strict;
4 4
5use Scalar::Util; 5use Scalar::Util ();
6use List::Util ();
6 7
7use SDL::OpenGL; 8use CFClient;
8use SDL::OpenGL::Constants;
9
10use Crossfire::Client;
11 9
12our ($FOCUS, $HOVER, $GRAB); # various widgets 10our ($FOCUS, $HOVER, $GRAB); # various widgets
13 11
14our $TOPLEVEL; 12our $TOPLEVEL;
15our $BUTTON_STATE; 13our $BUTTON_STATE;
34 $GRAB->update if $GRAB; 32 $GRAB->update if $GRAB;
35 } 33 }
36 34
37 $BUTTON_STATE |= 1 << ($ev->button - 1); 35 $BUTTON_STATE |= 1 << ($ev->button - 1);
38 36
39 $GRAB->button_down ($ev) if $GRAB; 37 $GRAB->button_down ($ev, $GRAB->translate ($x, $y)) if $GRAB;
40} 38}
41 39
42sub feed_sdl_button_up_event { 40sub feed_sdl_button_up_event {
43 my ($ev) = @_; 41 my ($ev) = @_;
44 my ($x, $y) = ($ev->motion_x, $ev->motion_y); 42 my ($x, $y) = ($ev->motion_x, $ev->motion_y);
45 43
46 my $widget = $GRAB || $TOPLEVEL->find_widget ($x, $y); 44 my $widget = $GRAB || $TOPLEVEL->find_widget ($x, $y);
47 45
48 $BUTTON_STATE &= ~(1 << ($ev->button - 1)); 46 $BUTTON_STATE &= ~(1 << ($ev->button - 1));
47
48 $GRAB->button_down ($ev, $GRAB->translate ($x, $y)) if $GRAB;
49 49
50 if (!$BUTTON_STATE) { 50 if (!$BUTTON_STATE) {
51 my $grab = $GRAB; undef $GRAB; 51 my $grab = $GRAB; undef $GRAB;
52 $grab->update if $grab; 52 $grab->update if $grab;
53 $GRAB->update if $GRAB; 53 $GRAB->update if $GRAB;
65 65
66 $hover->update if $hover; 66 $hover->update if $hover;
67 $HOVER->update if $HOVER; 67 $HOVER->update if $HOVER;
68 } 68 }
69 69
70 $HOVER->mouse_motion ($ev) if $HOVER; 70 $HOVER->mouse_motion ($ev, $HOVER->translate ($x, $y)) if $HOVER;
71} 71}
72
73#############################################################################
74
75package CFClient::UI::Base;
76
77use strict;
78
79use SDL::OpenGL;
72 80
73sub new { 81sub new {
74 my $class = shift; 82 my $class = shift;
75 83
76 bless { @_ }, $class 84 bless {
85 x => 0,
86 y => 0,
87 z => 0,
88 @_
89 }, $class
77} 90}
78 91
79sub move { 92sub move {
80 my ($self, $x, $y, $z) = @_; 93 my ($self, $x, $y, $z) = @_;
81 $self->{x} = $x; 94 $self->{x} = $x;
97 110
98 $self->{w} = $w; 111 $self->{w} = $w;
99 $self->{h} = $h; 112 $self->{h} = $h;
100} 113}
101 114
115# translate global koordinates to local coordinate system
116sub translate {
117 my ($self, $x, $y) = @_;
118
119 $self->{parent}->translate ($x - $self->{x}, $y - $self->{y});
120}
121
102sub focus_in { 122sub focus_in {
103 my ($self) = @_; 123 my ($self) = @_;
124
125 return if $FOCUS == $self;
104 126
105 my $focus = $FOCUS; $FOCUS = $self; 127 my $focus = $FOCUS; $FOCUS = $self;
106 $focus->update if $focus; 128 $focus->update if $focus;
107 $FOCUS->update; 129 $FOCUS->update;
108} 130}
116 $focus->update if $focus; #? 138 $focus->update if $focus; #?
117} 139}
118 140
119sub mouse_motion { } 141sub mouse_motion { }
120sub button_up { } 142sub button_up { }
121sub button_down { }
122sub key_down { } 143sub key_down { }
123sub key_up { } 144sub key_up { }
145
146sub button_down {
147 my ($self, $ev, $x, $y) = @_;
148
149 $self->focus_in;
150}
124 151
125sub w { $_[0]{w} = $_[1] if @_ > 1; $_[0]{w} } 152sub w { $_[0]{w} = $_[1] if @_ > 1; $_[0]{w} }
126sub h { $_[0]{h} = $_[1] if @_ > 1; $_[0]{h} } 153sub h { $_[0]{h} = $_[1] if @_ > 1; $_[0]{h} }
127sub x { $_[0]{x} = $_[1] if @_ > 1; $_[0]{x} } 154sub x { $_[0]{x} = $_[1] if @_ > 1; $_[0]{x} }
128sub y { $_[0]{y} = $_[1] if @_ > 1; $_[0]{y} } 155sub y { $_[0]{y} = $_[1] if @_ > 1; $_[0]{y} }
129sub z { $_[0]{z} = $_[1] if @_ > 1; $_[0]{z} } 156sub z { $_[0]{z} = $_[1] if @_ > 1; $_[0]{z} }
130 157
131sub draw { 158sub draw {
132 my ($self) = @_; 159 my ($self) = @_;
133 160
161 return unless $self->{h} && $self->{w};
162
134 glPushMatrix; 163 glPushMatrix;
135 glTranslate $self->{x}, $self->{y}, 0; 164 glTranslate $self->{x}, $self->{y}, 0;
136 $self->_draw; 165 $self->_draw;
166 glPopMatrix;
167
137 if ($self == $HOVER) { 168 if ($self == $HOVER) {
169 my ($x, $y) = @$self{qw(x y)};
170
138 glColor 1, 1, 1, 0.4; 171 glColor 1, 1, 1, 0.1;
139 glEnable GL_BLEND; 172 glEnable GL_BLEND;
173 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
140 glBegin GL_QUADS; 174 glBegin GL_QUADS;
141 glVertex 0 , 0; 175 glVertex $x , $y;
142 glVertex $self->{w}, 0; 176 glVertex $x + $self->{w}, $y;
143 glVertex $self->{w}, $self->{h}; 177 glVertex $x + $self->{w}, $y + $self->{h};
144 glVertex 0 , $self->{h}; 178 glVertex $x , $y + $self->{h};
145 glEnd; 179 glEnd;
146 glDisable GL_BLEND; 180 glDisable GL_BLEND;
147 } 181 }
148 glPopMatrix;
149} 182}
150 183
151sub _draw { 184sub _draw {
152 my ($self) = @_; 185 my ($self) = @_;
153 186
193 226
194 $self->{parent}->update 227 $self->{parent}->update
195 if $self->{parent}; 228 if $self->{parent};
196} 229}
197 230
231sub connect {
232 my ($self, $signal, $cb) = @_;
233
234 push @{ $self->{cb}{$signal} }, $cb;
235}
236
237sub emit {
238 my ($self, $signal, @args) = @_;
239
240 $_->($self, @args)
241 for @{$self->{cb}{$signal} || []};
242}
243
198sub DESTROY { 244sub DESTROY {
199 my ($self) = @_; 245 my ($self) = @_;
200 246
201 #$self->deactivate; 247 #$self->deactivate;
202} 248}
203 249
204############################################################################# 250#############################################################################
205 251
206package Crossfire::Client::Widget::Container; 252package CFClient::UI::DrawBG;
207 253
208our @ISA = Crossfire::Client::Widget::; 254our @ISA = CFClient::UI::Base::;
255
256use strict;
257use SDL::OpenGL;
209 258
210sub new { 259sub new {
260 my $class = shift;
261
262 # range [value, low, high, page]
263
264 $class->SUPER::new (
265 bg => [0, 0, 0, 0.4],
266 active_bg => [1, 1, 1],
267 @_
268 )
269}
270
271sub _draw {
272 my ($self) = @_;
273
274 my ($w, $h) = @$self{qw(w h)};
275
276 glColor @{ $FOCUS == $self ? $self->{active_bg} : $self->{bg} };
277 glBegin GL_QUADS;
278 glVertex 0 , 0;
279 glVertex 0 , $h;
280 glVertex $w, $h;
281 glVertex $w, 0;
282 glEnd;
283}
284
285#############################################################################
286
287package CFClient::UI::Empty;
288
289our @ISA = CFClient::UI::Base::;
290
291sub size_request {
292 (0, 0)
293}
294
295sub draw { }
296
297#############################################################################
298
299package CFClient::UI::Container;
300
301our @ISA = CFClient::UI::Base::;
302
303sub new {
211 my ($class, @widgets) = @_; 304 my ($class, %arg) = @_;
212 305
306 my $children = delete $arg{children} || [];
307
213 my $self = $class->SUPER::new (children => []); 308 my $self = $class->SUPER::new (children => [], %arg);
214 $self->add ($_) for @widgets; 309 $self->add ($_) for @$children;
215 310
216 $self 311 $self
217} 312}
218 313
219sub add { 314sub add {
220 my ($self, $chld, $expand) = @_; 315 my ($self, $chld, $expand) = @_;
221 316
222 $chld->{expand} = $expand; 317 $chld->{expand} = $expand;
223 $chld->set_parent ($self); 318 $chld->set_parent ($self);
224 319
225 @{$self->{children}} = 320 $self->{children} = [
226 sort { $a->{z} <=> $b->{z} } 321 sort { $a->{z} <=> $b->{z} }
227 @{$self->{children}}, $chld; 322 @{$self->{children}}, $chld
323 ];
228 324
229 $self->size_allocate ($self->{w}, $self->{h}) 325 $self->size_allocate ($self->{w}, $self->{h})
230 if $self->{w}; #TODO: check for "realised state" 326 if $self->{w}; #TODO: check for "realised state"
231} 327}
232 328
260 $_->draw for @{$self->{children}}; 356 $_->draw for @{$self->{children}};
261} 357}
262 358
263############################################################################# 359#############################################################################
264 360
265package Crossfire::Client::Widget::Bin; 361package CFClient::UI::Bin;
266 362
267our @ISA = Crossfire::Client::Widget::Container::; 363our @ISA = CFClient::UI::Container::;
364
365sub new {
366 my ($class, %arg) = @_;
367
368 my $child = (delete $arg{child}) || new CFClient::UI::Empty::;
369
370 $class->SUPER::new (children => [$child], %arg)
371}
372
373sub add {
374 my ($self, $widget) = @_;
375
376 $self->{children} = [];
377
378 $self->SUPER::add ($widget);
379}
380
381sub remove {
382 my ($self, $widget) = @_;
383
384 $self->SUPER::remove ($widget);
385
386 $self->{children} = [new CFClient::UI::Empty]
387 unless @{$self->{children}};
388}
268 389
269sub child { $_[0]->{children}[0] } 390sub child { $_[0]->{children}[0] }
270 391
271sub size_request { 392sub size_request {
272 $_[0]{children}[0]->size_request if $_[0]{children}[0]; 393 $_[0]{children}[0]->size_request
273} 394}
274 395
275sub size_allocate { 396sub size_allocate {
276 my ($self, $w, $h) = @_; 397 my ($self, $w, $h) = @_;
277 398
399 return unless $self->{w} != $w || $self->{h} != $h;
400
278 $self->SUPER::size_allocate ($w, $h); 401 $self->SUPER::size_allocate ($w, $h);
279 $self->{children}[0]->size_allocate ($w, $h) 402 $self->{children}[0]->size_allocate ($w, $h);
280 if $self->{children}[0]
281} 403}
282 404
283############################################################################# 405#############################################################################
284 406
285package Crossfire::Client::Widget::Window; 407package CFClient::UI::Window;
286 408
287our @ISA = Crossfire::Client::Widget::Bin::; 409our @ISA = CFClient::UI::Bin::;
288 410
289use SDL::OpenGL; 411use SDL::OpenGL;
290 412
291sub new { 413sub new {
292 my ($class, $x, $y, $z, $w, $h) = @_; 414 my ($class, %arg) = @_;
293 415
294 my $self = $class->SUPER::new; 416 my $self = $class->SUPER::new (%arg);
295
296 @$self{qw(x y z w h)} = ($x, $y, $z, $w, $h);
297} 417}
298 418
299sub update { 419sub update {
300 my ($self) = @_; 420 my ($self) = @_;
301 421
422 # we want to do this delayed...
302 $self->render_chld; 423 $self->render_chld;
303 $self->SUPER::update; 424 $self->SUPER::update;
304} 425}
305 426
306sub render_chld { 427sub render_chld {
307 my ($self) = @_; 428 my ($self) = @_;
308 429
309 $self->{texture} = 430 $self->{texture} =
310 Crossfire::Client::Texture->new_from_opengl ( 431 CFClient::Texture->new_from_opengl (
311 $self->{w}, $self->{h}, sub { $self->child->draw } 432 $self->{w}, $self->{h}, sub { $self->child->draw }
312 ); 433 );
313} 434}
314 435
315sub size_allocate { 436sub size_allocate {
316 my ($self, $w, $h) = @_; 437 my ($self, $w, $h) = @_;
317 438
439 return unless $self->{w} != $w || $self->{h} != $h;
440
318 $self->{w} = $w; 441 $self->{w} = $w;
319 $self->{h} = $h; 442 $self->{h} = $h;
320 443
321 $self->child->size_allocate ($w, $h); 444 $self->child->size_allocate ($w, $h);
322 445
330 453
331 my $tex = $self->{texture} 454 my $tex = $self->{texture}
332 or return; 455 or return;
333 456
334 glEnable GL_BLEND; 457 glEnable GL_BLEND;
458 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
335 glEnable GL_TEXTURE_2D; 459 glEnable GL_TEXTURE_2D;
336 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 460 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
337 461
338 $tex->draw_quad (0, 0, $w, $h); 462 $tex->draw_quad (0, 0, $w, $h);
339 463
341 glDisable GL_TEXTURE_2D; 465 glDisable GL_TEXTURE_2D;
342} 466}
343 467
344############################################################################# 468#############################################################################
345 469
346package Crossfire::Client::Widget::Frame; 470package CFClient::UI::Frame;
347 471
348our @ISA = Crossfire::Client::Widget::Bin::; 472our @ISA = CFClient::UI::Bin::;
349 473
350use SDL::OpenGL; 474use SDL::OpenGL;
351 475
352sub size_request { 476sub size_request {
353 my ($self) = @_; 477 my ($self) = @_;
360} 484}
361 485
362sub size_allocate { 486sub size_allocate {
363 my ($self, $w, $h) = @_; 487 my ($self, $w, $h) = @_;
364 488
489 return unless $self->{w} != $w || $self->{h} != $h;
490
365 $self->{w} = $w; 491 $self->{w} = $w;
366 $self->{h} = $h; 492 $self->{h} = $h;
367 493
368 $self->child->size_allocate ($w - 4, $h - 4); 494 $self->child->size_allocate ($w - 4, $h - 4);
369 $self->child->move (2, 2); 495 $self->child->move (2, 2);
387 $chld->draw; 513 $chld->draw;
388} 514}
389 515
390############################################################################# 516#############################################################################
391 517
392package Crossfire::Client::Widget::FancyFrame; 518package CFClient::UI::FancyFrame;
393 519
394our @ISA = Crossfire::Client::Widget::Bin::; 520our @ISA = CFClient::UI::Bin::;
395 521
396use SDL::OpenGL; 522use SDL::OpenGL;
397 523
398my @tex = 524my @tex =
399 map { new_from_file Crossfire::Client::Texture Crossfire::Client::find_rcfile $_ } 525 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
400 qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); 526 qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png);
401 527
402sub size_request { 528sub size_request {
403 my ($self) = @_; 529 my ($self) = @_;
404 530
405 my ($w, $h) = $self->SUPER::size_request; 531 my ($w, $h) = $self->SUPER::size_request;
406 532
407 $h += $tex[1]->{height}; 533 $h += $tex[1]->{h};
408 $h += $tex[4]->{height}; 534 $h += $tex[4]->{h};
409 $w += $tex[2]->{width}; 535 $w += $tex[2]->{w};
410 $w += $tex[3]->{width}; 536 $w += $tex[3]->{w};
411 537
412 ($w, $h) 538 ($w, $h)
413} 539}
414 540
415sub size_allocate { 541sub size_allocate {
416 my ($self, $w, $h) = @_; 542 my ($self, $w, $h) = @_;
417 543
544 return unless $self->{w} != $w || $self->{h} != $h;
545
418 $self->SUPER::size_allocate ($w, $h); 546 $self->SUPER::size_allocate ($w, $h);
419 547
420 $h -= $tex[1]->{height}; 548 $h -= $tex[1]->{h};
421 $h -= $tex[4]->{height}; 549 $h -= $tex[4]->{h};
422 $w -= $tex[2]->{width}; 550 $w -= $tex[2]->{w};
423 $w -= $tex[3]->{width}; 551 $w -= $tex[3]->{w};
424 552
425 $h = $h < 0 ? 0 : $h; 553 $h = $h < 0 ? 0 : $h;
426 $w = $w < 0 ? 0 : $w; 554 $w = $w < 0 ? 0 : $w;
427 555
556 my $child = $self->child;
557
428 $self->child->size_allocate ($w, $h); 558 $child->size_allocate ($w, $h);
429 $self->child->move ($tex[3]->{width}, $tex[1]->{height}); 559 $child->move ($tex[3]->{w}, $tex[1]->{h});
430} 560}
431 561
432sub _draw { 562sub _draw {
433 my ($self) = @_; 563 my ($self) = @_;
434 564
435 my ($w, $h) = ($self->{w}, $self->{h}); 565 my ($w, $h) = ($self->{w}, $self->{h});
436 my ($cw, $ch) = ($self->child->{w}, $self->child->{h}); 566 my ($cw, $ch) = ($self->child->{w}, $self->child->{h});
437 567
438 glEnable GL_BLEND; 568 glEnable GL_BLEND;
569 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
439 glEnable GL_TEXTURE_2D; 570 glEnable GL_TEXTURE_2D;
440 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
441 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 571 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
442 572
443 my $top = $tex[1]; 573 my $top = $tex[1];
444 $top->draw_quad (0, 0, $w, $top->{height}); 574 $top->draw_quad (0, 0, $w, $top->{h});
445 575
446 my $left = $tex[3]; 576 my $left = $tex[3];
447 $left->draw_quad (0, $top->{height}, $left->{width}, $ch); 577 $left->draw_quad (0, $top->{h}, $left->{w}, $ch);
448 578
449 my $right = $tex[2]; 579 my $right = $tex[2];
450 $right->draw_quad ($w - $right->{width}, $top->{height}, $right->{width}, $ch); 580 $right->draw_quad ($w - $right->{w}, $top->{h}, $right->{w}, $ch);
451 581
452 my $bottom = $tex[4]; 582 my $bottom = $tex[4];
453 $bottom->draw_quad (0, $h - $bottom->{height}, $w, $bottom->{height}); 583 $bottom->draw_quad (0, $h - $bottom->{h}, $w, $bottom->{h});
454 584
455 my $bg = $tex[0]; 585 my $bg = $tex[0];
456 glBindTexture GL_TEXTURE_2D, $bg->{name}; 586 glBindTexture GL_TEXTURE_2D, $bg->{name};
457 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 587 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
458 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT; 588 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT;
459 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT; 589 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT;
460 590
461 my $rep_x = $cw / $bg->{width}; 591 my $rep_x = $cw / $bg->{w};
462 my $rep_y = $ch / $bg->{height}; 592 my $rep_y = $ch / $bg->{h};
463 593
464 $bg->draw_quad ($left->{width}, $top->{height}, $cw, $ch); 594 $bg->draw_quad ($left->{w}, $top->{h}, $cw, $ch);
465 595
466 glDisable GL_BLEND; 596 glDisable GL_BLEND;
467 glDisable GL_TEXTURE_2D; 597 glDisable GL_TEXTURE_2D;
468 598
469 $self->child->draw; 599 $self->child->draw;
470 600
471} 601}
472 602
473############################################################################# 603#############################################################################
474 604
475package Crossfire::Client::Widget::Table; 605package CFClient::UI::Table;
476 606
477our @ISA = Crossfire::Client::Widget::Bin::; 607our @ISA = CFClient::UI::Base::;
478 608
479use SDL::OpenGL; 609use SDL::OpenGL;
480 610
481sub add { 611sub add {
482 my ($self, $x, $y, $chld) = @_; 612 my ($self, $x, $y, $chld) = @_;
557 } 687 }
558} 688}
559 689
560############################################################################# 690#############################################################################
561 691
562package Crossfire::Client::Widget::VBox; 692package CFClient::UI::VBox;
563 693
564our @ISA = Crossfire::Client::Widget::Container::; 694our @ISA = CFClient::UI::Container::;
565 695
566use SDL::OpenGL; 696use SDL::OpenGL;
567 697
568sub size_request { 698sub size_request {
569 my ($self) = @_; 699 my ($self) = @_;
577} 707}
578 708
579sub size_allocate { 709sub size_allocate {
580 my ($self, $w, $h) = @_; 710 my ($self, $w, $h) = @_;
581 711
712 return unless $self->{w} != $w || $self->{h} != $h;
713
582 $self->w ($w); 714 $self->{w} = $w;
583 $self->h ($h); 715 $self->{h} = $h;
584 716
585 my $exp; 717 return unless $self->{h};
586 my @oth; 718
587 # find expand widget 719 my $children = $self->{children};
588 for (@{$self->{children}}) { 720
589 if ($_->{expand}) { 721 my @h = map +($_->size_request)[1], @$children;
590 $exp = $_; 722
591 last; 723 my $req_h = List::Util::sum @h;
724
725 if ($req_h > $h) {
726 # ah well, not enough space
727 $_ = $h[$_] * $h / $req_h for @h;
728 } else {
729 my @exp = grep $_->{expand}, @$children;
730 @exp = @$children unless @exp;
731
732 my %exp = map +($_ => 1), @exp;
733
734 for (0 .. $#$children) {
735 my $child = $children->[$_];
736
737 my $alloc_h = $h[$_];
738 $alloc_h += ($h - $req_h) / @exp if $exp{$child};
739 $h[$_] = $alloc_h;
592 } 740 }
593 push @oth, $_;
594 }
595
596 my ($ow, $oh);
597
598 # get sizes of other widgets
599 for (@oth) {
600 my ($w, $h) = $_->size_request;
601 $oh += $h;
602 if ($ow < $w) { $ow = $w }
603 } 741 }
604 742
605 my $y = 0; 743 my $y = 0;
606 for (@{$self->{children}}) { 744 for (0 .. $#$children) {
745 my $child = $children->[$_];
746 my $h = $h[$_];
607 $_->move (0, $y); 747 $child->move (0, $y);
608
609 if ($_ == $exp) {
610 $_->size_allocate ($w, $h - $oh);
611 $y += $h - $oh;
612 } else {
613 my ($cw, $h) = $_->size_request;
614 $_->size_allocate ($w, $h); 748 $child->size_allocate ($w, $h);
749
615 $y += $h; 750 $y += $h;
616 }
617 } 751 }
618} 752}
619 753
620############################################################################# 754#############################################################################
621 755
622package Crossfire::Client::Widget::Label; 756package CFClient::UI::Label;
623 757
624our @ISA = Crossfire::Client::Widget::; 758our @ISA = CFClient::UI::Base::;
625 759
626use SDL::OpenGL; 760use SDL::OpenGL;
627 761
628sub new { 762sub new {
629 my ($class, $x, $y, $z, $height, $text) = @_; 763 my ($class, %arg) = @_;
630 764
765 my $self = $class->SUPER::new (
766 fg => [1, 1, 1],
631 $height ||= $::FONTSIZE; 767 height => $::FONTSIZE,
768 text => "",
769 align => -1,
770 layout => new CFClient::Layout,
771 %arg
772 );
632 773
633 # TODO: color, and make height, xyz etc. optional
634 my $self = $class->SUPER::new (x => $x, y => $y, z => $z, height => $height);
635
636 $self->set_text ($text); 774 $self->set_text ($self->{text});
637 775
638 $self 776 $self
777}
778
779sub escape_text {
780 local $_ = $_[1];
781
782 s/&/&amp;/g;
783 s/>/&gt;/g;
784 s/</&lt;/g;
785
786 $_[1]
639} 787}
640 788
641sub set_text { 789sub set_text {
642 my ($self, $text) = @_; 790 my ($self, $text) = @_;
643 791
644 $self->{text} = $text; 792 $self->{text} = $text;
645 $self->{texture} = new_from_text Crossfire::Client::Texture $text, $self->{height}; 793 $self->{layout}->set_markup ($text);
646 794
795 delete $self->{texture};
647 $self->update; 796 $self->update;
648} 797}
649 798
650sub get_text { 799sub get_text {
651 my ($self, $text) = @_; 800 my ($self, $text) = @_;
654} 803}
655 804
656sub size_request { 805sub size_request {
657 my ($self) = @_; 806 my ($self) = @_;
658 807
808 $self->{layout}->set_width;
809 $self->{layout}->set_height ($self->{height});
810 $self->{layout}->size
659 if ($self->{texture}{width} > 1 && $self->{texture}{height} > 1) { #TODO: hack 811# if ($self->{texture}{w} > 1 && $self->{texture}{height} > 1) { #TODO: hack
660 ( 812# (
661 $self->{texture}{width}, 813# $self->{texture}{w},
662 $self->{texture}{height}, 814# $self->{texture}{h},
663 ) 815# )
664 } else { 816# } else {
665 my ($w, $h, $data) = Crossfire::Client::font_render "Yy", $self->{height}; 817# my ($w, $h, $data) = CFClient::font_render "Yy", $self->{h};
666 818#
667 ($w, $h) 819# ($w, $h)
668 } 820# }
821}
669 822
823sub size_allocate {
824 my ($self, $w, $h) = @_;
825
826 return unless $self->{w} != $w || $self->{h} != $h;
827
828 $self->SUPER::size_allocate ($w, $h);
829 delete $self->{texture};
830}
831
832sub update {
833 my ($self) = @_;
834
835 delete $self->{texture};
836 $self->SUPER::update;
670} 837}
671 838
672sub _draw { 839sub _draw {
673 my ($self) = @_; 840 my ($self) = @_;
674 841
675 my $tex = $self->{texture}; 842 my $tex = $self->{texture} ||= do {
843 $self->{layout}->set_width ($self->{w});
844 new_from_layout CFClient::Texture $self->{layout}
845 };
676 846
677 glEnable GL_BLEND; 847 glEnable GL_BLEND;
848 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
678 glEnable GL_TEXTURE_2D; 849 glEnable GL_TEXTURE_2D;
679 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
680 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 850 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
681 851
682 glColor 1, 0, 0, 1; # TODO color 852 glColor @{$self->{fg}};
683 853
854 my $x =
855 $self->{align} < 0 ? 0
856 : $self->{align} > 0 ? $self->{w} - $tex->{w}
857 : ($self->{w} - $tex->{w}) * 0.5;
858
684 $tex->draw_quad (0, 0); 859 $tex->draw_quad ($x, 0);
685 860
861 glDisable GL_TEXTURE_2D;
686 glDisable GL_BLEND; 862 glDisable GL_BLEND;
687 glDisable GL_TEXTURE_2D; 863 glGetError and die;
688} 864}
689 865
690############################################################################# 866#############################################################################
691 867
692package Crossfire::Client::Widget::Entry; 868package CFClient::UI::Entry;
693 869
694our @ISA = Crossfire::Client::Widget::Label::; 870our @ISA = CFClient::UI::Label::;
695 871
696use SDL; 872use SDL;
697use SDL::OpenGL; 873use SDL::OpenGL;
698 874
875sub new {
876 my $class = shift;
877
878 $class->SUPER::new (
879 fg => [1, 1, 1],
880 bg => [0, 0, 0, 0.4],
881 active_bg => [1, 1, 1],
882 active_fg => [0, 0, 0],
883 @_
884 )
885}
886
887sub _set_text {
888 my ($self, $text) = @_;
889
890 $self->{last_activity} = $::NOW;
891
892 $self->{text} = $text;
893 $self->{layout}->set_width ($self->{w});
894
895 $text =~ s/./*/g if $self->{hidden};
896
897
898 $self->{layout}->set_markup ($self->escape_text ($text));
899
900 $text = substr $text, 0, $self->{cursor};
901 utf8::encode $text;
902
903 @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text);
904}
905
906sub size_request {
907 my ($self) = @_;
908
909 my ($w, $h) = $self->SUPER::size_request;
910
911 ($w + 1, $h) # add 1 for cursor
912}
913
914sub size_allocate {
915 my ($self, $w, $h) = @_;
916
917 return unless $self->{w} != $w || $self->{h} != $h;
918
919 $self->SUPER::size_allocate ($w, $h);
920
921 $self->_set_text ($self->{text});
922}
923
924sub set_text {
925 my ($self, $text) = @_;
926
927 $self->{cursor} = length $text;
928 $self->_set_text ($text);
929 $self->update;
930}
931
699sub key_down { 932sub key_down {
700 my ($self, $ev) = @_; 933 my ($self, $ev) = @_;
701 934
702 my $mod = $ev->key_mod; 935 my $mod = $ev->key_mod;
703 my $sym = $ev->key_sym; 936 my $sym = $ev->key_sym;
705 my $uni = $ev->key_unicode; 938 my $uni = $ev->key_unicode;
706 939
707 my $text = $self->get_text; 940 my $text = $self->get_text;
708 941
709 if ($sym == SDLK_BACKSPACE) { 942 if ($sym == SDLK_BACKSPACE) {
710 substr $text, -1, 1, ''; 943 substr $text, --$self->{cursor}, 1, "" if $self->{cursor};
944 } elsif ($sym == SDLK_DELETE) {
945 substr $text, $self->{cursor}, 1, "";
946 } elsif ($sym == SDLK_LEFT) {
947 --$self->{cursor} if $self->{cursor};
948 } elsif ($sym == SDLK_RIGHT) {
949 ++$self->{cursor} if $self->{cursor} < length $self->{text};
711 } elsif ($uni) { 950 } elsif ($uni) {
712 $text .= chr $uni; 951 substr $text, $self->{cursor}++, 0, chr $uni;
713 print "$uni <$text>\n";#d#
714 } 952 }
715 953
716 $self->set_text ($text); 954 $self->_set_text ($text);
955 $self->update;
956}
957
958sub focus_in {
959 my ($self) = @_;
960
961 $self->{last_activity} = $::NOW;
962
963 $self->SUPER::focus_in;
717} 964}
718 965
719sub button_down { 966sub button_down {
720 my ($self, $ev) = @_; 967 my ($self, $ev, $x, $y) = @_;
721 968
722 $self->focus_in; 969 $self->SUPER::button_down ($ev, $x, $y);
970
971 my $idx = $self->{layout}->xy_to_index ($x, $y);
972
973 # byte-index to char-index
974 my $text = $self->{layout};
975 utf8::encode $text;
976 $self->{cursor} = length substr $text, 0, $idx;
977
978 $self->_set_text ($self->{text});
979 $self->update;
980}
981
982sub mouse_motion {
983 my ($self, $ev, $x, $y) = @_;
984# printf "M %d,%d %d,%d\n", $ev->motion_x, $ev->motion_y, $x, $y;#d#
723} 985}
724 986
725sub _draw { 987sub _draw {
726 my ($self) = @_; 988 my ($self) = @_;
727 989
990 local $self->{fg} = $self->{fg};
991
728 if ($FOCUS == $self) { 992 if ($FOCUS == $self) {
729 glColor 1, 1, 1; 993 glColor @{$self->{active_bg}};
994 $self->{fg} = $self->{active_fg};
730 } else { 995 } else {
731 glColor 0.7, 0.7, 0.7; 996 glColor @{$self->{bg}};
732 } 997 }
733 998
734 glBegin GL_QUADS; 999 glBegin GL_QUADS;
735 glVertex 0 , 0; 1000 glVertex 0 , 0;
736 glVertex 0 , $self->{h} - 1; 1001 glVertex 0 , $self->{h};
737 glVertex $self->{w} - 1, $self->{h} - 1; 1002 glVertex $self->{w}, $self->{h};
738 glVertex $self->{w} - 1, 0; 1003 glVertex $self->{w}, 0;
739 glEnd; 1004 glEnd;
740 1005
741 $self->SUPER::_draw; 1006 $self->SUPER::_draw;
742}
743 1007
744############################################################################# 1008 #TODO: force update every cursor change :(
1009 if ($FOCUS == $self && (($::NOW - $self->{last_activity}) & 1023) < 600) {
1010 glColor @{$self->{fg}};
1011 glBegin GL_LINES;
1012 glVertex $self->{cur_x}, $self->{cur_y};
1013 glVertex $self->{cur_x}, $self->{cur_y} + $self->{cur_h};
1014 glEnd;
1015 }
1016}
745 1017
1018#############################################################################
1019
1020package CFClient::UI::Slider;
1021
1022use strict;
1023
1024use SDL::OpenGL;
1025
1026our @ISA = CFClient::UI::DrawBG::;
1027
1028sub size_request {
1029 my ($self) = @_;
1030
1031 my $w = 50;
1032 my $h = 10;
1033
1034 $self->{vertical} ? ($h, $w) : ($w, $h)
1035}
1036
1037sub new {
1038 my $class = shift;
1039
1040 # range [value, low, high, page]
1041
1042 $class->SUPER::new (
1043 fg => [1, 1, 1],
1044 active_fg => [0, 0, 0],
1045 range => [0, 0, 100, 10],
1046 vertical => 1,
1047 @_
1048 )
1049}
1050
1051sub button_down {
1052 my ($self, $ev, $x, $y) = @_;
1053
1054 $self->SUPER::button_down ($ev, $x, $y);
1055 $self->mouse_motion ($ev, $x, $y);
1056}
1057
1058sub mouse_motion {
1059 my ($self, $ev, $x, $y) = @_;
1060
1061 if ($GRAB == $self) {
1062 my ($value, $lo, $hi, $page) = @{$self->{range}};
1063
1064 my ($x, $w) = $self->{vertical} ? ($y, $self->{h}) : ($x, $self->{w});
1065
1066 $x = $x * ($hi - $lo) / $w + $lo;
1067 $x = $lo if $x < $lo;
1068 $x = $hi - $page if $x > $hi - $page;
1069 $self->{range}[0] = $x;
1070
1071 $self->emit (changed => $x);
1072 $self->update;
1073 }
1074}
1075
1076sub _draw {
1077 my ($self) = @_;
1078
1079 $self->SUPER::_draw ();
1080
1081 my ($w, $h) = @$self{qw(w h)};
1082
1083 if ($self->{vertical}) {
1084 # draw a vertical slider like a rotated horizontal slider
1085
1086 glRotate 90, 0, 0, 1;
1087 glTranslate 0, -$self->{w}, 0;
1088
1089 ($w, $h) = ($h, $w);
1090 }
1091
1092 my $fg = $FOCUS == $self ? $self->{active_fg} : $self->{fg};
1093 my $bg = $FOCUS == $self ? $self->{active_bg} : $self->{bg};
1094
1095 my ($value, $lo, $hi, $page) = @{$self->{range}};
1096
1097 $page = int $page * $w / ($hi - $lo);
1098 $value = int +($value - $lo) * $w / ($hi - $lo);
1099
1100 $w -= $page;
1101 $page &= ~1;
1102 glTranslate $page * 0.5, 0, 0;
1103
1104 glColor @$fg;
1105 glBegin GL_LINES;
1106 glVertex 0, 0; glVertex 0, $h;
1107 glVertex $w - 1, 0; glVertex $w - 1, $h;
1108 glVertex 0, $h * 0.5; glVertex $w, $h * 0.5;
1109 glEnd;
1110
1111 my $knob_a = $value - $page * 0.5;
1112 my $knob_b = $value + $page * 0.5;
1113
1114 glBegin GL_QUADS;
1115 glColor @$fg;
1116 glVertex $knob_a, 0;
1117 glVertex $knob_a, $h;
1118 glVertex $knob_b, $h;
1119 glVertex $knob_b, 0;
1120
1121 if ($knob_a < $knob_b - 2) {
1122 glColor @$bg;
1123 glVertex $knob_a + 1, 1;
1124 glVertex $knob_a + 1, $h - 1;
1125 glVertex $knob_b - 1, $h - 1;
1126 glVertex $knob_b - 1, 1;
1127 }
1128 glEnd;
1129}
1130
1131#############################################################################
1132
746package Crossfire::Client::Widget::MapWidget; 1133package CFClient::UI::MapWidget;
747 1134
748use strict; 1135use strict;
749 1136
750use List::Util qw(min max); 1137use List::Util qw(min max);
751 1138
752use SDL; 1139use SDL;
753use SDL::OpenGL; 1140use SDL::OpenGL;
754use SDL::OpenGL::Constants;
755 1141
756our @ISA = Crossfire::Client::Widget::; 1142our @ISA = CFClient::UI::Base::;
1143
1144sub new {
1145 my $class = shift;
1146
1147 $class->SUPER::new (
1148 z => -1,
1149 list => (glGenLists 1),
1150 @_
1151 )
1152}
757 1153
758sub key_down { 1154sub key_down {
759 print "MAPKEYDOWN\n"; 1155 print "MAPKEYDOWN\n";
760} 1156}
761 1157
767 1 + int $::WIDTH / 32, 1163 1 + int $::WIDTH / 32,
768 1 + int $::HEIGHT / 32, 1164 1 + int $::HEIGHT / 32,
769 ) 1165 )
770} 1166}
771 1167
1168sub update {
1169 my ($self) = @_;
1170
1171 $self->{need_update} = 1;
1172 $self->SUPER::update;
1173}
1174
772sub _draw { 1175sub _draw {
773 my ($self) = @_; 1176 my ($self) = @_;
774 1177
1178 if (delete $self->{need_update}) {
1179 glNewList $self->{list}, GL_COMPILE;
1180
775 my $mx = $::CONN->{mapx}; 1181 my $mx = $::CONN->{mapx};
776 my $my = $::CONN->{mapy}; 1182 my $my = $::CONN->{mapy};
777 1183
778 my $map = $::CONN->{map}; 1184 my $map = $::CONN->{map};
779 1185
780 my ($xofs, $yofs); 1186 my ($xofs, $yofs);
781 1187
782 my $sw = 1 + int $::WIDTH / 32; 1188 my $sw = 1 + int $::WIDTH / 32;
783 my $sh = 1 + int $::HEIGHT / 32; 1189 my $sh = 1 + int $::HEIGHT / 32;
784 1190
785 if ($::CONN->{mapw} > $sw) { 1191 if ($::CONN->{mapw} > $sw) {
786 $xofs = $mx + ($::CONN->{mapw} - $sw) * 0.5; 1192 $xofs = $mx + ($::CONN->{mapw} - $sw) * 0.5;
787 } else { 1193 } else {
788 $xofs = $self->{xofs} = min $mx, max $mx + $::CONN->{mapw} - $sw + 1, $self->{xofs}; 1194 $xofs = $self->{xofs} = min $mx, max $mx + $::CONN->{mapw} - $sw + 1, $self->{xofs};
789 } 1195 }
790 1196
791 if ($::CONN->{maph} > $sh) { 1197 if ($::CONN->{maph} > $sh) {
792 $yofs = $my + ($::CONN->{maph} - $sh) * 0.5; 1198 $yofs = $my + ($::CONN->{maph} - $sh) * 0.5;
793 } else { 1199 } else {
794 $yofs = $self->{yofs} = min $my, max $my + $::CONN->{maph} - $sh + 1, $self->{yofs}; 1200 $yofs = $self->{yofs} = min $my, max $my + $::CONN->{maph} - $sh + 1, $self->{yofs};
795 } 1201 }
796 1202
797 glEnable GL_TEXTURE_2D; 1203 glEnable GL_TEXTURE_2D;
798 glEnable GL_BLEND; 1204 glEnable GL_BLEND;
1205 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
799 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1206 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
800 1207
801 my $sw4 = ($sw + 3) & ~3; 1208 my $sw4 = ($sw + 3) & ~3;
802 my $darkness = "\x00" x ($sw4 * $sh); 1209 my $darkness = "\x00" x ($sw4 * $sh);
803 1210
804 for my $x (0 .. $sw - 1) { 1211 for my $x (0 .. $sw - 1) {
805 my $row = $map->[$x + $xofs]; 1212 my $row = $map->[$x + $xofs];
806 for my $y (0 .. $sh - 1) { 1213 for my $y (0 .. $sh - 1) {
807 1214
808 my $cell = $row->[$y + $yofs] 1215 my $cell = $row->[$y + $yofs]
809 or next; 1216 or next;
810 1217
811 my $dark = $cell->[0]; 1218 my $dark = $cell->[0];
812 if ($dark < 0) { 1219 if ($dark < 0) {
813 substr $darkness, $y * $sw4 + $x, 1, chr 224; 1220 substr $darkness, $y * $sw4 + $x, 1, chr 224;
814 } else { 1221 } else {
815 substr $darkness, $y * $sw4 + $x, 1, chr 255 - $dark; 1222 substr $darkness, $y * $sw4 + $x, 1, chr 255 - $dark;
816 } 1223 }
817 1224
818 for my $num (grep $_, @$cell[1,2,3]) { 1225 for my $num (grep $_, @$cell[1,2,3]) {
819 my $tex = $::CONN->{face}[$num]{texture} || next; 1226 my $tex = $::CONN->{face}[$num]{texture} || next;
820 1227
821 my $w = $tex->{width}; 1228 my ($w, $h) = @$tex{qw(w h)};
822 my $h = $tex->{height};
823 1229
824 $tex->draw_quad (($x + 1) * 32 - $w, ($y + 1) * 32 - $h, $w, $h); 1230 $tex->draw_quad (($x + 1) * 32 - $w, ($y + 1) * 32 - $h, $w, $h);
1231 }
825 } 1232 }
826 } 1233 }
827 }
828 1234
829# if (1) { # higher quality darkness 1235# if (1) { # higher quality darkness
830# $lighting =~ s/(.)/$1$1$1/gs; 1236# $lighting =~ s/(.)/$1$1$1/gs;
831# my $pb = new_from_data Gtk2::Gdk::Pixbuf $lighting, "rgb", 0, 8, $sw4, $sh, $sw4 * 3; 1237# my $pb = new_from_data Gtk2::Gdk::Pixbuf $lighting, "rgb", 0, 8, $sw4, $sh, $sw4 * 3;
832# 1238#
834# 1240#
835# $lighting = $pb->get_pixels; 1241# $lighting = $pb->get_pixels;
836# $lighting =~ s/(.)../$1/gs; 1242# $lighting =~ s/(.)../$1/gs;
837# } 1243# }
838 1244
839 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
840 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 1245 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
841 1246
842 $darkness = new Crossfire::Client::Texture 1247 $darkness = new CFClient::Texture
843 width => $sw4, 1248 w => $sw4,
844 height => $sh, 1249 h => $sh,
845 data => $darkness, 1250 data => $darkness,
846 internalformat => GL_ALPHA, 1251 internalformat => GL_ALPHA,
847 format => GL_ALPHA; 1252 format => GL_ALPHA;
848 1253
849 glColor 0.45, 0.45, 0.45, 1; 1254 glColor 0.45, 0.45, 0.45, 1;
850 $darkness->draw_quad (0, 0, $sw4 * 32, $sh * 32); 1255 $darkness->draw_quad (0, 0, $sw4 * 32, $sh * 32);
851 1256
852 glDisable GL_TEXTURE_2D; 1257 glDisable GL_TEXTURE_2D;
853 glDisable GL_BLEND; 1258 glDisable GL_BLEND;
1259
1260 glEndList;
1261 }
1262
1263 glCallList $self->{list};
854} 1264}
855 1265
856my %DIR = ( 1266my %DIR = (
857 SDLK_KP8, [1, "north"], 1267 SDLK_KP8, [1, "north"],
858 SDLK_KP9, [2, "northeast"], 1268 SDLK_KP9, [2, "northeast"],
904 } 1314 }
905} 1315}
906 1316
907############################################################################# 1317#############################################################################
908 1318
909package Crossfire::Client::Widget::Animator; 1319package CFClient::UI::Animator;
910 1320
911use SDL::OpenGL; 1321use SDL::OpenGL;
912 1322
913our @ISA = Crossfire::Client::Widget::Bin::; 1323our @ISA = CFClient::UI::Bin::;
914 1324
915sub moveto { 1325sub moveto {
916 my ($self, $x, $y) = @_; 1326 my ($self, $x, $y) = @_;
917 1327
918 $self->{moveto} = [$self->{x}, $self->{y}, $x, $y]; 1328 $self->{moveto} = [$self->{x}, $self->{y}, $x, $y];
923} 1333}
924 1334
925sub animate { 1335sub animate {
926 my ($self, $interval) = @_; 1336 my ($self, $interval) = @_;
927 1337
928 printf "%5.2f\n", 1 / $interval if $interval;#d#
929
930 $self->{time} -= $interval * $self->{speed}; 1338 $self->{time} -= $interval * $self->{speed};
931 if ($self->{time} <= 0) { 1339 if ($self->{time} <= 0) {
932 $self->{time} = 0; 1340 $self->{time} = 0;
933 ::animation_stop $self; 1341 ::animation_stop $self;
934 } 1342 }
948 glPopMatrix; 1356 glPopMatrix;
949} 1357}
950 1358
951############################################################################# 1359#############################################################################
952 1360
953package Crossfire::Client::Widget::Toplevel; 1361package CFClient::UI::Toplevel;
954 1362
955our @ISA = Crossfire::Client::Widget::Container::; 1363our @ISA = CFClient::UI::Container::;
956 1364
957sub size_request { 1365sub size_request {
958 ($::WIDTH, $::HEIGHT) 1366 ($::WIDTH, $::HEIGHT)
959} 1367}
960 1368
965 1373
966 $_->size_allocate ($_->size_request) 1374 $_->size_allocate ($_->size_request)
967 for @{$self->{children}}; 1375 for @{$self->{children}};
968} 1376}
969 1377
1378sub translate {
1379 my ($self, $x, $y) = @_;
1380
1381 ($x, $y)
1382}
1383
970sub update { 1384sub update {
971 my ($self) = @_; 1385 my ($self) = @_;
972 1386
973 $self->size_allocate ($self->size_request); 1387 $self->size_allocate ($self->size_request);
974 ::refresh (); 1388 ::refresh ();
988 $self->_draw; 1402 $self->_draw;
989} 1403}
990 1404
991############################################################################# 1405#############################################################################
992 1406
993package Crossfire::Client::Widget; 1407package CFClient::UI;
994 1408
995$TOPLEVEL = new Crossfire::Client::Widget::Toplevel; 1409$TOPLEVEL = new CFClient::UI::Toplevel;
996 1410
9971 14111
998 1412

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines