… | |
… | |
177 | unless $BUTTONBAR->{children}[1]->{state}; |
177 | unless $BUTTONBAR->{children}[1]->{state}; |
178 | } |
178 | } |
179 | |
179 | |
180 | sub client_setup { |
180 | sub client_setup { |
181 | my $dialog = new CFClient::UI::FancyFrame |
181 | my $dialog = new CFClient::UI::FancyFrame |
|
|
182 | req_x => 1, |
|
|
183 | req_y => $HEIGHT * (1/8), |
182 | name => "client_setup", |
184 | name => "client_setup", |
183 | title => "Client Setup", |
185 | title => "Client Setup", |
184 | child => (my $vbox = new CFClient::UI::VBox); |
186 | child => (my $vbox = new CFClient::UI::VBox); |
185 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
187 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
186 | |
188 | |
… | |
… | |
383 | |
385 | |
384 | sub make_gauge_window { |
386 | sub make_gauge_window { |
385 | my $gh = int $HEIGHT * $CFG->{gauge_size}; |
387 | my $gh = int $HEIGHT * $CFG->{gauge_size}; |
386 | |
388 | |
387 | my $win = new CFClient::UI::Frame ( |
389 | my $win = new CFClient::UI::Frame ( |
|
|
390 | req_x => 0, |
388 | req_y => -1, |
391 | req_y => -1, |
389 | user_w => $WIDTH, |
392 | def_w => $WIDTH, |
390 | user_h => $gh, |
393 | def_h => $gh, |
391 | ); |
394 | ); |
392 | |
395 | |
393 | $win->add (my $hbox = new CFClient::UI::HBox |
396 | $win->add (my $hbox = new CFClient::UI::HBox |
394 | children => [ |
397 | children => [ |
395 | (new CFClient::UI::HBox expand => 1), |
398 | (new CFClient::UI::HBox expand => 1), |
… | |
… | |
432 | |
435 | |
433 | $win |
436 | $win |
434 | } |
437 | } |
435 | |
438 | |
436 | sub make_stats_window { |
439 | sub make_stats_window { |
437 | my $tgw = new CFClient::UI::FancyFrame title => "Stats", name => "stats_window"; |
440 | my $tgw = new CFClient::UI::FancyFrame |
|
|
441 | req_y => $HEIGHT * (2/8), |
|
|
442 | req_x => -1, |
|
|
443 | title => "Stats", |
|
|
444 | name => "stats_window"; |
438 | |
445 | |
439 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
446 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
440 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
447 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
441 | can_hover => 1, can_events => 1, |
448 | can_hover => 1, can_events => 1, |
442 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
449 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
… | |
… | |
705 | }); |
712 | }); |
706 | } |
713 | } |
707 | |
714 | |
708 | sub server_setup { |
715 | sub server_setup { |
709 | my $dialog = new CFClient::UI::FancyFrame |
716 | my $dialog = new CFClient::UI::FancyFrame |
|
|
717 | x => $WIDTH * (1/3), |
|
|
718 | y => $HEIGHT * (1/8), |
710 | name => "server_setup", |
719 | name => "server_setup", |
711 | title => "Server Setup", |
720 | title => "Server Setup", |
712 | child => (my $vbox = new CFClient::UI::VBox); |
721 | child => (my $vbox = new CFClient::UI::VBox), |
|
|
722 | on_visibility_change => sub { |
|
|
723 | my ($self, $visible) = @_; |
|
|
724 | $self->center if $visible; |
|
|
725 | }, |
713 | |
726 | ; |
|
|
727 | |
714 | $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]); |
715 | $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"); |
716 | |
730 | |
717 | { |
731 | { |
718 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
732 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
… | |
… | |
821 | my $window = new CFClient::UI::FancyFrame |
835 | my $window = new CFClient::UI::FancyFrame |
822 | name => "message_window", |
836 | name => "message_window", |
823 | title => "Messages", |
837 | title => "Messages", |
824 | border_bg => [1, 1, 1, 1], |
838 | border_bg => [1, 1, 1, 1], |
825 | bg => [0, 0, 0, 0.75], |
839 | bg => [0, 0, 0, 0.75], |
|
|
840 | req_x => -1, |
|
|
841 | req_y => 0, |
826 | user_w => int $::WIDTH / 3, |
842 | def_w => int $::WIDTH / 3, |
827 | user_h => int $::HEIGHT / 5, |
843 | def_h => int $::HEIGHT / 5, |
828 | child => (my $vbox = new CFClient::UI::VBox); |
844 | child => (my $vbox = new CFClient::UI::VBox); |
829 | |
845 | |
830 | $vbox->add ($LOGVIEW); |
846 | $vbox->add ($LOGVIEW); |
831 | |
847 | |
832 | $vbox->add (my $input = new CFClient::UI::Entry |
848 | $vbox->add (my $input = new CFClient::UI::Entry |
… | |
… | |
872 | $window |
888 | $window |
873 | } |
889 | } |
874 | |
890 | |
875 | sub open_quit_dialog { |
891 | sub open_quit_dialog { |
876 | unless ($QUIT_DIALOG) { |
892 | unless ($QUIT_DIALOG) { |
877 | |
|
|
878 | $QUIT_DIALOG = new CFClient::UI::FancyFrame title => "Really Quit?"; |
893 | $QUIT_DIALOG = new CFClient::UI::FancyFrame title => "Really Quit?"; |
879 | |
894 | |
880 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
895 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
881 | |
896 | |
882 | $vb->add (new CFClient::UI::Label |
897 | $vb->add (new CFClient::UI::Label |
… | |
… | |
893 | $hb->add (new CFClient::UI::Button |
908 | $hb->add (new CFClient::UI::Button |
894 | text => "Quit anyway", |
909 | text => "Quit anyway", |
895 | expand => 1, |
910 | expand => 1, |
896 | on_activate => sub { exit }, |
911 | on_activate => sub { exit }, |
897 | ); |
912 | ); |
|
|
913 | } |
898 | |
914 | |
|
|
915 | $QUIT_DIALOG->show; |
899 | $QUIT_DIALOG->show_centered; |
916 | $QUIT_DIALOG->center; |
900 | } else { |
|
|
901 | $QUIT_DIALOG->show_centered; |
|
|
902 | } |
|
|
903 | } |
917 | } |
904 | |
918 | |
905 | sub make_inventory_window { |
919 | sub make_inventory_window { |
906 | my $invwin = new CFClient::UI::FancyFrame |
920 | my $invwin = new CFClient::UI::FancyFrame |
907 | user_w => $WIDTH * (7/8), user_h => $HEIGHT * (7/8), title => "Inventory", name => "inventory_window"; |
921 | def_w => $WIDTH * 7/8, |
|
|
922 | def_h => $HEIGHT * 7/8, |
|
|
923 | title => "Inventory", |
|
|
924 | name => "inventory_window", |
|
|
925 | on_visibility_change => sub { |
|
|
926 | my ($self, $visible) = @_; |
|
|
927 | $self->center if $visible; |
|
|
928 | }, |
|
|
929 | ; |
908 | |
930 | |
909 | $invwin->add (my $hb = new CFClient::UI::HBox expand => 1); |
931 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
910 | |
932 | |
911 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
933 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
912 | $vb1->add (my $lbl = new CFClient::UI::Label align => 0); |
934 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
913 | $lbl->set_text ("Player"); |
|
|
914 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
935 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
915 | |
936 | |
916 | $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1); |
937 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
917 | |
938 | |
918 | $vb2->add (my $hb2 = new CFClient::UI::HBox); |
939 | $vb2->add (my $hb2 = new CFClient::UI::HBox); |
919 | $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"); |
920 | $hb2->add (new CFClient::UI::Button |
941 | $hb2->add (new CFClient::UI::Button |
921 | text => "Close", |
942 | text => "Close", |
922 | tooltip => "Close the currently open container (if one is open)", |
943 | tooltip => "Close the currently open container (if one is open)", |
923 | on_activate => sub { |
944 | on_activate => sub { |
924 | $CONN->send ("apply $CONN->{open_container}") |
945 | $CONN->send ("apply $CONN->{open_container}") |
925 | if $CONN->{open_container} != 0; |
946 | if $CONN->{open_container} != 0; |
926 | }, |
947 | }, |
927 | ); |
948 | ); |
928 | |
949 | |
929 | $INVR_LBL->set_text ("Floor"); |
|
|
930 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
950 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
931 | |
951 | |
932 | $invwin |
952 | $invwin |
933 | } |
953 | } |
934 | |
954 | |
935 | sub make_help_window { |
955 | sub make_help_window { |
936 | my $win = new CFClient::UI::FancyFrame |
956 | my $win = new CFClient::UI::FancyFrame |
937 | 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"; |
938 | |
960 | |
939 | $win->add (my $vbox = new CFClient::UI::VBox); |
961 | $win->add (my $vbox = new CFClient::UI::VBox); |
940 | |
962 | |
941 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
963 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
942 | $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); |