… | |
… | |
8 | use CFClient; |
8 | use CFClient; |
9 | |
9 | |
10 | our ($FOCUS, $HOVER, $GRAB); # various widgets |
10 | our ($FOCUS, $HOVER, $GRAB); # various widgets |
11 | |
11 | |
12 | our $ROOT; |
12 | our $ROOT; |
|
|
13 | our $TOOLTIP; |
13 | our $BUTTON_STATE; |
14 | our $BUTTON_STATE; |
|
|
15 | |
|
|
16 | sub check_tooltip { |
|
|
17 | if (!$GRAB) { |
|
|
18 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
|
|
19 | if (exists $widget->{tooltip}) { |
|
|
20 | |
|
|
21 | if ($TOOLTIP->{owner} != $widget) { |
|
|
22 | $TOOLTIP->{owner} = $widget; |
|
|
23 | |
|
|
24 | my $tip = $widget->{tooltip}; |
|
|
25 | |
|
|
26 | $tip = $tip->($widget) if CODE:: eq ref $tip; |
|
|
27 | |
|
|
28 | $TOOLTIP->set_text ($widget->{tooltip}); |
|
|
29 | $TOOLTIP->move ($widget->coord2global ($widget->{w}, 0)); |
|
|
30 | $TOOLTIP->show; |
|
|
31 | } |
|
|
32 | |
|
|
33 | return; |
|
|
34 | } |
|
|
35 | } |
|
|
36 | } |
|
|
37 | |
|
|
38 | $TOOLTIP->hide; |
|
|
39 | delete $TOOLTIP->{owner}; |
|
|
40 | } |
14 | |
41 | |
15 | # class methods for events |
42 | # class methods for events |
16 | sub feed_sdl_key_down_event { |
43 | sub feed_sdl_key_down_event { |
17 | $FOCUS->key_down ($_[0]) if $FOCUS; |
44 | $FOCUS->key_down ($_[0]) if $FOCUS; |
18 | } |
45 | } |
… | |
… | |
28 | if (!$BUTTON_STATE) { |
55 | if (!$BUTTON_STATE) { |
29 | my $widget = $ROOT->find_widget ($x, $y); |
56 | my $widget = $ROOT->find_widget ($x, $y); |
30 | |
57 | |
31 | $GRAB = $widget; |
58 | $GRAB = $widget; |
32 | $GRAB->update if $GRAB; |
59 | $GRAB->update if $GRAB; |
|
|
60 | |
|
|
61 | check_tooltip; |
33 | } |
62 | } |
34 | |
63 | |
35 | $BUTTON_STATE |= 1 << ($ev->{button} - 1); |
64 | $BUTTON_STATE |= 1 << ($ev->{button} - 1); |
36 | |
65 | |
37 | $GRAB->button_down ($ev, $GRAB->coord2local ($x, $y)) if $GRAB; |
66 | $GRAB->button_down ($ev, $GRAB->coord2local ($x, $y)) if $GRAB; |
… | |
… | |
49 | |
78 | |
50 | if (!$BUTTON_STATE) { |
79 | if (!$BUTTON_STATE) { |
51 | my $grab = $GRAB; undef $GRAB; |
80 | my $grab = $GRAB; undef $GRAB; |
52 | $grab->update if $grab; |
81 | $grab->update if $grab; |
53 | $GRAB->update if $GRAB; |
82 | $GRAB->update if $GRAB; |
|
|
83 | |
|
|
84 | check_tooltip; |
54 | } |
85 | } |
55 | } |
86 | } |
56 | |
87 | |
57 | sub feed_sdl_motion_event { |
88 | sub feed_sdl_motion_event { |
58 | my ($ev) = @_; |
89 | my ($ev) = @_; |
… | |
… | |
63 | if ($widget != $HOVER) { |
94 | if ($widget != $HOVER) { |
64 | my $hover = $HOVER; $HOVER = $widget; |
95 | my $hover = $HOVER; $HOVER = $widget; |
65 | |
96 | |
66 | $hover->update if $hover && $hover->{can_hover}; |
97 | $hover->update if $hover && $hover->{can_hover}; |
67 | $HOVER->update if $HOVER && $HOVER->{can_hover}; |
98 | $HOVER->update if $HOVER && $HOVER->{can_hover}; |
|
|
99 | |
|
|
100 | check_tooltip; |
68 | } |
101 | } |
69 | |
102 | |
70 | $HOVER->mouse_motion ($ev, $HOVER->coord2local ($x, $y)) if $HOVER; |
103 | $HOVER->mouse_motion ($ev, $HOVER->coord2local ($x, $y)) if $HOVER; |
71 | } |
104 | } |
72 | |
105 | |
… | |
… | |
96 | |
129 | |
97 | my $self = bless { |
130 | my $self = bless { |
98 | x => 0, |
131 | x => 0, |
99 | y => 0, |
132 | y => 0, |
100 | z => 0, |
133 | z => 0, |
|
|
134 | can_events => 1, |
101 | @_ |
135 | @_ |
102 | }, $class; |
136 | }, $class; |
103 | |
137 | |
104 | for (keys %$self) { |
138 | for (keys %$self) { |
105 | if (/^connect_(.*)$/) { |
139 | if (/^connect_(.*)$/) { |
… | |
… | |
134 | $self->{z} = $z if defined $z; |
168 | $self->{z} = $z if defined $z; |
135 | |
169 | |
136 | $self->update; |
170 | $self->update; |
137 | } |
171 | } |
138 | |
172 | |
139 | sub needs_redraw { |
173 | sub set_size { |
140 | 0 |
174 | my ($self, $w, $h) = @_; |
|
|
175 | |
|
|
176 | $self->{user_w} = $w; |
|
|
177 | $self->{user_h} = $h; |
|
|
178 | |
|
|
179 | $self->check_size; |
141 | } |
180 | } |
142 | |
181 | |
143 | sub size_request { |
182 | sub size_request { |
144 | require Carp; |
183 | require Carp; |
145 | Carp::confess "size_request is abtract"; |
184 | Carp::confess "size_request is abstract"; |
146 | } |
185 | } |
147 | |
186 | |
148 | sub configure { |
187 | sub configure { |
149 | my ($self, $x, $y, $w, $h) = @_; |
188 | my ($self, $x, $y, $w, $h) = @_; |
150 | |
189 | |
… | |
… | |
152 | my $w2 = List::Util::min $w, int $h * $self->{aspect}; |
191 | my $w2 = List::Util::min $w, int $h * $self->{aspect}; |
153 | my $h2 = List::Util::min $h, int $w / $self->{aspect}; |
192 | my $h2 = List::Util::min $h, int $w / $self->{aspect}; |
154 | |
193 | |
155 | # use alignment to adjust x, y |
194 | # use alignment to adjust x, y |
156 | |
195 | |
157 | $x += ($w - $w2) * 0.5; |
196 | $x += int +($w - $w2) * 0.5; |
158 | $y += ($h - $h2) * 0.5; |
197 | $y += int +($h - $h2) * 0.5; |
159 | |
198 | |
160 | ($w, $h) = ($w2, $h2); |
199 | ($w, $h) = ($w2, $h2); |
161 | } |
200 | } |
162 | |
201 | |
163 | if ($self->{x} != $x || $self->{y} != $y) { |
202 | if ($self->{x} != $x || $self->{y} != $y) { |
… | |
… | |
175 | } |
214 | } |
176 | } |
215 | } |
177 | |
216 | |
178 | sub size_allocate { |
217 | sub size_allocate { |
179 | # nothing to be done |
218 | # nothing to be done |
|
|
219 | } |
|
|
220 | |
|
|
221 | sub set_max_size { |
|
|
222 | my ($self, $w, $h) = @_; |
|
|
223 | |
|
|
224 | delete $self->{max_w}; $self->{max_w} = $w if $w; |
|
|
225 | delete $self->{max_h}; $self->{max_h} = $h if $h; |
180 | } |
226 | } |
181 | |
227 | |
182 | # return top left coordinates |
228 | # return top left coordinates |
183 | sub _topleft { |
229 | sub _topleft { |
184 | my ($self, $x, $y) = @_; |
230 | my ($self, $x, $y) = @_; |
… | |
… | |
278 | } |
324 | } |
279 | |
325 | |
280 | sub find_widget { |
326 | sub find_widget { |
281 | my ($self, $x, $y) = @_; |
327 | my ($self, $x, $y) = @_; |
282 | |
328 | |
|
|
329 | return () unless $self->{can_events}; |
|
|
330 | |
283 | return $self |
331 | return $self |
284 | if $x >= $self->{x} && $x < $self->{x} + $self->{w} |
332 | if $x >= $self->{x} && $x < $self->{x} + $self->{w} |
285 | && $y >= $self->{y} && $y < $self->{y} + $self->{h}; |
333 | && $y >= $self->{y} && $y < $self->{y} + $self->{h}; |
286 | |
334 | |
287 | () |
335 | () |
… | |
… | |
294 | } |
342 | } |
295 | |
343 | |
296 | sub check_size { |
344 | sub check_size { |
297 | my ($self) = @_; |
345 | my ($self) = @_; |
298 | |
346 | |
299 | my ($w, $h) = $self->size_request; |
347 | $self->{parent} |
|
|
348 | or return 1; |
300 | |
349 | |
|
|
350 | my ($w, $h) = $self->{user_w} && $self->{user_h} |
|
|
351 | ? @$self{qw(user_w user_h)} |
|
|
352 | : $self->size_request; |
|
|
353 | |
301 | if ($w != $self->{req_w} || $h != $self->{req_h}) { |
354 | if ($w != $self->{req_w} || $h != $self->{req_h}) { |
302 | $self->{req_w} = $w; |
355 | $self->{req_w} = $w; |
303 | $self->{req_h} = $h; |
356 | $self->{req_h} = $h; |
304 | |
357 | |
305 | $self->{parent}->check_size |
358 | $self->{parent}->check_size |
306 | if $self->{parent}; |
359 | or $self->size_allocate ( |
|
|
360 | (List::Util::max $self->{w}, $w), |
|
|
361 | (List::Util::max $self->{h}, $h), |
|
|
362 | ); |
|
|
363 | |
|
|
364 | 1 |
|
|
365 | } else { |
|
|
366 | 0 |
307 | } |
367 | } |
308 | } |
368 | } |
309 | |
369 | |
310 | sub update { |
370 | sub update { |
311 | my ($self) = @_; |
371 | my ($self) = @_; |
… | |
… | |
378 | |
438 | |
379 | package CFClient::UI::Empty; |
439 | package CFClient::UI::Empty; |
380 | |
440 | |
381 | our @ISA = CFClient::UI::Base::; |
441 | our @ISA = CFClient::UI::Base::; |
382 | |
442 | |
|
|
443 | sub new { |
|
|
444 | my ($class, %arg) = @_; |
|
|
445 | $class->SUPER::new (can_events => 0, %arg); |
|
|
446 | } |
|
|
447 | |
383 | sub size_request { |
448 | sub size_request { |
384 | (0, 0) |
449 | (0, 0) |
385 | } |
450 | } |
386 | |
451 | |
387 | sub draw { } |
452 | sub draw { } |
… | |
… | |
395 | sub new { |
460 | sub new { |
396 | my ($class, %arg) = @_; |
461 | my ($class, %arg) = @_; |
397 | |
462 | |
398 | my $children = delete $arg{children} || []; |
463 | my $children = delete $arg{children} || []; |
399 | |
464 | |
400 | my $self = $class->SUPER::new (children => [], %arg); |
465 | my $self = $class->SUPER::new (children => [], can_events => 0, %arg); |
401 | $self->add ($_) for @$children; |
466 | $self->add ($_) for @$children; |
402 | |
467 | |
403 | $self |
468 | $self |
404 | } |
469 | } |
405 | |
470 | |
… | |
… | |
424 | delete $child->{parent}; |
489 | delete $child->{parent}; |
425 | |
490 | |
426 | $self->{children} = [ grep $_ != $child, @{ $self->{children} } ]; |
491 | $self->{children} = [ grep $_ != $child, @{ $self->{children} } ]; |
427 | |
492 | |
428 | $self->check_size; |
493 | $self->check_size; |
|
|
494 | $self->update; |
429 | } |
495 | } |
430 | |
496 | |
431 | sub find_widget { |
497 | sub find_widget { |
432 | my ($self, $x, $y) = @_; |
498 | my ($self, $x, $y) = @_; |
433 | |
499 | |
… | |
… | |
561 | sub new { die } |
627 | sub new { die } |
562 | |
628 | |
563 | sub size_request { |
629 | sub size_request { |
564 | my ($self) = @_; |
630 | my ($self) = @_; |
565 | |
631 | |
566 | @$self{qw(child_w child_h)} = $self->child->size_request; |
632 | @$self{qw(child_w child_h)} = @{$self->child}{qw(req_w req_h)}; |
567 | $self->child->size_allocate (0, 0, @$self{qw(child_w child_h)}); |
633 | $self->child->size_allocate (0, 0, @$self{qw(child_w child_h)}); |
568 | |
634 | |
569 | @$self{qw(child_w child_h)} |
635 | @$self{qw(child_w child_h)} |
570 | } |
636 | } |
571 | |
637 | |
… | |
… | |
581 | package CFClient::UI::Frame; |
647 | package CFClient::UI::Frame; |
582 | |
648 | |
583 | our @ISA = CFClient::UI::Bin::; |
649 | our @ISA = CFClient::UI::Bin::; |
584 | |
650 | |
585 | use CFClient::OpenGL; |
651 | use CFClient::OpenGL; |
586 | |
|
|
587 | sub size_request { |
|
|
588 | my ($self) = @_; |
|
|
589 | my $chld = $self->child |
|
|
590 | or return (0, 0); |
|
|
591 | |
|
|
592 | $chld->move (2, 2); |
|
|
593 | |
|
|
594 | map { $_ + 4 } $chld->size_request; |
|
|
595 | } |
|
|
596 | |
|
|
597 | sub size_allocate { |
|
|
598 | my ($self, $x, $y, $w, $h) = @_; |
|
|
599 | |
|
|
600 | $self->child->configure (2, 2, $w - 4, $h - 4); |
|
|
601 | } |
|
|
602 | |
|
|
603 | sub _draw { |
|
|
604 | my ($self) = @_; |
|
|
605 | |
|
|
606 | my $chld = $self->child; |
|
|
607 | |
|
|
608 | my ($w, $h) = $chld->size_request; |
|
|
609 | |
|
|
610 | glBegin GL_QUADS; |
|
|
611 | glColor 0, 0, 0; |
|
|
612 | glVertex 0 , 0; |
|
|
613 | glVertex 0 , $h + 4; |
|
|
614 | glVertex $w + 4 , $h + 4; |
|
|
615 | glVertex $w + 4 , 0; |
|
|
616 | glEnd; |
|
|
617 | |
|
|
618 | $chld->draw; |
|
|
619 | } |
|
|
620 | |
|
|
621 | ############################################################################# |
|
|
622 | |
|
|
623 | package CFClient::UI::FancyFrame; |
|
|
624 | |
|
|
625 | our @ISA = CFClient::UI::Bin::; |
|
|
626 | |
|
|
627 | use CFClient::OpenGL; |
|
|
628 | |
|
|
629 | my @tex = |
|
|
630 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
|
|
631 | qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); |
|
|
632 | |
652 | |
633 | sub new { |
653 | sub new { |
634 | my $class = shift; |
654 | my $class = shift; |
635 | |
|
|
636 | # TODO: user_x, user_y, overwrite moveto? |
|
|
637 | |
655 | |
638 | my $self = $class->SUPER::new ( |
656 | my $self = $class->SUPER::new ( |
639 | bg => [1, 1, 1, 1], |
657 | bg => [1, 1, 1, 1], |
640 | border_bg => [1, 1, 1, 1], |
658 | border_bg => [1, 1, 1, 1], |
641 | border => 0.8, |
659 | border => 0.8, |
642 | @_ |
660 | @_ |
643 | ); |
661 | ); |
644 | |
662 | |
|
|
663 | $self |
|
|
664 | } |
|
|
665 | |
|
|
666 | sub _draw { |
|
|
667 | my ($self) = @_; |
|
|
668 | |
|
|
669 | my ($w, $h) = ($self->{w}, $self->{h}); |
|
|
670 | |
|
|
671 | glEnable GL_BLEND; |
|
|
672 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
|
|
673 | glEnable GL_TEXTURE_2D; |
|
|
674 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
|
|
675 | |
|
|
676 | # glBegin GL_QUADS; |
|
|
677 | # glColor 0, 0, 0, 0; |
|
|
678 | # glVertex 0 , 0; |
|
|
679 | # glVertex 0 , $h; |
|
|
680 | # glVertex $w, $h; |
|
|
681 | # glVertex $w, 0; |
|
|
682 | # glEnd; |
|
|
683 | |
|
|
684 | |
|
|
685 | $self->child->draw; |
|
|
686 | glDisable GL_BLEND; |
|
|
687 | glDisable GL_TEXTURE_2D; |
|
|
688 | } |
|
|
689 | |
|
|
690 | ############################################################################# |
|
|
691 | |
|
|
692 | package CFClient::UI::FancyFrame; |
|
|
693 | |
|
|
694 | our @ISA = CFClient::UI::Bin::; |
|
|
695 | |
|
|
696 | use CFClient::OpenGL; |
|
|
697 | |
|
|
698 | my @tex = |
|
|
699 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
|
|
700 | qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); |
|
|
701 | |
|
|
702 | sub new { |
|
|
703 | my $class = shift; |
|
|
704 | |
|
|
705 | # TODO: user_x, user_y, overwrite moveto? |
|
|
706 | |
|
|
707 | my $self = $class->SUPER::new ( |
|
|
708 | bg => [1, 1, 1, 1], |
|
|
709 | border_bg => [1, 1, 1, 1], |
|
|
710 | border => 0.8, |
|
|
711 | can_events => 1, |
|
|
712 | @_ |
|
|
713 | ); |
|
|
714 | |
645 | $self->{title} &&= new CFClient::UI::Label |
715 | $self->{title} &&= new CFClient::UI::Label |
646 | align => 0, |
716 | align => 0, |
647 | valign => 1, |
717 | valign => 1, |
648 | text => $self->{title}, |
718 | text => $self->{title}, |
649 | fontsize => 1; |
719 | fontsize => 1; |
… | |
… | |
656 | } |
726 | } |
657 | |
727 | |
658 | sub size_request { |
728 | sub size_request { |
659 | my ($self) = @_; |
729 | my ($self) = @_; |
660 | |
730 | |
661 | return ($self->{user_w}, $self->{user_h}) if $self->{user_w} && $self->{user_h}; |
|
|
662 | |
|
|
663 | my ($w, $h) = $self->SUPER::size_request; |
731 | my ($w, $h) = $self->SUPER::size_request; |
664 | |
732 | |
665 | ( |
733 | ( |
666 | $w + $self->border * 2, |
734 | $w + $self->border * 2, |
667 | $h + $self->border * 2, |
735 | $h + $self->border * 2, |
… | |
… | |
815 | or next; |
883 | or next; |
816 | |
884 | |
817 | for my $x (0 .. $#$row) { |
885 | for my $x (0 .. $#$row) { |
818 | my $widget = $row->[$x] |
886 | my $widget = $row->[$x] |
819 | or next; |
887 | or next; |
820 | my ($w, $h) = $widget->size_request; |
888 | my ($w, $h) = @$widget{qw(req_w req_h)}; |
821 | |
889 | |
822 | $w[$x] = max $w[$x], $w; |
890 | $w[$x] = max $w[$x], $w; |
823 | $h[$y] = max $h[$y], $h; |
891 | $h[$y] = max $h[$y], $h; |
824 | } |
892 | } |
825 | } |
893 | } |
… | |
… | |
930 | |
998 | |
931 | ($h, $w) = ($w, $h); |
999 | ($h, $w) = ($w, $h); |
932 | |
1000 | |
933 | my $children = $self->{children}; |
1001 | my $children = $self->{children}; |
934 | |
1002 | |
935 | my @h = map +($_->size_request)[0], @$children; |
1003 | my @h = map $_->{req_w}, @$children; |
936 | |
1004 | |
937 | my $req_h = List::Util::sum @h; |
1005 | my $req_h = List::Util::sum @h; |
938 | |
1006 | |
939 | if ($req_h > $h) { |
1007 | if ($req_h > $h) { |
940 | # ah well, not enough space |
1008 | # ah well, not enough space |
… | |
… | |
988 | sub size_allocate { |
1056 | sub size_allocate { |
989 | my ($self, $w, $h) = @_; |
1057 | my ($self, $w, $h) = @_; |
990 | |
1058 | |
991 | my $children = $self->{children}; |
1059 | my $children = $self->{children}; |
992 | |
1060 | |
993 | my @h = map +($_->size_request)[1], @$children; |
1061 | my @h = map $_->{req_h}, @$children; |
994 | |
1062 | |
995 | my $req_h = List::Util::sum @h; |
1063 | my $req_h = List::Util::sum @h; |
996 | |
1064 | |
997 | if ($req_h > $h) { |
1065 | if ($req_h > $h) { |
998 | # ah well, not enough space |
1066 | # ah well, not enough space |
… | |
… | |
1033 | sub new { |
1101 | sub new { |
1034 | my ($class, %arg) = @_; |
1102 | my ($class, %arg) = @_; |
1035 | |
1103 | |
1036 | my $self = $class->SUPER::new ( |
1104 | my $self = $class->SUPER::new ( |
1037 | fg => [1, 1, 1], |
1105 | fg => [1, 1, 1], |
|
|
1106 | #font => default_font |
1038 | fontsize => 1, |
1107 | fontsize => 1, |
1039 | text => "", |
1108 | text => "", |
1040 | align => -1, |
1109 | align => -1, |
1041 | valign => -1, |
1110 | valign => -1, |
1042 | padding => 2, |
1111 | padding => 2, |
1043 | layout => new CFClient::Layout, |
1112 | layout => new CFClient::Layout, |
|
|
1113 | can_events => 0, |
1044 | %arg |
1114 | %arg |
1045 | ); |
1115 | ); |
1046 | |
1116 | |
1047 | if (exists $self->{template}) { |
1117 | if (exists $self->{template}) { |
1048 | my $layout = new CFClient::Layout; |
1118 | my $layout = new CFClient::Layout; |
… | |
… | |
1070 | my ($self, $text) = @_; |
1140 | my ($self, $text) = @_; |
1071 | |
1141 | |
1072 | $self->{layout}->set_text ($text); |
1142 | $self->{layout}->set_text ($text); |
1073 | |
1143 | |
1074 | delete $self->{texture}; |
1144 | delete $self->{texture}; |
|
|
1145 | $self->check_size; |
1075 | $self->update; |
1146 | $self->update; |
1076 | } |
1147 | } |
1077 | |
1148 | |
1078 | sub set_markup { |
1149 | sub set_markup { |
1079 | my ($self, $markup) = @_; |
1150 | my ($self, $markup) = @_; |
1080 | |
1151 | |
1081 | $self->{layout}->set_markup ($markup); |
1152 | $self->{layout}->set_markup ($markup); |
1082 | |
1153 | |
1083 | delete $self->{texture}; |
1154 | delete $self->{texture}; |
|
|
1155 | $self->check_size; |
1084 | $self->update; |
1156 | $self->update; |
1085 | } |
1157 | } |
1086 | |
1158 | |
1087 | sub size_request { |
1159 | sub size_request { |
1088 | my ($self) = @_; |
1160 | my ($self) = @_; |
1089 | |
1161 | |
1090 | $self->{layout}->set_width; |
1162 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
|
|
1163 | $self->{layout}->set_width ($self->{max_w} || -1); |
1091 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1164 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1092 | |
1165 | |
1093 | my ($w, $h) = $self->{layout}->size; |
1166 | my ($w, $h) = $self->{layout}->size; |
1094 | |
1167 | |
1095 | if (exists $self->{template}) { |
1168 | if (exists $self->{template}) { |
|
|
1169 | $self->{template}->set_font ($self->{font}) if $self->{font}; |
1096 | $self->{template}->set_height ($self->{fontsize} * $::FONTSIZE); |
1170 | $self->{template}->set_height ($self->{fontsize} * $::FONTSIZE); |
1097 | |
1171 | |
1098 | my ($w2, $h2) = $self->{template}->size; |
1172 | my ($w2, $h2) = $self->{template}->size; |
1099 | |
1173 | |
1100 | $w = List::Util::max $w, $w2; |
1174 | $w = List::Util::max $w, $w2; |
… | |
… | |
1115 | |
1189 | |
1116 | sub set_fontsize { |
1190 | sub set_fontsize { |
1117 | my ($self, $fontsize) = @_; |
1191 | my ($self, $fontsize) = @_; |
1118 | |
1192 | |
1119 | $self->{fontsize} = $fontsize; |
1193 | $self->{fontsize} = $fontsize; |
|
|
1194 | delete $self->{texture}; |
|
|
1195 | $self->check_size; |
1120 | $self->update; |
1196 | $self->update; |
1121 | } |
1197 | } |
1122 | |
1198 | |
1123 | sub _draw { |
1199 | sub _draw { |
1124 | my ($self) = @_; |
1200 | my ($self) = @_; |
1125 | |
1201 | |
1126 | my $tex = $self->{texture} ||= do { |
1202 | my $tex = $self->{texture} ||= do { |
|
|
1203 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
1127 | $self->{layout}->set_width ($self->{w}); |
1204 | $self->{layout}->set_width ($self->{w}); |
1128 | $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize} * $::FONTSIZE); |
1205 | $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize} * $::FONTSIZE); |
1129 | new_from_layout CFClient::Texture $self->{layout} |
1206 | new_from_layout CFClient::Texture $self->{layout} |
1130 | }; |
1207 | }; |
1131 | |
1208 | |
… | |
… | |
1171 | active_bg => [1, 1, 1, 0.5], |
1248 | active_bg => [1, 1, 1, 0.5], |
1172 | active_fg => [0, 0, 0], |
1249 | active_fg => [0, 0, 0], |
1173 | can_hover => 1, |
1250 | can_hover => 1, |
1174 | can_focus => 1, |
1251 | can_focus => 1, |
1175 | valign => 0, |
1252 | valign => 0, |
|
|
1253 | can_events => 1, |
1176 | @_ |
1254 | @_ |
1177 | ) |
1255 | ) |
1178 | } |
1256 | } |
1179 | |
1257 | |
1180 | sub _set_text { |
1258 | sub _set_text { |
… | |
… | |
1208 | } |
1286 | } |
1209 | |
1287 | |
1210 | sub size_allocate { |
1288 | sub size_allocate { |
1211 | my ($self, $w, $h) = @_; |
1289 | my ($self, $w, $h) = @_; |
1212 | |
1290 | |
1213 | $self->_set_text ($self->{text}); |
1291 | $self->_set_text (delete $self->{text});#d# don't check for == inside _set_text |
1214 | } |
1292 | } |
1215 | |
1293 | |
1216 | sub set_text { |
1294 | sub set_text { |
1217 | my ($self, $text) = @_; |
1295 | my ($self, $text) = @_; |
1218 | |
1296 | |
… | |
… | |
1365 | bg => [1, 1, 1, 0.2], |
1443 | bg => [1, 1, 1, 0.2], |
1366 | active_fg => [0, 0, 1], |
1444 | active_fg => [0, 0, 1], |
1367 | can_hover => 1, |
1445 | can_hover => 1, |
1368 | align => 0, |
1446 | align => 0, |
1369 | valign => 0, |
1447 | valign => 0, |
|
|
1448 | can_events => 1, |
1370 | @_ |
1449 | @_ |
1371 | ) |
1450 | ) |
1372 | } |
1451 | } |
1373 | |
1452 | |
1374 | sub button_up { |
1453 | sub button_up { |
… | |
… | |
1479 | our %loaded_images; |
1558 | our %loaded_images; |
1480 | |
1559 | |
1481 | sub new { |
1560 | sub new { |
1482 | my $class = shift; |
1561 | my $class = shift; |
1483 | |
1562 | |
1484 | my $self = $class->SUPER::new (@_); |
1563 | my $self = $class->SUPER::new (can_events => 0, @_); |
1485 | |
1564 | |
1486 | $self->{image} or confess "Image has 'image' not set. This is a fatal error!"; |
1565 | $self->{image} or confess "Image has 'image' not set. This is a fatal error!"; |
1487 | |
1566 | |
1488 | $loaded_images{$self->{image}} ||= |
1567 | $loaded_images{$self->{image}} ||= |
1489 | new_from_file CFClient::Texture CFClient::find_rcfile $self->{image}, mipmap => 1; |
1568 | new_from_file CFClient::Texture CFClient::find_rcfile $self->{image}, mipmap => 1; |
1490 | |
1569 | |
1491 | my $tex = $self->{tex} = $loaded_images{$self->{image}}; |
1570 | my $tex = $self->{tex} = $loaded_images{$self->{image}}; |
|
|
1571 | |
|
|
1572 | Scalar::Util::weaken $loaded_images{$self->{image}}; |
1492 | |
1573 | |
1493 | $self->{aspect} = $tex->{w} / $tex->{h}; |
1574 | $self->{aspect} = $tex->{w} / $tex->{h}; |
1494 | |
1575 | |
1495 | $self |
1576 | $self |
1496 | } |
1577 | } |
… | |
… | |
1529 | ############################################################################# |
1610 | ############################################################################# |
1530 | |
1611 | |
1531 | package CFClient::UI::VGauge; |
1612 | package CFClient::UI::VGauge; |
1532 | |
1613 | |
1533 | our @ISA = CFClient::UI::Base::; |
1614 | our @ISA = CFClient::UI::Base::; |
|
|
1615 | |
|
|
1616 | use List::Util qw(min max); |
1534 | |
1617 | |
1535 | use CFClient::OpenGL; |
1618 | use CFClient::OpenGL; |
1536 | |
1619 | |
1537 | my %tex = ( |
1620 | my %tex = ( |
1538 | food => [ |
1621 | food => [ |
1539 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1622 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1540 | qw/g1_food_gauge_empty.png g1_food_gauge_full.png/ |
1623 | qw/g1_food_gauge_empty.png g1_food_gauge_full.png/ |
1541 | ], |
1624 | ], |
1542 | grace => [ |
1625 | grace => [ |
1543 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1626 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1544 | qw/g1_grace_gauge_empty.png g1_grace_gauge_full.png/ |
1627 | qw/g1_grace_gauge_empty.png g1_grace_gauge_full.png g1_grace_gauge_overflow.png/ |
1545 | ], |
1628 | ], |
1546 | hp => [ |
1629 | hp => [ |
1547 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1630 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1548 | qw/g1_hp_gauge_empty.png g1_hp_gauge_full.png/ |
1631 | qw/g1_hp_gauge_empty.png g1_hp_gauge_full.png/ |
1549 | ], |
1632 | ], |
1550 | mana => [ |
1633 | mana => [ |
1551 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1634 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1552 | qw/g1_mana_gauge_empty.png g1_mana_gauge_full.png/ |
1635 | qw/g1_mana_gauge_empty.png g1_mana_gauge_full.png g1_mana_gauge_overflow.png/ |
1553 | ], |
1636 | ], |
1554 | ); |
1637 | ); |
1555 | |
1638 | |
1556 | # eg. VGauge->new (gauge => 'food'), default gauge: food |
1639 | # eg. VGauge->new (gauge => 'food'), default gauge: food |
1557 | sub new { |
1640 | sub new { |
… | |
… | |
1595 | |
1678 | |
1596 | sub _draw { |
1679 | sub _draw { |
1597 | my ($self) = @_; |
1680 | my ($self) = @_; |
1598 | |
1681 | |
1599 | my $tex = $tex{$self->{type}}; |
1682 | my $tex = $tex{$self->{type}}; |
|
|
1683 | my ($t1, $t2, $t3) = @$tex; |
1600 | |
1684 | |
1601 | my ($w, $h) = ($self->{w}, $self->{h}); |
1685 | my ($w, $h) = ($self->{w}, $self->{h}); |
1602 | |
1686 | |
1603 | if ($self->{vertical}) { |
1687 | if ($self->{vertical}) { |
1604 | glRotate 90, 0, 0, 1; |
1688 | glRotate 90, 0, 0, 1; |
… | |
… | |
1606 | |
1690 | |
1607 | ($w, $h) = ($h, $w); |
1691 | ($w, $h) = ($h, $w); |
1608 | } |
1692 | } |
1609 | |
1693 | |
1610 | my $ycut = $self->{val} / ($self->{max_val} || 1); |
1694 | my $ycut = $self->{val} / ($self->{max_val} || 1); |
1611 | $ycut = 1 if $self->{val} > $self->{max_val}; |
|
|
1612 | |
1695 | |
1613 | my $t1 = $tex->[0]; |
1696 | my $ycut1 = max 0, min 1, $ycut; |
1614 | my $t2 = $tex->[1]; |
1697 | my $ycut2 = max 0, min 1, $ycut - 1; |
|
|
1698 | |
|
|
1699 | my $h1 = $self->{h} * (1 - $ycut1); |
|
|
1700 | my $h2 = $self->{h} * (1 - $ycut2); |
1615 | |
1701 | |
1616 | glEnable GL_BLEND; |
1702 | glEnable GL_BLEND; |
1617 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
1703 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
1618 | glEnable GL_TEXTURE_2D; |
1704 | glEnable GL_TEXTURE_2D; |
1619 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1705 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1620 | |
1706 | |
1621 | my $h1 = $self->{h} - $ycut * $self->{h}; |
|
|
1622 | my $h2 = $ycut * $self->{h}; |
|
|
1623 | |
|
|
1624 | glBindTexture GL_TEXTURE_2D, $t1->{name}; |
1707 | glBindTexture GL_TEXTURE_2D, $t1->{name}; |
1625 | glBegin GL_QUADS; |
1708 | glBegin GL_QUADS; |
1626 | glTexCoord 0 , 0; glVertex 0 , 0; |
1709 | glTexCoord 0 , 0; glVertex 0 , 0; |
1627 | glTexCoord 0 , $t1->{t} * (1 - $ycut); glVertex 0 , $h1; |
1710 | glTexCoord 0 , $t1->{t} * (1 - $ycut1); glVertex 0 , $h1; |
1628 | glTexCoord $t1->{s}, $t1->{t} * (1 - $ycut); glVertex $w, $h1; |
1711 | glTexCoord $t1->{s}, $t1->{t} * (1 - $ycut1); glVertex $w, $h1; |
1629 | glTexCoord $t1->{s}, 0; glVertex $w, 0; |
1712 | glTexCoord $t1->{s}, 0; glVertex $w, 0; |
1630 | glEnd; |
1713 | glEnd; |
1631 | |
1714 | |
|
|
1715 | my $ycut1 = List::Util::min 1, $ycut; |
1632 | glBindTexture GL_TEXTURE_2D, $t2->{name}; |
1716 | glBindTexture GL_TEXTURE_2D, $t2->{name}; |
1633 | glBegin GL_QUADS; |
1717 | glBegin GL_QUADS; |
1634 | glTexCoord 0 , $t2->{t} * (1 - $ycut); glVertex 0 , $h1; |
1718 | glTexCoord 0 , $t2->{t} * (1 - $ycut1); glVertex 0 , $h1; |
1635 | glTexCoord 0 , $t2->{t}; glVertex 0 , $h1 + $h2; |
1719 | glTexCoord 0 , $t2->{t} * (1 - $ycut2); glVertex 0 , $h2; |
1636 | glTexCoord $t2->{s}, $t2->{t}; glVertex $w, $h1 + $h2; |
1720 | glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut2); glVertex $w, $h2; |
1637 | glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut); glVertex $w, $h1; |
1721 | glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut1); glVertex $w, $h1; |
1638 | glEnd; |
1722 | glEnd; |
|
|
1723 | |
|
|
1724 | if ($t3) { |
|
|
1725 | glBindTexture GL_TEXTURE_2D, $t3->{name}; |
|
|
1726 | glBegin GL_QUADS; |
|
|
1727 | glTexCoord 0 , $t3->{t} * (1 - $ycut2); glVertex 0 , $h2; |
|
|
1728 | glTexCoord 0 , $t3->{t}; glVertex 0 , $self->{h}; |
|
|
1729 | glTexCoord $t3->{s}, $t3->{t}; glVertex $w, $self->{h}; |
|
|
1730 | glTexCoord $t3->{s}, $t3->{t} * (1 - $ycut2); glVertex $w, $h2; |
|
|
1731 | glEnd; |
|
|
1732 | } |
1639 | |
1733 | |
1640 | glDisable GL_BLEND; |
1734 | glDisable GL_BLEND; |
1641 | glDisable GL_TEXTURE_2D; |
1735 | glDisable GL_TEXTURE_2D; |
1642 | } |
1736 | } |
1643 | |
1737 | |
… | |
… | |
1646 | package CFClient::UI::Gauge; |
1740 | package CFClient::UI::Gauge; |
1647 | |
1741 | |
1648 | our @ISA = CFClient::UI::VBox::; |
1742 | our @ISA = CFClient::UI::VBox::; |
1649 | |
1743 | |
1650 | sub new { |
1744 | sub new { |
1651 | my ($class, %arg) = shift; |
1745 | my ($class, %arg) = @_; |
1652 | |
1746 | |
1653 | my $self = $class->SUPER::new ( |
1747 | my $self = $class->SUPER::new ( |
1654 | @_, |
1748 | tooltip => $arg{type}, |
|
|
1749 | %arg, |
1655 | ); |
1750 | ); |
1656 | |
1751 | |
1657 | $self->add ($self->{value} = new CFClient::UI::Label valign => 1, align => 0, template => "999"); |
1752 | $self->add ($self->{value} = new CFClient::UI::Label valign => +1, align => 0, template => "999", can_events => 1, can_hover => 1); |
1658 | $self->add ($self->{gauge} = new CFClient::UI::VGauge type => $self->{type}, expand => 1); |
1753 | $self->add ($self->{gauge} = new CFClient::UI::VGauge type => $self->{type}, expand => 1, can_events => 1, can_hover => 1); |
1659 | $self->add ($self->{max} = new CFClient::UI::Label valign => 1, align => 0, template => "999"); |
1754 | $self->add ($self->{max} = new CFClient::UI::Label valign => -1, align => 0, template => "999", can_events => 1, can_hover => 1); |
1660 | |
1755 | |
1661 | $self |
1756 | $self |
1662 | } |
1757 | } |
1663 | |
1758 | |
1664 | sub set_fontsize { |
1759 | sub set_fontsize { |
1665 | my ($self, $fsize) = @_; |
1760 | my ($self, $fsize) = @_; |
1666 | |
1761 | |
1667 | $self->{value}->set_fontsize ($fsize); |
1762 | $self->{value}->set_fontsize ($fsize); |
1668 | $self->{max} ->set_fontsize ($fsize); |
1763 | $self->{max} ->set_fontsize ($fsize); |
1669 | $self->update; |
|
|
1670 | } |
1764 | } |
1671 | |
1765 | |
1672 | sub set_value { |
1766 | sub set_value { |
1673 | my ($self, $val, $max) = @_; |
1767 | my ($self, $val, $max) = @_; |
1674 | |
1768 | |
… | |
… | |
1832 | sub new { |
1926 | sub new { |
1833 | my $class = shift; |
1927 | my $class = shift; |
1834 | |
1928 | |
1835 | my $self = $class->SUPER::new ( |
1929 | my $self = $class->SUPER::new ( |
1836 | fontsize => 1, |
1930 | fontsize => 1, |
|
|
1931 | #font => default_font |
1837 | @_, |
1932 | @_, |
1838 | |
1933 | |
1839 | layout => (new CFClient::Layout), |
1934 | layout => (new CFClient::Layout), |
1840 | par => [], |
1935 | par => [], |
1841 | height => 0, |
1936 | height => 0, |
… | |
… | |
1881 | sub size_allocate { |
1976 | sub size_allocate { |
1882 | my ($self, $w, $h) = @_; |
1977 | my ($self, $w, $h) = @_; |
1883 | |
1978 | |
1884 | $self->SUPER::size_allocate ($w, $h); |
1979 | $self->SUPER::size_allocate ($w, $h); |
1885 | |
1980 | |
|
|
1981 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
1886 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1982 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1887 | $self->{layout}->set_width ($self->{children}[0]{w}); |
1983 | $self->{layout}->set_width ($self->{children}[0]{w}); |
1888 | |
1984 | |
1889 | $self->reflow; |
1985 | $self->reflow; |
1890 | } |
1986 | } |
… | |
… | |
1942 | my $y1 = $top + $self->{h}; |
2038 | my $y1 = $top + $self->{h}; |
1943 | |
2039 | |
1944 | my $y = 0; |
2040 | my $y = 0; |
1945 | |
2041 | |
1946 | my $layout = $self->{layout}; |
2042 | my $layout = $self->{layout}; |
|
|
2043 | |
|
|
2044 | $layout->set_font ($self->{font}) if $self->{font}; |
1947 | |
2045 | |
1948 | for my $par (@{$self->{par}}) { |
2046 | for my $par (@{$self->{par}}) { |
1949 | my $h = $par->[0]; |
2047 | my $h = $par->[0]; |
1950 | |
2048 | |
1951 | if ($y0 < $y + $h && $y < $y1) { |
2049 | if ($y0 < $y + $h && $y < $y1) { |
… | |
… | |
2031 | my $class = shift; |
2129 | my $class = shift; |
2032 | |
2130 | |
2033 | my $self = $class->SUPER::new ( |
2131 | my $self = $class->SUPER::new ( |
2034 | state => 0, |
2132 | state => 0, |
2035 | connect_activate => \&toggle_flopper, |
2133 | connect_activate => \&toggle_flopper, |
|
|
2134 | can_events => 1, |
2036 | @_ |
2135 | @_ |
2037 | ); |
2136 | ); |
2038 | |
2137 | |
2039 | if ($self->{state}) { |
2138 | if ($self->{state}) { |
2040 | $self->{state} = 0; |
2139 | $self->{state} = 0; |
… | |
… | |
2060 | $self->emit (changed => $self->{state}); |
2159 | $self->emit (changed => $self->{state}); |
2061 | } |
2160 | } |
2062 | |
2161 | |
2063 | ############################################################################# |
2162 | ############################################################################# |
2064 | |
2163 | |
|
|
2164 | package CFClient::UI::Tooltip; |
|
|
2165 | |
|
|
2166 | our @ISA = CFClient::UI::Bin::; |
|
|
2167 | |
|
|
2168 | use CFClient::OpenGL; |
|
|
2169 | |
|
|
2170 | sub new { |
|
|
2171 | my $class = shift; |
|
|
2172 | |
|
|
2173 | $class->SUPER::new ( |
|
|
2174 | @_, |
|
|
2175 | can_events => 0, |
|
|
2176 | ) |
|
|
2177 | } |
|
|
2178 | |
|
|
2179 | sub set_text { |
|
|
2180 | my ($self, $text) = @_; |
|
|
2181 | |
|
|
2182 | $self->{label} ||= new CFClient::UI::Label fontsize => 0.8, fg => [0, 0, 0]; |
|
|
2183 | $self->{label}->set_text ($text); |
|
|
2184 | $self->add ($self->{label}); |
|
|
2185 | } |
|
|
2186 | |
|
|
2187 | sub size_request { |
|
|
2188 | my ($self) = @_; |
|
|
2189 | |
|
|
2190 | $self->child->set_max_size ($::WIDTH * 0.2); |
|
|
2191 | |
|
|
2192 | my ($w, $h) = @{$self->child}{qw(req_w req_h)}; |
|
|
2193 | |
|
|
2194 | ($w + 4, $h + 4) |
|
|
2195 | } |
|
|
2196 | |
|
|
2197 | sub _draw { |
|
|
2198 | my ($self) = @_; |
|
|
2199 | |
|
|
2200 | glPushMatrix; |
|
|
2201 | glTranslate 0.375, 0.375; |
|
|
2202 | |
|
|
2203 | my ($w, $h) = @$self{qw(w h)}; |
|
|
2204 | |
|
|
2205 | glColor 1, 0.8, 0.4; |
|
|
2206 | glBegin GL_QUADS; |
|
|
2207 | glVertex 0 , 0; |
|
|
2208 | glVertex 0 , $h; |
|
|
2209 | glVertex $w, $h; |
|
|
2210 | glVertex $w, 0; |
|
|
2211 | glEnd; |
|
|
2212 | |
|
|
2213 | glColor 0, 0, 0; |
|
|
2214 | glBegin GL_LINE_LOOP; |
|
|
2215 | glVertex 0 , 0; |
|
|
2216 | glVertex 0 , $h; |
|
|
2217 | glVertex $w, $h; |
|
|
2218 | glVertex $w, 0; |
|
|
2219 | glEnd; |
|
|
2220 | |
|
|
2221 | glPopMatrix; |
|
|
2222 | |
|
|
2223 | glTranslate 2, 2; |
|
|
2224 | $self->SUPER::_draw; |
|
|
2225 | } |
|
|
2226 | |
|
|
2227 | ############################################################################# |
|
|
2228 | |
2065 | package CFClient::UI::Root; |
2229 | package CFClient::UI::Root; |
2066 | |
2230 | |
2067 | our @ISA = CFClient::UI::Container::; |
2231 | our @ISA = CFClient::UI::Container::; |
2068 | |
2232 | |
2069 | use CFClient::OpenGL; |
2233 | use CFClient::OpenGL; |
2070 | |
2234 | |
2071 | sub check_size { |
2235 | sub check_size { |
2072 | my ($self) = @_; |
2236 | my ($self) = @_; |
2073 | |
2237 | |
2074 | $self->configure (0, 0, $::WITH, $::HEIGHT); |
2238 | $self->configure (0, 0, $::WIDTH, $::HEIGHT); |
2075 | } |
2239 | } |
2076 | |
2240 | |
2077 | sub size_request { |
2241 | sub size_request { |
2078 | ($::WIDTH, $::HEIGHT) |
2242 | ($::WIDTH, $::HEIGHT) |
2079 | } |
2243 | } |
… | |
… | |
2081 | sub configure { |
2245 | sub configure { |
2082 | my ($self, $x, $y, $w, $h) = @_; |
2246 | my ($self, $x, $y, $w, $h) = @_; |
2083 | |
2247 | |
2084 | $self->SUPER::configure ($x, $y, $w, $h); |
2248 | $self->SUPER::configure ($x, $y, $w, $h); |
2085 | |
2249 | |
2086 | $_->configure ($_->{x}, $_->{y}, $_->size_request) |
|
|
2087 | for @{$self->{children}}; |
2250 | for my $child (@{$self->{children}}) { |
|
|
2251 | my ($X, $Y, $W, $H) = @$child{qw(x y req_w req_h)}; |
|
|
2252 | |
|
|
2253 | $X = List::Util::max 0, List::Util::min $w - $W, $X; |
|
|
2254 | $Y = List::Util::max 0, List::Util::min $h - $H, $Y; |
|
|
2255 | $child->configure ($X, $Y, $W,$H); |
|
|
2256 | } |
2088 | } |
2257 | } |
2089 | |
2258 | |
2090 | sub _topleft { |
2259 | sub _topleft { |
2091 | my ($self, $x, $y) = @_; |
2260 | my ($self, $x, $y) = @_; |
2092 | |
2261 | |
… | |
… | |
2139 | ############################################################################# |
2308 | ############################################################################# |
2140 | |
2309 | |
2141 | package CFClient::UI; |
2310 | package CFClient::UI; |
2142 | |
2311 | |
2143 | $ROOT = new CFClient::UI::Root; |
2312 | $ROOT = new CFClient::UI::Root; |
|
|
2313 | $TOOLTIP = new CFClient::UI::Tooltip; |
2144 | |
2314 | |
2145 | 1 |
2315 | 1 |
2146 | |
2316 | |