… | |
… | |
3062 | for my $item (@{ $self->{items} }) { |
3062 | for my $item (@{ $self->{items} }) { |
3063 | my ($widget, $cb, $tooltip) = @$item; |
3063 | my ($widget, $cb, $tooltip) = @$item; |
3064 | |
3064 | |
3065 | # handle various types of items, only text for now |
3065 | # handle various types of items, only text for now |
3066 | if (!ref $widget) { |
3066 | if (!ref $widget) { |
|
|
3067 | if ($widget =~ /\t/) { |
|
|
3068 | my ($left, $right) = split /\t/, $widget, 2; |
|
|
3069 | |
|
|
3070 | $widget = new CFClient::UI::HBox |
|
|
3071 | can_hover => 1, |
|
|
3072 | can_events => 1, |
|
|
3073 | tooltip => $tooltip, |
|
|
3074 | children => [ |
|
|
3075 | (new CFClient::UI::Label markup => $left, expand => 1), |
|
|
3076 | (new CFClient::UI::Label markup => $right, align => +1), |
|
|
3077 | ], |
|
|
3078 | ; |
|
|
3079 | |
|
|
3080 | } else { |
3067 | $widget = new CFClient::UI::Label |
3081 | $widget = new CFClient::UI::Label |
3068 | can_hover => 1, |
3082 | can_hover => 1, |
3069 | can_events => 1, |
3083 | can_events => 1, |
3070 | markup => $widget, |
3084 | markup => $widget, |
3071 | tooltip => $tooltip |
3085 | tooltip => $tooltip; |
|
|
3086 | } |
3072 | } |
3087 | } |
3073 | |
3088 | |
3074 | $self->{item}{$widget} = $item; |
3089 | $self->{item}{$widget} = $item; |
3075 | |
3090 | |
3076 | $self->{vbox}->add ($widget); |
3091 | $self->{vbox}->add ($widget); |
… | |
… | |
3837 | ($draw_x, $draw_y, $draw_w, $draw_h) = |
3852 | ($draw_x, $draw_y, $draw_w, $draw_h) = |
3838 | (0, 0, $self->{w}, $self->{h}); |
3853 | (0, 0, $self->{w}, $self->{h}); |
3839 | } |
3854 | } |
3840 | |
3855 | |
3841 | $self->_draw; |
3856 | $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 | } |
3857 | } |
3862 | |
3858 | |
3863 | ############################################################################# |
3859 | ############################################################################# |
3864 | |
3860 | |
3865 | package CFClient::UI; |
3861 | package CFClient::UI; |