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.336 by root, Sun Jul 23 16:46:06 2006 UTC vs.
Revision 1.339 by root, Sun Jul 30 12:15:19 2006 UTC

96 96
97sub feed_sdl_button_down_event { 97sub feed_sdl_button_down_event {
98 my ($ev) = @_; 98 my ($ev) = @_;
99 my ($x, $y) = ($ev->{x}, $ev->{y}); 99 my ($x, $y) = ($ev->{x}, $ev->{y});
100 100
101 unless ($BUTTON_STATE) { 101 $BUTTON_STATE |= 1 << ($ev->{button} - 1);
102
103 unless ($GRAB) {
102 my $widget = $ROOT->find_widget ($x, $y); 104 my $widget = $ROOT->find_widget ($x, $y);
103 105
104 $GRAB = $widget; 106 $GRAB = $widget;
105 $GRAB->update if $GRAB; 107 $GRAB->update if $GRAB;
106 108
107 $TOOLTIP_WATCHER->cb->(); 109 $TOOLTIP_WATCHER->cb->();
108 } 110 }
109
110 $BUTTON_STATE |= 1 << ($ev->{button} - 1);
111 111
112 if ($GRAB) { 112 if ($GRAB) {
113 if ($ev->{button} == 4 || $ev->{button} == 5) { 113 if ($ev->{button} == 4 || $ev->{button} == 5) {
114 # mousewheel 114 # mousewheel
115 $ev->{dx} = 0; 115 $ev->{dx} = 0;
1294 my ($self, $ev, $x, $y) = @_; 1294 my ($self, $ev, $x, $y) = @_;
1295 1295
1296 $self->{motion}->($ev, $x, $y) if $self->{motion}; 1296 $self->{motion}->($ev, $x, $y) if $self->{motion};
1297 1297
1298 ! ! $self->{motion} 1298 ! ! $self->{motion}
1299}
1300
1301sub invoke_visibility_change {
1302 my ($self, $visible) = @_;
1303
1304 delete $self->{motion} unless $visible;
1305
1306 0
1299} 1307}
1300 1308
1301sub _draw { 1309sub _draw {
1302 my ($self) = @_; 1310 my ($self) = @_;
1303 1311
2755 $self->{height} = 0; 2763 $self->{height} = 0;
2756 $self->{children}[1]->set_range ([0, 0, 0, 1, 1]); 2764 $self->{children}[1]->set_range ([0, 0, 0, 1, 1]);
2757} 2765}
2758 2766
2759sub add_paragraph { 2767sub add_paragraph {
2760 my ($self, $color, $para, $indent) = @_; 2768 my $self = shift;
2761 2769
2762 my ($text, @w) = ref $para ? @$para : $para; 2770 for my $para (@_) {
2763
2764 $para = { 2771 $para = {
2772 fg => [1, 1, 1, 1],
2773 indent => 0,
2774 markup => "",
2775 widget => [],
2776 ref $para ? %$para : (markup => $para),
2765 w => 1e10, 2777 w => 1e10,
2766 wrapped => 1, 2778 wrapped => 1,
2767 fg => $color,
2768 indent => $indent,
2769 markup => $text,
2770 widget => \@w,
2771 }; 2779 };
2772 2780
2773 $self->add (@w) if @w; 2781 $self->add (@{ $para->{widget} }) if @{ $para->{widget} };
2774 push @{$self->{par}}, $para; 2782 push @{$self->{par}}, $para;
2783 }
2775 2784
2776 $self->{need_reflow}++; 2785 $self->{need_reflow}++;
2777 $self->update; 2786 $self->update;
2778} 2787}
2779 2788
3058 3067
3059############################################################################# 3068#############################################################################
3060 3069
3061package CFClient::UI::Face; 3070package CFClient::UI::Face;
3062 3071
3063our @ISA = CFClient::UI::Base::; 3072our @ISA = CFClient::UI::DrawBG::;
3064 3073
3065use CFClient::OpenGL; 3074use CFClient::OpenGL;
3066 3075
3067sub new { 3076sub new {
3068 my $class = shift; 3077 my $class = shift;
3104 3113
3105sub _draw { 3114sub _draw {
3106 my ($self) = @_; 3115 my ($self) = @_;
3107 3116
3108 return unless $::CONN; 3117 return unless $::CONN;
3118
3119 $self->SUPER::_draw;
3109 3120
3110 my $face; 3121 my $face;
3111 3122
3112 if ($self->{frame}) { 3123 if ($self->{frame}) {
3113 my $anim = $::CONN->{anim}[$self->{anim}]; 3124 my $anim = $::CONN->{anim}[$self->{anim}];
3360 $self->emit (page_changed => $self->{multiplexer}{current}); 3371 $self->emit (page_changed => $self->{multiplexer}{current});
3361} 3372}
3362 3373
3363############################################################################# 3374#############################################################################
3364 3375
3365package CFClient::UI::Combobox; 3376package CFClient::UI::Selector;
3366 3377
3367use utf8; 3378use utf8;
3368 3379
3369our @ISA = CFClient::UI::Button::; 3380our @ISA = CFClient::UI::Button::;
3370 3381
3940 $h = 0 if $h < 0; 3951 $h = 0 if $h < 0;
3941 3952
3942 $w = max $widget->{min_w}, $w; 3953 $w = max $widget->{min_w}, $w;
3943 $h = max $widget->{min_h}, $h; 3954 $h = max $widget->{min_h}, $h;
3944 3955
3956# $w = min $self->{w} - $widget->{x}, $w if $self->{w};
3957# $h = min $self->{h} - $widget->{y}, $h if $self->{h};
3958
3945 $w = min $widget->{max_w}, $w if exists $widget->{max_w}; 3959 $w = min $widget->{max_w}, $w if exists $widget->{max_w};
3946 $h = min $widget->{max_h}, $h if exists $widget->{max_h}; 3960 $h = min $widget->{max_h}, $h if exists $widget->{max_h};
3947 3961
3948 $w = int $w + 0.5; 3962 $w = int $w + 0.5;
3949 $h = int $h + 0.5; 3963 $h = int $h + 0.5;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines