… | |
… | |
385 | |
385 | |
386 | sub make_gauge_window { |
386 | sub make_gauge_window { |
387 | my $gh = int $HEIGHT * $CFG->{gauge_size}; |
387 | my $gh = int $HEIGHT * $CFG->{gauge_size}; |
388 | |
388 | |
389 | my $win = new CFClient::UI::Frame ( |
389 | my $win = new CFClient::UI::Frame ( |
|
|
390 | req_x => 0, |
390 | req_y => -1, |
391 | req_y => -1, |
391 | user_w => $WIDTH, |
392 | def_w => $WIDTH, |
392 | user_h => $gh, |
393 | def_h => $gh, |
393 | ); |
394 | ); |
394 | |
395 | |
395 | $win->add (my $hbox = new CFClient::UI::HBox |
396 | $win->add (my $hbox = new CFClient::UI::HBox |
396 | children => [ |
397 | children => [ |
397 | (new CFClient::UI::HBox expand => 1), |
398 | (new CFClient::UI::HBox expand => 1), |
… | |
… | |
711 | }); |
712 | }); |
712 | } |
713 | } |
713 | |
714 | |
714 | sub server_setup { |
715 | sub server_setup { |
715 | my $dialog = new CFClient::UI::FancyFrame |
716 | my $dialog = new CFClient::UI::FancyFrame |
716 | x => $WIDTH * (1/3), |
717 | x => $WIDTH * (1/3), |
717 | y => $HEIGHT * (1/8), |
718 | y => $HEIGHT * (1/8), |
718 | name => "server_setup", |
719 | name => "server_setup", |
719 | title => "Server Setup", |
720 | title => "Server Setup", |
720 | child => (my $vbox = new CFClient::UI::VBox), |
721 | child => (my $vbox = new CFClient::UI::VBox), |
721 | on_visibility_change => sub { |
722 | on_visibility_change => sub { |
722 | $_[0]->show_centered if $_[1] |
723 | my ($self, $visible) = @_; |
|
|
724 | $self->center if $visible; |
723 | }; |
725 | }, |
|
|
726 | ; |
724 | |
727 | |
725 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
728 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
726 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
729 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
727 | |
730 | |
728 | { |
731 | { |
… | |
… | |
833 | name => "message_window", |
836 | name => "message_window", |
834 | title => "Messages", |
837 | title => "Messages", |
835 | border_bg => [1, 1, 1, 1], |
838 | border_bg => [1, 1, 1, 1], |
836 | bg => [0, 0, 0, 0.75], |
839 | bg => [0, 0, 0, 0.75], |
837 | req_x => -1, |
840 | req_x => -1, |
|
|
841 | req_y => 0, |
838 | user_w => int $::WIDTH / 3, |
842 | def_w => int $::WIDTH / 3, |
839 | user_h => int $::HEIGHT / 5, |
843 | def_h => int $::HEIGHT / 5, |
840 | child => (my $vbox = new CFClient::UI::VBox); |
844 | child => (my $vbox = new CFClient::UI::VBox); |
841 | |
845 | |
842 | $vbox->add ($LOGVIEW); |
846 | $vbox->add ($LOGVIEW); |
843 | |
847 | |
844 | $vbox->add (my $input = new CFClient::UI::Entry |
848 | $vbox->add (my $input = new CFClient::UI::Entry |
… | |
… | |
884 | $window |
888 | $window |
885 | } |
889 | } |
886 | |
890 | |
887 | sub open_quit_dialog { |
891 | sub open_quit_dialog { |
888 | unless ($QUIT_DIALOG) { |
892 | unless ($QUIT_DIALOG) { |
889 | |
|
|
890 | $QUIT_DIALOG = new CFClient::UI::FancyFrame title => "Really Quit?"; |
893 | $QUIT_DIALOG = new CFClient::UI::FancyFrame title => "Really Quit?"; |
891 | |
894 | |
892 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
895 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
893 | |
896 | |
894 | $vb->add (new CFClient::UI::Label |
897 | $vb->add (new CFClient::UI::Label |
… | |
… | |
905 | $hb->add (new CFClient::UI::Button |
908 | $hb->add (new CFClient::UI::Button |
906 | text => "Quit anyway", |
909 | text => "Quit anyway", |
907 | expand => 1, |
910 | expand => 1, |
908 | on_activate => sub { exit }, |
911 | on_activate => sub { exit }, |
909 | ); |
912 | ); |
|
|
913 | } |
910 | |
914 | |
|
|
915 | $QUIT_DIALOG->show; |
911 | $QUIT_DIALOG->show_centered; |
916 | $QUIT_DIALOG->center; |
912 | } else { |
|
|
913 | $QUIT_DIALOG->show_centered; |
|
|
914 | } |
|
|
915 | } |
917 | } |
916 | |
918 | |
917 | sub make_inventory_window { |
919 | sub make_inventory_window { |
918 | my $invwin = new CFClient::UI::FancyFrame |
920 | my $invwin = new CFClient::UI::FancyFrame |
919 | user_w => $WIDTH * (7/8), |
921 | def_w => $WIDTH * 7/8, |
920 | user_h => $HEIGHT * (7/8), |
922 | def_h => $HEIGHT * 7/8, |
921 | title => "Inventory", |
923 | title => "Inventory", |
922 | name => "inventory_window", |
924 | name => "inventory_window", |
923 | on_visibility_change => sub { |
925 | on_visibility_change => sub { |
924 | $_[0]->show_centered if $_[1] |
926 | my ($self, $visible) = @_; |
|
|
927 | $self->center if $visible; |
925 | }; |
928 | }, |
|
|
929 | ; |
926 | |
930 | |
927 | $invwin->add (my $hb = new CFClient::UI::HBox expand => 1); |
931 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
928 | |
932 | |
929 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
933 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
930 | $vb1->add (my $lbl = new CFClient::UI::Label align => 0); |
934 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
931 | $lbl->set_text ("Player"); |
|
|
932 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
935 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
933 | |
936 | |
934 | $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1); |
937 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
935 | |
938 | |
936 | $vb2->add (my $hb2 = new CFClient::UI::HBox); |
939 | $vb2->add (my $hb2 = new CFClient::UI::HBox); |
937 | $hb2->add ($INVR_LBL = new CFClient::UI::Label align => 0, expand => 1); |
940 | $hb2->add ($INVR_LBL = new CFClient::UI::Label align => 0, expand => 1, text => "Floor"); |
938 | $hb2->add (new CFClient::UI::Button |
941 | $hb2->add (new CFClient::UI::Button |
939 | text => "Close", |
942 | text => "Close", |
940 | tooltip => "Close the currently open container (if one is open)", |
943 | tooltip => "Close the currently open container (if one is open)", |
941 | on_activate => sub { |
944 | on_activate => sub { |
942 | $CONN->send ("apply $CONN->{open_container}") |
945 | $CONN->send ("apply $CONN->{open_container}") |
943 | if $CONN->{open_container} != 0; |
946 | if $CONN->{open_container} != 0; |
944 | }, |
947 | }, |
945 | ); |
948 | ); |
946 | |
949 | |
947 | $INVR_LBL->set_text ("Floor"); |
|
|
948 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
950 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
949 | |
951 | |
950 | $invwin |
952 | $invwin |
951 | } |
953 | } |
952 | |
954 | |
953 | sub make_help_window { |
955 | sub make_help_window { |
954 | my $win = new CFClient::UI::FancyFrame |
956 | my $win = new CFClient::UI::FancyFrame |
955 | user_w => $WIDTH * (7/8), user_h => $HEIGHT * (7/8), title => "Documentation"; |
957 | def_w => int $WIDTH * 7/8, |
|
|
958 | def_h => int $HEIGHT * 7/8, |
|
|
959 | title => "Documentation"; |
956 | |
960 | |
957 | $win->add (my $vbox = new CFClient::UI::VBox); |
961 | $win->add (my $vbox = new CFClient::UI::VBox); |
958 | |
962 | |
959 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
963 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
960 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
964 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |