Deliantra-Client

 view release on metacpan or  search on metacpan

DC/Item.pm  view on Meta::CPAN

                  ["$move_prefix <n>", 
                     sub {
                        do_n_dialog (sub { $::CONN->send ("move $targ $self->{tag} $_[0]") })
                     }
                  ]
               )
            ),
            ["bind <i>apply $shortname</i> to a key"   => sub { DC::Macro::quick_macro ["apply $self->{name}"] }],
         );

         DC::UI::Menu->new (items => \@menu_items)->popup ($ev);
      }

      1
   };

   my $tooltip_std =
      "<small>"
      . "Left click - examine item\n"
      . "Shift-Left click - " . ($self->{container} ? "move or drop" : "take") . " item\n"
      . "Middle click - apply\n"

DC/Macro.pm  view on Meta::CPAN

         my $y = $idx + 2;

         my $macro_cb = sub {
            my ($widget, $ev) = @_;

            if ($ev->{button} == 1) {
               $edit_macro->($macro),
            } elsif ($ev->{button} == 2) {
               execute ($macro);
            } elsif ($ev->{button} == 3) {
               (new DC::UI::Menu
                  items => [
                     ["Edit"   => sub { $edit_macro->($macro) }],
                     ["Invoke" => sub { execute ($macro) }],
                     ["Delete" => sub { 
                        # might want to use grep instead
                        splice @{$::PROFILE->{macro}}, $idx, 1, ();
                        $refresh->();
                     }],
                  ],
               )->popup ($ev);

DC/MapWidget.pm  view on Meta::CPAN

            sub {
               if ($::CONN) {
                  &::open_quit_dialog;
               } else {
                  exit;
               }
            }
         ],
      ;

      (new DC::UI::Menu
         items => \@items,
      )->popup ($ev);
   }

   1
}

sub invoke_button_up {
   my ($self, $ev, $x, $y) = @_;

DC/MapWidget.pm  view on Meta::CPAN


   $self->{entry} = new DC::UI::Entry
      on_changed => sub {
         $self->update_labels;
         0
      },
      on_button_down => sub {
         my ($entry, $ev, $x, $y) = @_;

         if ($ev->{button} == 3) {
            (new DC::UI::Menu
               items => [
                  ["bind <i>" . (DC::asxml $self->{select}) . "</i> to a key"
                   => sub { DC::Macro::quick_macro [$self->{select}], sub { $entry->grab_focus } }]
               ],
            )->popup ($ev);
            return 1;
         }
         0
      },
      on_key_down => sub {

DC/Protocol.pm  view on Meta::CPAN


         my $spell_cb = sub {
            my ($widget, $ev) = @_;

            if ($ev->{button} == 1) {
               $::CONN->user_send ("ready_skill $name");
            } elsif ($ev->{button} == 2) {
               $::CONN->user_send ("use_skill $name");
            } elsif ($ev->{button} == 3) {
               my $shortname = DC::shorten $name, 14;
               (new DC::UI::Menu
                  items => [
                     ["bind <i>ready_skill $shortname</i> to a key" => sub { DC::Macro::quick_macro ["ready_skill $name"] }],
                     ["bind <i>use_skill $shortname</i> to a key"   => sub { DC::Macro::quick_macro ["use_skill $name"]   }],
                  ],
               )->popup ($ev);
            } else {
               return 0;
            }

            1

DC/UI.pm  view on Meta::CPAN

#############################################################################

package DC::UI::Buttonbar;

our @ISA = DC::UI::HBox::;

# TODO: should actually wrap buttons and other goodies.

#############################################################################

package DC::UI::Menu;

our @ISA = DC::UI::Toplevel::;

use DC::OpenGL;

sub new {
   my $class = shift;

   my $self = $class->SUPER::new (
      items => [],

DC/UI.pm  view on Meta::CPAN

   my ($self, $ev) = @_;

   my @menu_items;

   for (@{ $self->{options} }) {
      my ($value, $title, $tooltip) = @$_;

      push @menu_items, [$tooltip || $title, sub { $self->set_value ($value) }];
   }

   DC::UI::Menu->new (items => \@menu_items)->popup ($ev);
}

sub _set_value {
   my ($self, $value) = @_;

   my ($item) = grep $_->[0] eq $value, @{ $self->{options} };
   $item ||= $self->{options}[0]
      or return;

   $self->{value} = $item->[0];

DC/UI/SpellList.pm  view on Meta::CPAN


         my $spell_cb = sub {
            my ($widget, $ev) = @_;

            if ($ev->{button} == 1) {
               $::CONN->user_send ("cast $spell->{name}");
            } elsif ($ev->{button} == 2) {
               $::CONN->user_send ("invoke $spell->{name}");
            } elsif ($ev->{button} == 3) {
               my $shortname = DC::shorten $spell->{name}, 14;
               (new DC::UI::Menu
                  items => [
                     ["bind <i>cast $shortname</i> to a key"   => sub { DC::Macro::quick_macro ["cast $spell->{name}"] }],
                     ["bind <i>invoke $shortname</i> to a key" => sub { DC::Macro::quick_macro ["invoke $spell->{name}"] }],
                  ],
               )->popup ($ev);
            } else {
               return 0;
            }

            1

bin/deliantra  view on Meta::CPAN

   $MENUBAR->add ($BUTTONBAR = new DC::UI::Buttonbar);

   # XXX: this has to be done before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D
   make_gauge_window->show;

#      $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW,
#         tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server.");

   make_playerbook;

   $MENUPOPUP = DC::UI::Menu->new (items => [
      ["Setup…\tF9"        , sub { $SETUP_DIALOG->toggle_visibility }],
      ["Playerbook…\tTab"  , sub { $PL_WINDOW   ->toggle_visibility }],
      ["…Statistics\tF2"    , sub { toggle_player_page ($::STATS_PAGE) }],
      ["…Skills\tF3"        , sub { toggle_player_page ($::SKILL_PAGE) }],
      ["…Spells\tF4"       , sub { toggle_player_page ($::SPELL_PAGE) }],
      ["…Inventory\tF5"    , sub { toggle_player_page ($::INVENTORY_PAGE) }],
      ["Help Browser…\tF1" , sub { $HELP_WINDOW ->toggle_visibility }],
      ["Quit…"             , sub {
         if ($CONN) {
            open_quit_dialog;
         } else {
            EV::unloop EV::UNLOOP_ALL;
         }
      }],
   ]);

   $BUTTONBAR->add (new DC::UI::Button text => "Menu…",
      tooltip => "Shows the main menu",
      on_button_down => sub {
         my ($self, $ev) = @_;
         local $ev->{x} = 0;
         local $ev->{y} = 0;
         $MENUPOPUP->popup ($ev);
      },
   );

   $MENUBAR->add ($GAUGES->{exp} = new DC::UI::ExperienceProgress



( run in 0.757 second using v1.01-cache-2.11-cpan-49f99fa48dc )