… | |
… | |
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 | |
436 | sub invoke_focus_out { |
435 | sub 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 | |
451 | sub grab_focus { |
450 | sub 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 | |
457 | sub invoke_mouse_motion { 1 } |
457 | sub invoke_mouse_motion { 1 } |
458 | sub invoke_button_up { 1 } |
458 | sub 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 | |
|
|
1160 | sub invoke_delete { |
|
|
1161 | my ($self) = @_; |
|
|
1162 | |
|
|
1163 | $self->hide; |
|
|
1164 | |
1157 | 1 |
1165 | 1 |
1158 | } |
1166 | } |
1159 | |
1167 | |
1160 | sub invoke_button_down { |
1168 | sub invoke_button_down { |
1161 | my ($self, $ev, $x, $y) = @_; |
1169 | my ($self, $ev, $x, $y) = @_; |
… | |
… | |
2247 | my $ycut1 = max 0, min 1, $ycut; |
2255 | my $ycut1 = max 0, min 1, $ycut; |
2248 | my $ycut2 = max 0, min 1, $ycut - 1; |
2256 | my $ycut2 = max 0, min 1, $ycut - 1; |
2249 | |
2257 | |
2250 | my $h1 = $self->{h} * (1 - $ycut1); |
2258 | my $h1 = $self->{h} * (1 - $ycut1); |
2251 | 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); |
2252 | |
2263 | |
2253 | glEnable GL_BLEND; |
2264 | glEnable GL_BLEND; |
2254 | glBlendFuncSeparate GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, |
2265 | glBlendFuncSeparate GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, |
2255 | GL_ONE, GL_ONE_MINUS_SRC_ALPHA; |
2266 | GL_ONE, GL_ONE_MINUS_SRC_ALPHA; |
2256 | glEnable GL_TEXTURE_2D; |
2267 | glEnable GL_TEXTURE_2D; |
… | |
… | |
2275 | |
2286 | |
2276 | if ($t3) { |
2287 | if ($t3) { |
2277 | glBindTexture GL_TEXTURE_2D, $t3->{name}; |
2288 | glBindTexture GL_TEXTURE_2D, $t3->{name}; |
2278 | glBegin GL_QUADS; |
2289 | glBegin GL_QUADS; |
2279 | glTexCoord 0 , $t3->{t} * (1 - $ycut2); glVertex 0 , $h2; |
2290 | glTexCoord 0 , $t3->{t} * (1 - $ycut2); glVertex 0 , $h2; |
2280 | glTexCoord 0 , $t3->{t}; glVertex 0 , $self->{h}; |
2291 | glTexCoord 0 , $t3->{t}; glVertex 0 , $h3; |
2281 | glTexCoord $t3->{s}, $t3->{t}; glVertex $w, $self->{h}; |
2292 | glTexCoord $t3->{s}, $t3->{t}; glVertex $w, $h3; |
2282 | glTexCoord $t3->{s}, $t3->{t} * (1 - $ycut2); glVertex $w, $h2; |
2293 | glTexCoord $t3->{s}, $t3->{t} * (1 - $ycut2); glVertex $w, $h2; |
2283 | glEnd; |
2294 | glEnd; |
2284 | } |
2295 | } |
2285 | |
2296 | |
2286 | glDisable GL_BLEND; |
2297 | glDisable GL_BLEND; |