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.314 by root, Mon Jun 26 21:59:04 2006 UTC vs.
Revision 1.317 by root, Sun Jul 2 18:52:05 2006 UTC

423 my ($self) = @_; 423 my ($self) = @_;
424 424
425 return if $FOCUS == $self; 425 return if $FOCUS == $self;
426 return unless $self->{can_focus}; 426 return unless $self->{can_focus};
427 427
428 my $focus = $FOCUS; $FOCUS = $self; 428 $FOCUS = $self;
429 429
430 $focus->update if $focus; 430 $self->update;
431 $FOCUS->update;
432 431
433 0 432 0
434} 433}
435 434
436sub invoke_focus_out { 435sub invoke_focus_out {
437 my ($self) = @_; 436 my ($self) = @_;
438 437
439 return unless $FOCUS == $self; 438 return unless $FOCUS == $self;
440 439
441 my $focus = $FOCUS; undef $FOCUS; 440 undef $FOCUS;
442 441
443 $focus->update if $focus; #? 442 $self->update;
444 443
445 $::MAPWIDGET->grab_focus #d# focus mapwidget if no other widget has focus 444 $::MAPWIDGET->grab_focus #d# focus mapwidget if no other widget has focus
446 unless $FOCUS; 445 unless $FOCUS;
447 446
448 0 447 0
449} 448}
450 449
451sub grab_focus { 450sub grab_focus {
452 my ($self) = @_; 451 my ($self) = @_;
453 452
453 $FOCUS->emit ("focus_out") if $FOCUS;
454 $self->emit ("focus_in"); 454 $self->emit ("focus_in");
455} 455}
456 456
457sub invoke_mouse_motion { 1 } 457sub invoke_mouse_motion { 1 }
458sub invoke_button_up { 1 } 458sub invoke_button_up { 1 }
1096 1096
1097 if ($self->{has_close_button}) { 1097 if ($self->{has_close_button}) {
1098 $self->{close_button} = 1098 $self->{close_button} =
1099 new CFClient::UI::ImageButton 1099 new CFClient::UI::ImageButton
1100 path => 'x1_close.png', 1100 path => 'x1_close.png',
1101 on_activate => sub { $self->hide }; 1101 on_activate => sub { $self->emit ("delete") };
1102 1102
1103 $self->CFClient::UI::Container::add ($self->{close_button}); 1103 $self->CFClient::UI::Container::add ($self->{close_button});
1104 } 1104 }
1105 1105
1106 $self 1106 $self
1152 $self->child->configure ($border, $border, $w, $h); 1152 $self->child->configure ($border, $border, $w, $h);
1153 1153
1154 $self->{close_button}->configure ($self->{w} - $border, 0, $border, $border) 1154 $self->{close_button}->configure ($self->{w} - $border, 0, $border, $border)
1155 if $self->{close_button}; 1155 if $self->{close_button};
1156 1156
1157 1
1158}
1159
1160sub invoke_delete {
1161 my ($self) = @_;
1162
1163 $self->hide;
1164
1157 1 1165 1
1158} 1166}
1159 1167
1160sub invoke_button_down { 1168sub invoke_button_down {
1161 my ($self, $ev, $x, $y) = @_; 1169 my ($self, $ev, $x, $y) = @_;
1654 1662
1655sub set_fontsize { 1663sub set_fontsize {
1656 my ($self, $fontsize) = @_; 1664 my ($self, $fontsize) = @_;
1657 1665
1658 $self->{fontsize} = $fontsize; 1666 $self->{fontsize} = $fontsize;
1667 delete $self->{size_req};
1659 delete $self->{texture}; 1668 delete $self->{texture};
1660 1669
1661 $self->realloc; 1670 $self->realloc;
1662} 1671}
1663 1672
2246 my $ycut1 = max 0, min 1, $ycut; 2255 my $ycut1 = max 0, min 1, $ycut;
2247 my $ycut2 = max 0, min 1, $ycut - 1; 2256 my $ycut2 = max 0, min 1, $ycut - 1;
2248 2257
2249 my $h1 = $self->{h} * (1 - $ycut1); 2258 my $h1 = $self->{h} * (1 - $ycut1);
2250 my $h2 = $self->{h} * (1 - $ycut2); 2259 my $h2 = $self->{h} * (1 - $ycut2);
2260 my $h3 = $self->{h};
2261
2262 $_ = $_ * (284-4)/288 + 4/288 for ($h1, $h2, $h3);
2251 2263
2252 glEnable GL_BLEND; 2264 glEnable GL_BLEND;
2253 glBlendFuncSeparate GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 2265 glBlendFuncSeparate GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
2254 GL_ONE, GL_ONE_MINUS_SRC_ALPHA; 2266 GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
2255 glEnable GL_TEXTURE_2D; 2267 glEnable GL_TEXTURE_2D;
2274 2286
2275 if ($t3) { 2287 if ($t3) {
2276 glBindTexture GL_TEXTURE_2D, $t3->{name}; 2288 glBindTexture GL_TEXTURE_2D, $t3->{name};
2277 glBegin GL_QUADS; 2289 glBegin GL_QUADS;
2278 glTexCoord 0 , $t3->{t} * (1 - $ycut2); glVertex 0 , $h2; 2290 glTexCoord 0 , $t3->{t} * (1 - $ycut2); glVertex 0 , $h2;
2279 glTexCoord 0 , $t3->{t}; glVertex 0 , $self->{h}; 2291 glTexCoord 0 , $t3->{t}; glVertex 0 , $h3;
2280 glTexCoord $t3->{s}, $t3->{t}; glVertex $w, $self->{h}; 2292 glTexCoord $t3->{s}, $t3->{t}; glVertex $w, $h3;
2281 glTexCoord $t3->{s}, $t3->{t} * (1 - $ycut2); glVertex $w, $h2; 2293 glTexCoord $t3->{s}, $t3->{t} * (1 - $ycut2); glVertex $w, $h2;
2282 glEnd; 2294 glEnd;
2283 } 2295 }
2284 2296
2285 glDisable GL_BLEND; 2297 glDisable GL_BLEND;
3410 count => 1, 3422 count => 1,
3411 %arg, 3423 %arg,
3412 }; 3424 };
3413 } 3425 }
3414 3426
3427 $ROOT->on_refresh (reorder => sub {
3415 $self->reorder; 3428 $self->reorder;
3429 });
3416} 3430}
3417 3431
3418sub reconfigure { 3432sub reconfigure {
3419 my ($self) = @_; 3433 my ($self) = @_;
3420 3434
3457 return unless $items; 3471 return unless $items;
3458 3472
3459 my @items = sort { 3473 my @items = sort {
3460 ($a->{type} <=> $b->{type}) 3474 ($a->{type} <=> $b->{type})
3461 or ($a->{name} cmp $b->{name}) 3475 or ($a->{name} cmp $b->{name})
3462 } @$items; 3476 } values %$items;
3463 3477
3464 $self->{real_items} = \@items; 3478 $self->{real_items} = \@items;
3465 3479
3466 my $row = 0; 3480 my $row = 0;
3467 for my $item (@items) { 3481 for my $item (@items) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines