… | |
… | |
273 | $self->emit ("destroy"); |
273 | $self->emit ("destroy"); |
274 | %$self = (); |
274 | %$self = (); |
275 | } |
275 | } |
276 | |
276 | |
277 | sub TO_JSON { |
277 | sub TO_JSON { |
278 | { __widget_ref__ => $_[0]{s_id} } |
278 | { __w_ => $_[0]{s_id} } |
279 | } |
279 | } |
280 | |
280 | |
281 | sub show { |
281 | sub show { |
282 | my ($self) = @_; |
282 | my ($self) = @_; |
283 | |
283 | |
… | |
… | |
2074 | my $class = shift; |
2074 | my $class = shift; |
2075 | |
2075 | |
2076 | $class->SUPER::new ( |
2076 | $class->SUPER::new ( |
2077 | fg => [1, 1, 1], |
2077 | fg => [1, 1, 1], |
2078 | bg => [0, 0, 0, 0.2], |
2078 | bg => [0, 0, 0, 0.2], |
2079 | active_bg => [1, 1, 1, 0.5], |
2079 | active_bg => [0, 0, 1, .2], |
2080 | active_fg => [0, 0, 0], |
2080 | active_fg => [1, 1, 1], |
|
|
2081 | active_outline => [1, 1, 0], |
2081 | can_hover => 1, |
2082 | can_hover => 1, |
2082 | can_focus => 1, |
2083 | can_focus => 1, |
2083 | valign => 0, |
2084 | valign => 0, |
2084 | can_events => 1, |
2085 | can_events => 1, |
2085 | ellipsise => 0, |
2086 | ellipsise => 0, |
… | |
… | |
2242 | |
2243 | |
2243 | unless (exists $self->{cur_h}) { |
2244 | unless (exists $self->{cur_h}) { |
2244 | my $text = substr $self->{text}, 0, $self->{cursor}; |
2245 | my $text = substr $self->{text}, 0, $self->{cursor}; |
2245 | utf8::encode $text; |
2246 | utf8::encode $text; |
2246 | |
2247 | |
2247 | @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text) |
2248 | @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text); |
2248 | } |
2249 | } |
2249 | |
2250 | |
|
|
2251 | glColor_premultiply @{$self->{active_fg}}; |
2250 | glBegin GL_LINES; |
2252 | glBegin GL_LINES; |
2251 | glVertex 0.5 + $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy}; |
2253 | glVertex 0.5 + $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy}; |
2252 | glVertex 0.5 + $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy} + $self->{cur_h}; |
2254 | glVertex 0.5 + $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy} + $self->{cur_h}; |
2253 | glEnd; |
2255 | glEnd; |
|
|
2256 | |
|
|
2257 | glLineWidth 3; |
|
|
2258 | glColor @{$self->{active_outline}}; |
|
|
2259 | glTranslate -.375, -.375; |
|
|
2260 | glBegin GL_LINE_LOOP; |
|
|
2261 | glVertex 0, 0; |
|
|
2262 | glVertex $self->{w}, 0; |
|
|
2263 | glVertex $self->{w}, $self->{h}; |
|
|
2264 | glVertex 0, $self->{h}; |
|
|
2265 | glEnd; |
|
|
2266 | glLineWidth 1; |
2254 | } |
2267 | } |
2255 | } |
2268 | } |
2256 | |
2269 | |
2257 | ############################################################################# |
2270 | ############################################################################# |
2258 | |
2271 | |
… | |
… | |
3768 | buttonbar => (new CFPlus::UI::Buttonbar), |
3781 | buttonbar => (new CFPlus::UI::Buttonbar), |
3769 | multiplexer => (new CFPlus::UI::Multiplexer expand => 1), |
3782 | multiplexer => (new CFPlus::UI::Multiplexer expand => 1), |
3770 | # filter => # will be put between multiplexer and $self |
3783 | # filter => # will be put between multiplexer and $self |
3771 | @_, |
3784 | @_, |
3772 | ); |
3785 | ); |
3773 | |
3786 | |
3774 | $self->{filter}->add ($self->{multiplexer}) if $self->{filter}; |
3787 | $self->{filter}->add ($self->{multiplexer}) if $self->{filter}; |
3775 | $self->SUPER::add ($self->{buttonbar}, $self->{filter} || $self->{multiplexer}); |
3788 | $self->SUPER::add ($self->{buttonbar}, $self->{filter} || $self->{multiplexer}); |
3776 | |
3789 | |
3777 | { |
3790 | { |
3778 | Scalar::Util::weaken (my $wself = $self); |
3791 | Scalar::Util::weaken (my $wself = $self); |
… | |
… | |
3819 | |
3832 | |
3820 | sub remove { |
3833 | sub remove { |
3821 | my ($self, @widgets) = @_; |
3834 | my ($self, @widgets) = @_; |
3822 | |
3835 | |
3823 | $self->{multiplexer}->remove (@widgets) |
3836 | $self->{multiplexer}->remove (@widgets) |
|
|
3837 | } |
|
|
3838 | |
|
|
3839 | sub pages { |
|
|
3840 | my ($self) = @_; |
|
|
3841 | $self->{multiplexer}->children |
3824 | } |
3842 | } |
3825 | |
3843 | |
3826 | sub add_tab { |
3844 | sub add_tab { |
3827 | my ($self, $title, $widget, $tooltip) = @_; |
3845 | my ($self, $title, $widget, $tooltip) = @_; |
3828 | |
3846 | |