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.320 by root, Tue Jul 4 23:23:32 2006 UTC vs.
Revision 1.323 by root, Wed Jul 5 03:01:01 2006 UTC

1536 #font => default_font 1536 #font => default_font
1537 #text => initial text 1537 #text => initial text
1538 #markup => initial narkup 1538 #markup => initial narkup
1539 #max_w => maximum pixel width 1539 #max_w => maximum pixel width
1540 ellipsise => 3, # end 1540 ellipsise => 3, # end
1541 layout => (new CFClient::Layout 2), 1541 layout => (new CFClient::Layout),
1542 fontsize => 1, 1542 fontsize => 1,
1543 align => -1, 1543 align => -1,
1544 valign => -1, 1544 valign => -1,
1545 padding_x => 2, 1545 padding_x => 2,
1546 padding_y => 2, 1546 padding_y => 2,
1547 can_events => 0, 1547 can_events => 0,
1548 %arg 1548 %arg
1549 ); 1549 );
1550 1550
1551 if (exists $self->{template}) { 1551 if (exists $self->{template}) {
1552 my $layout = new CFClient::Layout 2; 1552 my $layout = new CFClient::Layout;
1553 $layout->set_text (delete $self->{template}); 1553 $layout->set_text (delete $self->{template});
1554 $self->{template} = $layout; 1554 $self->{template} = $layout;
1555 } 1555 }
1556 1556
1557 if (exists $self->{markup}) { 1557 if (exists $self->{markup}) {
1627 1627
1628 my ($w, $h) = $self->{layout}->size; 1628 my ($w, $h) = $self->{layout}->size;
1629 1629
1630 if (exists $self->{template}) { 1630 if (exists $self->{template}) {
1631 $self->{template}->set_font ($self->{font}) if $self->{font}; 1631 $self->{template}->set_font ($self->{font}) if $self->{font};
1632 $self->{template}->set_width ($self->{max_w} || -1);
1632 $self->{template}->set_height ($self->{fontsize} * $::FONTSIZE); 1633 $self->{template}->set_height ($self->{fontsize} * $::FONTSIZE);
1633 1634
1634 my ($w2, $h2) = $self->{template}->size; 1635 my ($w2, $h2) = $self->{template}->size;
1635 1636
1636 $w = List::Util::max $w, $w2; 1637 $w = List::Util::max $w, $w2;
1688 $self->{layout}->set_width ($self->{w}); 1689 $self->{layout}->set_width ($self->{w});
1689 $self->{layout}->set_ellipsise ($self->{ellipsise}); 1690 $self->{layout}->set_ellipsise ($self->{ellipsise});
1690 $self->{layout}->set_single_paragraph_mode ($self->{ellipsise}); 1691 $self->{layout}->set_single_paragraph_mode ($self->{ellipsise});
1691 $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); 1692 $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE);
1692 1693
1693 $self->{size_req} 1694 [$self->{layout}->size]
1694 }; 1695 };
1695 1696
1696 unless (exists $self->{ox}) { 1697 unless (exists $self->{ox}) {
1697 $self->{ox} = int ($self->{align} < 0 ? $self->{padding_x} 1698 $self->{ox} = int ($self->{align} < 0 ? $self->{padding_x}
1698 : $self->{align} > 0 ? $self->{w} - $size->[0] - $self->{padding_x} 1699 : $self->{align} > 0 ? $self->{w} - $size->[0] - $self->{padding_x}
2561 can_events => 0, 2562 can_events => 0,
2562 indent => 0, 2563 indent => 0,
2563 #font => default_font 2564 #font => default_font
2564 @_, 2565 @_,
2565 2566
2566 layout => (new CFClient::Layout 2), 2567 layout => (new CFClient::Layout),
2567 par => [], 2568 par => [],
2568 height => 0, 2569 height => 0,
2569 children => [ 2570 children => [
2570 (new CFClient::UI::Empty expand => 1), 2571 (new CFClient::UI::Empty expand => 1),
2571 (new CFClient::UI::Slider vertical => 1), 2572 (new CFClient::UI::Slider vertical => 1),
3062 for my $item (@{ $self->{items} }) { 3063 for my $item (@{ $self->{items} }) {
3063 my ($widget, $cb, $tooltip) = @$item; 3064 my ($widget, $cb, $tooltip) = @$item;
3064 3065
3065 # handle various types of items, only text for now 3066 # handle various types of items, only text for now
3066 if (!ref $widget) { 3067 if (!ref $widget) {
3068 if ($widget =~ /\t/) {
3069 my ($left, $right) = split /\t/, $widget, 2;
3070
3071 $widget = new CFClient::UI::HBox
3072 can_hover => 1,
3073 can_events => 1,
3074 tooltip => $tooltip,
3075 children => [
3076 (new CFClient::UI::Label markup => $left, expand => 1),
3077 (new CFClient::UI::Label markup => $right, align => +1),
3078 ],
3079 ;
3080
3081 } else {
3067 $widget = new CFClient::UI::Label 3082 $widget = new CFClient::UI::Label
3068 can_hover => 1, 3083 can_hover => 1,
3069 can_events => 1, 3084 can_events => 1,
3070 markup => $widget, 3085 markup => $widget,
3071 tooltip => $tooltip 3086 tooltip => $tooltip;
3087 }
3072 } 3088 }
3073 3089
3074 $self->{item}{$widget} = $item; 3090 $self->{item}{$widget} = $item;
3075 3091
3076 $self->{vbox}->add ($widget); 3092 $self->{vbox}->add ($widget);
3837 ($draw_x, $draw_y, $draw_w, $draw_h) = 3853 ($draw_x, $draw_y, $draw_w, $draw_h) =
3838 (0, 0, $self->{w}, $self->{h}); 3854 (0, 0, $self->{w}, $self->{h});
3839 } 3855 }
3840 3856
3841 $self->_draw; 3857 $self->_draw;
3842
3843 #TODO#d# display texture cache
3844 {
3845 glEnable GL_TEXTURE_2D;
3846 glBindTexture GL_TEXTURE_2D, 41;
3847 glColor 1, 1, 1, 1;
3848 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
3849 glEnable GL_BLEND;
3850 glBlendFunc GL_SRC_ALPHA, GL_ZERO;
3851 glBegin GL_QUADS;
3852 glTexCoord 0,1; glVertex 0,0;
3853 glTexCoord 1,1; glVertex 255,0;
3854 glTexCoord 1,0; glVertex 255,255;
3855 glTexCoord 0,0; glVertex 0,255;
3856 glEnd;
3857 glDisable GL_BLEND;
3858 glDisable GL_TEXTURE_2D;
3859 }
3860
3861} 3858}
3862 3859
3863############################################################################# 3860#############################################################################
3864 3861
3865package CFClient::UI; 3862package CFClient::UI;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines