App-Chart

 view release on metacpan or  search on metacpan

devel/run-annotation-dialog.pl  view on Meta::CPAN



use strict;
use warnings;
use Gtk2 '-init';
use App::Chart::Gtk2::AnnotationsDialog;

{
  my $symbol = 'BHP.AX';
  if (@ARGV) { $symbol = $ARGV[0]; }
  my $dialog = App::Chart::Gtk2::AnnotationsDialog->popup ($symbol);
  # unmap here because it's setup for hide-on-delete
  $dialog->signal_connect (unmap => sub { Gtk2->main_quit });
  Gtk2->main;
  exit 0;
}

devel/run-delete-symlist-dialog.pl  view on Meta::CPAN

#

use strict;
use warnings;
use Gtk2 '-init';
use App::Chart::Gtk2::DeleteSymlistDialog;

{
  require App::Chart::Gtk2::Symlist;
  my $symlist = App::Chart::Gtk2::Symlist->new_from_key ('user-0');
  App::Chart::Gtk2::DeleteSymlistDialog->popup ($symlist);
  Gtk2->main;
  exit 0;
}

exit 0;

devel/run-diagnostics.pl  view on Meta::CPAN

  require App::Chart::DBI;
  App::Chart::DBI->instance;
}

my $str = App::Chart::Gtk2::Diagnostics->str();
print "$progname: length ", length($str), "\n";
print $str;

Gtk2->disable_setlocale;  # leave LC_NUMERIC alone for version nums
Gtk2->init;
my $dialog = App::Chart::Gtk2::Diagnostics->popup;

my $textview = $dialog->{'textview'};
print "$progname: textview font ",$textview->style->font_desc->to_string,"\n";

Gtk2->main;
exit 0;



#   my $vadj = $self->{'vadj'};

devel/run-download-dialog.pl  view on Meta::CPAN

# with Chart.  If not, see <http://www.gnu.org/licenses/>.


use strict;
use warnings;
use Gtk2 '-init';
use App::Chart::Gtk2::DownloadDialog;
use Devel::FindRef;

{
  my $dialog = App::Chart::Gtk2::DownloadDialog->popup;
  # unmap here because it's setup for hide-on-delete
  $dialog->signal_connect (unmap => sub { Gtk2->main_quit });

  App::Chart::chart_dirbroadcast()->listen;
  Gtk2->main;
  exit 0;
}

{
  my $dialog = App::Chart::Gtk2::DownloadDialog->new;

devel/run-intraday.pl  view on Meta::CPAN


$App::Chart::option{'verbose'} = 1;

{
  my $symbol = $ARGV[0] || '^GSPC';
  my @list = App::Chart::IntradayHandler->handlers_for_symbol($symbol);
  print "$progname: handlers for $symbol: ",Dumper (\@list);

  Gtk2->disable_setlocale;  # leave LC_NUMERIC alone for version nums
  Gtk2->init;
  my $dialog = App::Chart::Gtk2::IntradayDialog->popup ($symbol);
  print "$progname: dialog $dialog\n";
  $dialog->signal_connect_after
    (response => sub {
       my ($self, $response) = @_;
       print "$progname: response $response\n";
       if ($response eq 'close' || $response eq 'delete-event') {
         Gtk2->main_quit;
       }
     });

devel/run-jobs-running-dialog.pl  view on Meta::CPAN

# Usage: ./run-delete-symlist-dialog.pl
#

use strict;
use warnings;
use App::Chart::Gtk2::JobsRunningDialog;
use Gtk2 '-init';

{
  require App::Chart::Gtk2::Symlist;
  App::Chart::Gtk2::JobsRunningDialog->popup;
  Gtk2->main;
  exit 0;
}

exit 0;

devel/run-prefs-dialog.pl  view on Meta::CPAN

my $progname = $FindBin::Script;


my $toplevel = Gtk2::Window->new('toplevel');
$toplevel->signal_connect (destroy => sub { Gtk2->main_quit });

my $button = Gtk2::Button->new_with_label ('Popup');
$toplevel->add ($button);
$button->signal_connect
  (clicked => sub {
     print "$progname: popup\n";
     App::Chart::Gtk2::Ex::ToplevelBits::popup ('App::Chart::Gtk2::PreferencesDialog',
                                                screen => $button);
   });

$toplevel->show_all;

App::Chart::Gtk2::Ex::ToplevelBits::popup ('App::Chart::Gtk2::PreferencesDialog',
                                           screen => $toplevel);
Gtk2->main;
exit 0;

devel/run-raw-dialog.pl  view on Meta::CPAN

use App::Chart::Gtk2::RawDialog;
use App::Chart::Database;
use App::Chart::DBI;
use Gtk2::Ex::Datasheet::DBI;
use App::Chart::Gtk2::GUI;

use FindBin;
my $progname = $FindBin::Script;

my $symbol = $ARGV[0] || 'BHP.AX';
my $raw_dialog = App::Chart::Gtk2::RawDialog->popup ($symbol);
$raw_dialog->signal_connect (destroy => sub { Gtk2->main_quit; });

App::Chart::chart_dirbroadcast()->listen;
Gtk2->main;


$raw_dialog->destroy;
require Scalar::Util;
Scalar::Util::weaken ($raw_dialog);
if ($raw_dialog) {

devel/run-watchlist.pl  view on Meta::CPAN

use 5.010;
use strict;
use warnings;
use Gtk2 '-init';
use App::Chart::Gtk2::WatchlistDialog;
use App::Chart::Gtk2::Ex::ToplevelBits;

use FindBin;
my $progname = $FindBin::Script;

my $watchlist = App::Chart::Gtk2::Ex::ToplevelBits::popup
  ('App::Chart::Gtk2::WatchlistDialog');
# connect to "unmap" here in case hide-on-delete, not destroy
$watchlist->signal_connect (unmap => sub { Gtk2->main_quit });

App::Chart::chart_dirbroadcast()->listen;
Gtk2->main;

$watchlist->destroy;
require Scalar::Util;
Scalar::Util::weaken ($watchlist);

devel/run-weblink-menu.pl  view on Meta::CPAN


my $menubar = Gtk2::MenuBar->new;
$vbox->pack_start ($menubar, 1,1,0);

my $item = Gtk2::MenuItem->new_with_label ('Web ...');
$item->set_submenu ($weblink_menu);
$menubar->add ($item);

$toplevel->show_all;

# immediate popup, but causes a disconcerting pointer/keyboard grab
# $weblink_menu->popup (undef, undef, undef, undef, 0, 0);

Gtk2->main;
exit 0;

lib/App/Chart/Gtk2/AnnotationsDialog.pm  view on Meta::CPAN

  my $symbol = $self->{'symbol'} || return;
  my $id = $model->get_value ($iter, COL_ID);

  my $dbh = App::Chart::DBI->instance;
  $dbh->do('UPDATE annotation SET note=? WHERE symbol=? AND id=?',
           undef,
           $newstr, $symbol, $id);
  App::Chart::chart_dirbroadcast()->send ('data-changed', { $symbol => 1 });
}

sub popup {
  my ($class, $symbol, $parent) = @_;
  if (! defined $symbol) { $symbol = ''; }
  require App::Chart::Gtk2::Ex::ToplevelBits;
  my $dialog = App::Chart::Gtk2::Ex::ToplevelBits::popup
    ($class,
     hide_on_delete => 1,
     screen => $parent);
  $dialog->set (symbol => $symbol);
  return $dialog;
}


1;
__END__

=for stopwords Popup

=head1 NAME

App::Chart::Gtk2::AnnotationsDialog -- annotations editing dialog

=head1 SYNOPSIS

 use App::Chart::Gtk2::AnnotationsDialog;
 App::Chart::Gtk2::AnnotationsDialog->popup;

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::AnnotationsDialog> is a subclass of C<Gtk2::Dialog>.

    Gtk2::Widget
      Gtk2::Container
        Gtk2::Bin
          Gtk2::Window
            Gtk2::Dialog
              App::Chart::Gtk2::AnnotationsDialog

=head1 DESCRIPTION

...

=head1 FUNCTIONS

=over 4

=item C<< App::Chart::Gtk2::AnnotationsDialog->popup () >>

=item C<< App::Chart::Gtk2::AnnotationsDialog->popup ($symbol) >>

Popup a C<AnnotationsDialog> dialog for C<$symbol>, either re-presenting any
existing one or otherwise creating a new one.

=back

=cut

lib/App/Chart/Gtk2/DeleteDialog.pm  view on Meta::CPAN

  my $sth = $nbh->prepare_cached
    ('SELECT symbol FROM annotation WHERE symbol=?  UNION ALL
      SELECT symbol FROM line       WHERE symbol=?  UNION ALL
      SELECT symbol FROM alert      WHERE symbol=?
      LIMIT 1');
  my $row = $nbh->selectrow_arrayref ($sth, undef, $symbol, $symbol, $symbol);
  $sth->finish;
  return (defined $row);
}

sub popup {
  my ($class, $symbol, $parent) = @_;

  # supposed to be insensitive when no symbol, but check in case
  if (! defined $symbol || $symbol eq '') {
    return;
  }

  # if "modal" is obeyed by the window manager then there won't be any other
  # delete dialogs open, but it doesn't hurt to let popup() search
  require App::Chart::Gtk2::Ex::ToplevelBits;
  return App::Chart::Gtk2::Ex::ToplevelBits::popup
    ($class,
     transient_for => $parent,
     properties    => { symbol => $symbol });
}

1;
__END__

=for stopwords popup Eg

=head1 NAME

App::Chart::Gtk2::DeleteDialog -- query user to delete symbol from database

=for test_synopsis my ($symbol, $parent_window)

=head1 SYNOPSIS

 use App::Chart::Gtk2::DeleteDialog;
 App::Chart::Gtk2::DeleteDialog->popup ($symbol, $parent_window);

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::DeleteDialog> is a subclass of C<Gtk2::MessageDialog>.

    Gtk2::Widget
      Gtk2::Container
        Gtk2::Bin
          Gtk2::Window
            Gtk2::Dialog

lib/App/Chart/Gtk2/DeleteDialog.pm  view on Meta::CPAN


=head1 DESCRIPTION

A C<App::Chart::Gtk2::DeleteDialog> asks the user whether to delete a given symbol
from the database and if the answer is yes then it does so.

=head1 FUNCTIONS

=over 4

=item C<< $dialog = App::Chart::Gtk2::DeleteDialog->popup ($symbol, $parent_window) >>

Create and popup a dialog asking the user whether to delete C<$symbol>.  The
dialog is created modal, and transient for the given C<$parent_window>.  Eg.

    App::Chart::Gtk2::DeleteDialog->popup ('FOO.ZZ', $toplevel);

The return value is the dialog created, but usually that can be ignored --
when the user answers it the dialog is destroyed.

=item C<< $dialog = App::Chart::Gtk2::DeleteDialog->new (key=>value,...) >>

Create and return a C<App::Chart::Gtk2::DeleteDialog>.  Optional key/value
pairs set initial properties as per C<< Glib::Object->new() >>.  The dialog
is not displayed (but can be with C<show> in the usual way).

lib/App/Chart/Gtk2/DeleteSymlistDialog.pm  view on Meta::CPAN

  my ($self, $response) = @_;
  if ($response eq 'ok') {
    if (my $symlist = $self->{'symlist'}) {
      $self->set (symlist => undef);
      $symlist->delete_symlist;
    }
  }
  $self->destroy;
}

sub popup {
  my ($class, $symlist, $parent) = @_;

  # if "modal" is obeyed by the window manager then there won't be any other
  # delete dialogs open, but it doesn't hurt to let popup() search
  require App::Chart::Gtk2::Ex::ToplevelBits;
  return App::Chart::Gtk2::Ex::ToplevelBits::popup
    ($class,
     transient_for => $parent,
     properties    => { symlist => $symlist });
}

1;
__END__

lib/App/Chart/Gtk2/Diagnostics.pm  view on Meta::CPAN

use Locale::TextDomain ('App-Chart');

use Gtk2::Ex::Units;
use App::Chart;

# uncomment this to run the ### lines
#use Smart::Comments;

use Glib::Object::Subclass 'Gtk2::Dialog';

sub popup {
  my ($class, $parent) = @_;
  require App::Chart::Gtk2::Ex::ToplevelBits;
  my $self = App::Chart::Gtk2::Ex::ToplevelBits::popup ($class,
                                                        screen => $parent);
  $self->refresh;
  return $self;
}

Gtk2::Rc->parse_string (<<'HERE');
style "Chart_fixed_width_font" {
  font_name = "Courier 12"
}
widget_class "App__Chart__Gtk2__Diagnostics.*.GtkTextView" style:gtk "Chart_fixed_width_font"

lib/App/Chart/Gtk2/Diagnostics.pm  view on Meta::CPAN

1;
__END__

=head1 NAME

App::Chart::Gtk2::Diagnostics -- diagnostics dialog module

=head1 SYNOPSIS

 use App::Chart::Gtk2::Diagnostics;
 App::Chart::Gtk2::Diagnostics->popup();

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::Diagnostics> is a subclass of C<Gtk2::Dialog>.

    Gtk2::Widget
      Gtk2::Container
        Gtk2::Bin
          Gtk2::Window
            Gtk2::Dialog

lib/App/Chart/Gtk2/Diagnostics.pm  view on Meta::CPAN


=head1 DESCRIPTION

A C<App::Chart::Gtk2::Diagnostics> dialog shows various bits of diagnostic
information like memory use, database size, etc.

=head1 FUNCTIONS

=over 4

=item C<< App::Chart::Gtk2::Diagnostics->popup() >>

Present a C<Diagnostics> dialog to the user.  C<popup()> creates and then
re-uses a single dialog, re-presenting it (C<< $widget->present() >>) and
refreshing its contents each time.  A single diagnostics dialog like this
will be enough for most uses.

=item C<< $dialog = App::Chart::Gtk2::Diagnostics->new() >>

Create and return a new Diagnostics dialog widget.  Initially it's empty and
C<refresh()> must be called to put some diagnostic information in it.

=item C<< $diagnostics->refresh() >>

lib/App/Chart/Gtk2/DownloadDialog.pm  view on Meta::CPAN

  'Gtk2::Dialog',
  signals => { destroy => \&_do_destroy };

use constant { RESPONSE_START  => 0,
               RESPONSE_STOP   => 1,
               RESPONSE_CLEAR  => 2 };

use constant { WHEN_UPDATE  => 0,
               WHEN_BACKTO  => 1 };

sub popup {
  my ($class, $symbol, $parent) = @_;
  require App::Chart::Gtk2::Ex::ToplevelBits;
  my $dialog = App::Chart::Gtk2::Ex::ToplevelBits::popup
    ($class,
     hide_on_delete => 1,
     screen => $parent);
  if (defined $symbol) {
    $dialog->{'entry'}->set_text($symbol);
  }
  return $dialog;
}
sub popup_update {
  my ($class, $symbol, $parent) = @_;
  my $dialog = $class->popup ($symbol, $parent);
  $dialog->start ($symbol, undef);
  $dialog->{'hide_on_success'} = 1;
  return $dialog;
}

sub INIT_INSTANCE {
  my ($self) = @_;

  $self->set_title (__('Chart: Download'));
  $self->add_buttons (__('_Start') => RESPONSE_START,

lib/App/Chart/Gtk2/DownloadDialog.pm  view on Meta::CPAN

        && List::Util::first {! $_->pid} App::Chart::Gtk2::Subprocess->all_subprocesses;
  };
  $self->set_response_sensitive (RESPONSE_CLEAR, $anything_to_clear);
}

# 'button-press-event' on the treeview
sub _do_proc_treeview_button_press {
  my ($treeview, $event, $self) = @_;
  if ($event->button == 3) {
    require App::Chart::Gtk2::SubprocessStopMenu;
    App::Chart::Gtk2::SubprocessStopMenu->popup_from_treeview ($event, $treeview);
  }
  return Gtk2::EVENT_PROPAGATE;
}

# 'changed' on the treeview selection
sub _do_selection_changed {
  my ($selection, $self) = @_;
  _update_stop_sensitive ($self);
}

lib/App/Chart/Gtk2/DownloadDialog.pm  view on Meta::CPAN

  $renderer->set (text => $str);
}

# 'button-press-event' on the treeview
sub _do_jobs_treeview_button_press {
  my ($treeview, $event) = @_;
  if ($event->button == 3) {
    require App::Chart::Gtk2::JobStopMenu;
    my $self = $treeview->get_toplevel;
    my $menu = ($self->{'job_menu'} ||= App::Chart::Gtk2::JobStopMenu->new);
    $menu->popup_from_treeview ($event, $treeview);
  }
  return Gtk2::EVENT_PROPAGATE;
}


#------------------------------------------------------------------------------
# generic helpers


1;
__END__

=for stopwords popup

=head1 NAME

App::Chart::Gtk2::DownloadDialog -- download dialog widget

=head1 SYNOPSIS

 use App::Chart::Gtk2::DownloadDialog;
 App::Chart::Gtk2::DownloadDialog->popup;

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::DownloadDialog> is a subclass of C<Gtk2::Dialog>.

    Gtk2::Widget
      Gtk2::Container
        Gtk2::Bin
          Gtk2::Window
            Gtk2::Dialog
              App::Chart::Gtk2::DownloadDialog

=head1 DESCRIPTION

...

=head1 FUNCTIONS

=over 4

=item C<< App::Chart::Gtk2::DownloadDialog->popup () >>

=item C<< App::Chart::Gtk2::DownloadDialog->popup ($symbol) >>

Popup a C<DownloadDialog> dialog, re-presenting any existing one or
otherwise creating a new one.

The optional C<$symbol> parameter is put into the symbol entry field, so the
user can have that already entered on choosing the "One Symbol" download.

=back

=head1 SEE ALSO

lib/App/Chart/Gtk2/Ex/MenuBits.pm  view on Meta::CPAN

  # than screen
  my $x = int (($screen->get_width - $menu_req->width)/ 2);
  my $y = int (($screen->get_height - $menu_req->height) / 2);
  ###  $x
  ###  $y
  return ($x, $y, 1);
}

# usually $event->button, $event->time is enough ...
#
sub menu_popup_for_event {
  my ($menu, $event) = @_;
  my $button = (Scalar::Util::blessed($event) && event_is_button_press($event)
                ? $event->button : 0);
  my $time = (Scalar::Util::blessed($event) && $event->can('time')
              ? $event->time
              : Gtk2::GDK_CURRENT_TIME);  # 1.200 or something
  $menu->popup (undef,  # parent menushell
                undef,  # parent menuitem
                undef,  # position func
                undef,  # data
                $button,
                $time);
}

my %event_types_button_press = ('button-press'  => 1,
                                '2button-press' => 1,
                                '3button-press' => 1);

lib/App/Chart/Gtk2/Ex/MenuBits.pm  view on Meta::CPAN

# return true if $event is a button press, either a plain press or a double
# or triple click
sub event_is_button_press {
  my ($event) = @_;
  return $event_types_button_press{$event->type};
}

1;
__END__

=for stopwords popup

=head1 NAME

App::Chart::Gtk2::Ex::MenuBits -- miscellaneous Gtk2::Menu helpers

=head1 SYNOPSIS

 use App::Chart::Gtk2::Ex::MenuBits;

=head1 FUNCTIONS

lib/App/Chart/Gtk2/Ex/ToplevelBits.pm  view on Meta::CPAN

# uncomment this to run the ### lines
#use Smart::Comments;

# screen
# parent
# with_properties
# init_properties
# modal
# hide_on_delete

sub popup {
  my ($class, %options) = @_;
  ### ToplevelBits popup(): $class

  my $properties = $options{'properties'} || {};
  my $screen = _screen
    ($options{'transient_for'} || $options{'parent'} || $options{'screen'});

  my $dialog = List::Util::first
    {$_->isa($class)
       && (! defined $screen || $_->get_screen == $screen)
         && _object_properties_equal($_,$properties)}
      Gtk2::Window->list_toplevels;

lib/App/Chart/Gtk2/Ex/ToplevelBits.pm  view on Meta::CPAN

App::Chart::Gtk2::Ex::ToplevelBits -- helpers for Gtk2::Window toplevel widgets

=head1 SYNOPSIS

 use App::Chart::Gtk2::Ex::ToplevelBits;

=head1 FUNCTIONS

=over 4

=item C<< $toplevel = App::Chart::Gtk2::Ex::ToplevelBits::popup ($class, key => value, ...) >>

Create or raise a dialog.

=over

=item C<< screen => $screen >>

=item C<< screen => $widget >>

=item C<< screen => $display >>

lib/App/Chart/Gtk2/IntradayDialog.pm  view on Meta::CPAN


sub _do_response {
  my ($self, $response) = @_;
  ### IntradayDialog response: $response

  if ($response eq RESPONSE_REFRESH) {
    $self->refresh;

  } elsif ($response eq RESPONSE_SAVE) {
    require App::Chart::Gtk2::IntradaySave;
    App::Chart::Gtk2::IntradaySave->popup ($self);

  } elsif ($response eq RESPONSE_PRINT) {
    $self->print_image;

  } elsif ($response eq 'close') {
    # as per a keyboard close, defaults to raising 'delete-event', which in
    # turn defaults to a destroy
    $self->signal_emit ('close');

  } elsif ($response eq 'help') {

lib/App/Chart/Gtk2/IntradayDialog.pm  view on Meta::CPAN

  if (my $wcursor = $self->{'widgetcursor'}) {
    $wcursor->active ($job_running);
  }
}

sub _do_accel_redraw {
  my ($accelgroup, $self, $keyval, $modifiers) = @_;
  $self->queue_draw;
}

sub popup {
  my ($class, $symbol, $parent) = @_;
  if (! defined $symbol) { $symbol = ''; }
  require App::Chart::Gtk2::Ex::ToplevelBits;
  return App::Chart::Gtk2::Ex::ToplevelBits::popup
    ($class,
     properties => { symbol => $symbol },
     screen => $parent);
}

#------------------------------------------------------------------------------
# printing

sub print_image {
  my ($self) = @_;

lib/App/Chart/Gtk2/IntradayDialog.pm  view on Meta::CPAN


=for stopwords intraday

=head1 NAME

App::Chart::Gtk2::IntradayDialog -- intraday graph dialog widget

=head1 SYNOPSIS

 use App::Chart::Gtk2::IntradayDialog;
 App::Chart::Gtk2::IntradayDialog->popup;              # initially empty
 App::Chart::Gtk2::IntradayDialog->popup ('BHP.AX');   # or given symbol

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::IntradayDialog> is a subclass of C<Gtk2::Dialog>.

    Gtk2::Widget
      Gtk2::Container
        Gtk2::Bin
          Gtk2::Window
            Gtk2::Dialog

lib/App/Chart/Gtk2/IntradayDialog.pm  view on Meta::CPAN

such as 1-day or 5-day and the C<IntradayDialog> downloads and shows them.

Some data sources don't offer historical data as figures, but only as
graphics images.  For them "intraday" is pressed into service to show daily
data too.

=head1 FUNCTIONS

=over 4

=item C<< App::Chart::Gtk2::IntradayDialog->popup () >>

=item C<< App::Chart::Gtk2::IntradayDialog->popup ($symbol) >>

Present an intraday dialog for C<$symbol>.  C<$symbol> is a string, or
empty, C<undef> or omitted to get a dialog showing nothing initially.

If a dialog already exists showing C<$symbol> then it's raised rather than
creating a new one.

=item C<< $dialog->goto_entry() >>

Go to the symbol entered in the text entry box by setting it as the

lib/App/Chart/Gtk2/IntradaySave.pm  view on Meta::CPAN

  if ($response eq 'accept') {
    $self->save;

  } elsif ($response eq 'cancel') {
    # raise 'close' as per a keyboard Esc to close, which defaults to
    # raising 'delete-event', which is setup as a hide() above
    $self->signal_emit ('close');
  }
}

sub popup {
  my ($class, $intradaydialog) = @_;
  require App::Chart::Gtk2::Ex::ToplevelBits;
  return App::Chart::Gtk2::Ex::ToplevelBits::popup
    ($class,
     properties => { transient_for => $intradaydialog },
     screen => $intradaydialog);
}

sub save {
  my ($self) = @_;
  my $intradaydialog = $self->get_transient_for;
  my ($symbol, $mode) = $intradaydialog->get('symbol','mode');

lib/App/Chart/Gtk2/IntradaySave.pm  view on Meta::CPAN


=head1 NAME

App::Chart::Gtk2::IntradaySave -- intraday image saving dialog

=for test_synopsis my $intradaydialog

=head1 SYNOPSIS

 use App::Chart::Gtk2::IntradaySave;
 App::Chart::Gtk2::IntradaySave->popup ($intradaydialog);

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::IntradaySave> is a subclass of C<Gtk2::FileChooserDialog>.

    Gtk2::Widget
      Gtk2::Container
        Gtk2::Bin
          Gtk2::Window
            Gtk2::Dialog

lib/App/Chart/Gtk2/IntradaySave.pm  view on Meta::CPAN


=head1 DESCRIPTION

An IntradaySave offers to save an intraday image file to disk, out of the
database.

=head1 FUNCTIONS

=over 4

=item C<< App::Chart::Gtk2::IntradaySave->popup ($intradaydialog) >>

=item C<< $savedialog->save () >>

=back

=head1 PROPERTIES

=over 4

=item C<parent>

lib/App/Chart/Gtk2/JobStopMenu.pm  view on Meta::CPAN

  my ($self) = @_;
  my $job = $self->{'job'};

  my $stop = $self->{'stop'};
  $stop->set_sensitive ($job && $job->is_stoppable);

  my $delete = $self->{'delete'};
  $delete->set_sensitive ($job && $job->is_done);
}

sub popup_from_treeview {
  my ($self, $event, $treeview) = @_;

  my ($path) = $treeview->get_path_at_pos ($event->x, $event->y);
  if (! $path) { return; }

  my $model = $treeview->get_model;  # App::Chart::Gtk2::JobQueue
  my $iter = $model->get_iter ($path);
  my $job = $model->get_value ($iter, 0);
  $self->set (job => $job);
  $self->set_screen ($treeview->get_screen);
  $self->popup (undef, undef, undef, undef, $event->button, $event->time);
}

1;
__END__

=for stopwords undef

=head1 NAME

App::Chart::Gtk2::JobStopMenu -- menu to stop or delete a Job

=for test_synopsis my ($event, $treeview)

=head1 SYNOPSIS

 use App::Chart::Gtk2::JobStopMenu;
 my $menu = App::Chart::Gtk2::JobStopMenu->new;

 $menu->popup_from_treeview ($event, $treeview);

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::JobStopMenu> is a subclass of C<Gtk::Menu>,

    Gtk2::Widget
      Gtk2::Container
        Gtk2::MenuShell
          Gtk2::Menu
            App::Chart::Gtk2::JobStopMenu

lib/App/Chart/Gtk2/JobsRunningDialog.pm  view on Meta::CPAN

    }
    $self->destroy;

  } elsif ($response eq 'close') {
    # as per a keyboard close, defaults to raising 'delete-event', which
    # in turn defaults to a destroy
    $self->signal_emit ('close');
  }
}

sub popup {
  my ($class, $parent) = @_;

  # if "modal" is obeyed by the window manager then there won't be any other
  # JobsRunningDialog's open, but it doesn't hurt to let dialog_popup search
  require App::Chart::Gtk2::Ex::ToplevelBits;
  return App::Chart::Gtk2::Ex::ToplevelBits::dialog_popup
    (class         => $class,
     transient_for => $parent);
}

sub query_and_quit {
  my ($class, $parent) = @_;
  if (App::Chart::Gtk2::JobQueue->can('instance')
      && (List::Util::first {_job_is_queryable($_)}
          App::Chart::Gtk2::JobQueue->all_jobs)) {
    $class->popup ($parent);
  } else {
    $parent->destroy;
  }
}

1;
__END__

=for stopwords ok Intraday

lib/App/Chart/Gtk2/JobsRunningDialog.pm  view on Meta::CPAN

before quitting.  Cancel means don't quit, ok means kill the jobs.

=head1 FUNCTIONS

=over 4

=item C<< App::Chart::Gtk2::JobsRunningDialog->query_and_quit ($main_window) >>

C<$main_window> is a C<Gtk2::Window> which is the application main window.
If there's any running or pending Download or Vacuum jobs in the
C<App::Chart::Gtk2::JobQueue> then popup a JobsRunningDialog asking the user
whether to kill them and quit, or cancel to not quit.

If the user chooses to kill then C<< $main_window->destroy() >> is called.
C<$main_window> should be set up to exit the main loop if destroyed and the
jobs will be stopped or discarded in the usual way when garbage collected.

If there's no running or pending jobs then C<< $main_window->destroy() >> is
called immediately, without any dialog.  Intraday image downloads and latest
quote downloads are ignored for quit query purposes since they're only for
immediate display, they're not user initiated database updates.

lib/App/Chart/Gtk2/Main.pm  view on Meta::CPAN

   { name => 'ViewMenu',  label => '_View'  },
   { name => 'ToolsMenu', label => '_Tools' },
   { name => 'HelpMenu',  label => '_Help'  },
   
   { name        => 'Open',
     stock_id    => 'gtk-open',
     accelerator =>  __p('Main-accelerator-key','O'),
     tooltip     => __('View chart for a symbol, or add new symbol to the database'),
     callback    => sub {
       my ($action, $self) = @_;
       App::Chart::Gtk2::Ex::ToplevelBits::popup
           ('App::Chart::Gtk2::OpenDialog',
            transient_for  => $self,
            hide_on_delete => 1);
     },
   },
   { name     => 'Delete',
     stock_id => 'gtk-delete',
     tooltip  => __('Delete this symbol from the database.'),
     callback => sub {
       my ($action, $self) = @_;
       require App::Chart::Gtk2::DeleteDialog;
       App::Chart::Gtk2::DeleteDialog->popup ($self->get_symbol, $self);
     },
   },
   { name        => 'AddFavourite',
     label       => __('_Add Favourite'),
     accelerator => __p('Main-accelerator-key','exclam'),
     tooltip     => __('Add this symbol to your Favourites list, or elevate in that list.'),
     callback => sub {
       my ($action, $self) = @_;
       require App::Chart::Gtk2::Symlist::Favourites;
       my $symlist = App::Chart::Gtk2::Symlist::Favourites->instance;

lib/App/Chart/Gtk2/Main.pm  view on Meta::CPAN

         App::Chart::Gtk2::JobsRunningDialog->query_and_quit ($self);
       } else {
         $self->destroy;
       }
     },
   },
   { name     => 'Preferences',
     stock_id => 'gtk-preferences',
     callback => sub {
       my ($action, $self) = @_;
       App::Chart::Gtk2::Ex::ToplevelBits::popup
           ('App::Chart::Gtk2::PreferencesDialog', screen => $self);
     },
   },
   
   { name        => 'Centre',
     label       => __('_Centre'),
     accelerator => __p('Main-accelerator-key','<Ctrl>C'),
     callback    => sub { my ($action, $self) = @_;
                          $self->{'view'}->centre; }
   },

lib/App/Chart/Gtk2/Main.pm  view on Meta::CPAN

     tooltip     => __('Force a redraw of the entire Chart display.'),
     callback    => sub { my ($action, $self) = @_;
                          $self->queue_draw; }
   },
   { name     => 'Intraday',
     label    => __('_Intraday'),
     tooltip  => __p('Main-accelerator-key','<Ctrl>I'),
     callback => sub {
       my ($action, $self) = @_;
       require App::Chart::Gtk2::IntradayDialog;
       App::Chart::Gtk2::IntradayDialog->popup ($self->get_symbol, $self);
     },
   },
   { name     => 'Annotations',
     label    => __('_Annotations'),
     callback => sub {
       my ($action, $self) = @_;
       require App::Chart::Gtk2::AnnotationsDialog;
       App::Chart::Gtk2::AnnotationsDialog->popup ($self->get_symbol, $self);
     },
   },
   { name     => 'ViewStyle',
     label    => __('_View Style'),
     callback => sub { my ($action, $self) = @_;
                       Gtk2::Ex::WidgetCursor->busy;
                       require App::Chart::Gtk2::ViewStyleDialog;
                       my $vs = App::Chart::Gtk2::ViewStyleDialog->instance_for_screen($self);
                       $vs->present;
                       my $view = $self->{'view'};
                       $vs->set (view => $view,
                                 viewstyle => $view->get('viewstyle'));
                     }
   },
   { name     => 'Raw',
     label    => __('_Raw data'),
     callback => sub { my ($action, $self) = @_;
                       require App::Chart::Gtk2::RawDialog;
                       App::Chart::Gtk2::RawDialog->popup ($self->get_symbol, $self); }
   },
   { name  => "WebMenuItem",
     label => __('_Web')
   },
   
   # Tools menu
   
   { name     => 'Watchlist',
     label    => __('_Watchlist'),
     callback => sub {
       my ($action, $self) = @_;
       App::Chart::Gtk2::Ex::ToplevelBits::popup
           ('App::Chart::Gtk2::WatchlistDialog',
            screen => $self,
            hide_on_delete => 1);
     },
   },
   { name     => 'Download',
     label    => __('_Download'),
     callback => sub { my ($action, $self) = @_;
                       require App::Chart::Gtk2::DownloadDialog;
                       App::Chart::Gtk2::DownloadDialog->popup ($self->get_symbol, $self); }
   },
   { name        => 'DownloadUpdate',
     label       => __('Download _Update'),
     accelerator => __p('Main-accelerator-key','<Ctrl>U'),
     callback    => sub {
       my ($action, $self) = @_;
       # meant to be sensitive only with a symbol, but check anyway
       my $symbol = $self->get_symbol || return;
       require App::Chart::Gtk2::DownloadDialog;
       my $dialog = App::Chart::Gtk2::DownloadDialog->instance_for_screen($self);

lib/App/Chart/Gtk2/Main.pm  view on Meta::CPAN

         App::Chart::Gtk2::JobStatusbarMessage->new
             (statusbar => $self->{'statusbar'});
       });
       $jobmsg->add_job ($job);
     } },
   { name        => 'History',
     label       => __('_History'),
     tooltip     => __('Dialog of back/forward symbols.'),
     callback    => sub {
       my ($action, $self) = @_;
       App::Chart::Gtk2::Ex::ToplevelBits::popup
           ('Gtk2::Ex::History::Dialog',
            screen => $self,
            properties => { history => $self->{'history'} });
     },
   },
   { name     => 'Vacuum',
     label    => __('_Vacuum'),
     tooltip  => __('Compact and clean up the database.'),
     callback => sub {
       my ($action, $self) = @_;
       App::Chart::Gtk2::Ex::ToplevelBits::popup ('App::Chart::Gtk2::VacuumDialog',
                                                  screen => $self);
     },
   },
   { name     => 'Errors',
     label    => __('_Errors'),
     tooltip  => __('Open the errors dialog (it automatically popups up when there\'s an error to see)'),
     callback => sub { my ($action, $self) = @_;
                       require Gtk2::Ex::ErrorTextDialog;
                       my $dialog = Gtk2::Ex::ErrorTextDialog->instance;
                       $dialog->set_screen ($self->get_screen);
                       $dialog->present;
                     }
   },
   { name     => 'Diagnostics',
     label    => __('Dia_gnostics'),
     tooltip  => __('Some diagnostic information about the program and the databases.'),
     callback => sub { my ($action, $self) = @_;
                       require App::Chart::Gtk2::Diagnostics;
                       App::Chart::Gtk2::Diagnostics->popup ($self); }
   },
   
   { name     => 'About',
     stock_id => 'gtk-about',
     callback => sub {
       my ($action, $self) = @_;
       App::Chart::Gtk2::Ex::ToplevelBits::popup
           ('App::Chart::Gtk2::AboutDialog', screen => $self);
     },
   },

   { name        => 'Manual',
     label       => __('_Manual'),
     accelerator => 'F1',
     callback    => sub { my ($action, $self) = @_;
                          require App::Chart::Manual;
                          App::Chart::Manual->open (undef, $self); },

lib/App/Chart/Gtk2/OpenDialog.pm  view on Meta::CPAN


# uncomment this to run the ### lines
#use Smart::Comments;

use Glib::Object::Subclass
  'Gtk2::Dialog',
  signals => { map => \&_do_map };

# use App::Chart::Gtk2::Ex::ToplevelSingleton hide_on_delete => 1;
# use base 'App::Chart::Gtk2::Ex::ToplevelSingleton';
# sub popup {
#   my ($class) = @_;
#   my $self = $class->instance;
#   $self->present;
#   return $self;
# }

use constant { RESPONSE_OPEN  => 0,
               RESPONSE_NEW   => 1 };

sub INIT_INSTANCE {

lib/App/Chart/Gtk2/OpenDialog.pm  view on Meta::CPAN


  if ($response eq RESPONSE_OPEN) {
    _do_entry_open ($self);

  } elsif ($response eq RESPONSE_NEW) {
    my $symbol = $self->entry_str;
    if ($symbol) { # should be insensitive when empty anyway
      App::Chart::Database->add_symbol ($symbol);
      $self->_do_open ($symbol);
      require App::Chart::Gtk2::DownloadDialog;
      App::Chart::Gtk2::DownloadDialog->popup_update ($symbol, $self);
    }

  } elsif ($response eq 'cancel' || $response eq 'delete-event') {
    $self->hide;

  } elsif ($response eq 'help') {
    require App::Chart::Manual;
    App::Chart::Manual->open(__p('manual-node','Open'), $self);
  }
}

lib/App/Chart/Gtk2/PreferencesDialog.pm  view on Meta::CPAN

use Gtk2;
use Gtk2::Ex::Units;
use Locale::TextDomain ('App-Chart');

use App::Chart;
use App::Chart::Database;
use App::Chart::DBI;

# use App::Chart::Gtk2::Ex::ToplevelSingleton hide_on_delete => 1;
# use base 'App::Chart::Gtk2::Ex::ToplevelSingleton';
# sub popup {
#   my ($class, $parent) = @_;
#   my $self = $class->instance;
#   $self->present;
#   return $self;
# }

use Glib::Object::Subclass
  'Gtk2::Dialog',
  signals => { show => \&_do_show },
  properties => [];

lib/App/Chart/Gtk2/PreferencesDialog.pm  view on Meta::CPAN

__END__


=head1 NAME

App::Chart::Gtk2::PreferencesDialog -- preferences dialog widget

=head1 SYNOPSIS

 use App::Chart::Gtk2::PreferencesDialog;
 App::Chart::Gtk2::PreferencesDialog->popup();

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::PreferencesDialog> is a subclass of C<Gtk2::Dialog>.

    Gtk2::Widget
      Gtk2::Container
        Gtk2::Bin
          Gtk2::Window
            Gtk2::Dialog
              App::Chart::Gtk2::PreferencesDialog

=head1 FUNCTIONS

=over 4

=item C<< App::Chart::Gtk2::PreferencesDialog->popup() >>

=back

=cut

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

                  fixed_width => 20*$em,
                  resizable   => 1);
    $treeview->append_column ($column);
  }
  {
    my $column = Gtk2::TreeViewColumn->new_with_attributes
      (__('URL'), $renderer, text => 1);
    $column->set (sizing      => 'fixed',
                  fixed_width => 60*$em,
                  resizable   => 1);
    $column->{'menu_func'} = \&_do_weblink_menu_popup;
    $treeview->append_column ($column);
  }
  $scrolled->show_all;
}
sub _do_weblink_row_activate {
  my ($treeview, $path, $column) = @_;
  my $url = _do_weblink_row_url ($treeview, $path);
  require App::Chart::Gtk2::GUI;
  App::Chart::Gtk2::GUI::browser_open ($url);
}

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

# 'button-press-event' on the weblink TreeView
sub _do_weblink_button_press {
  my ($treeview, $event) = @_;
  my ($path, $column) = $treeview->get_path_at_pos ($event->x, $event->y);
  if (!$path) { return; }
  if (my $func = $column->{'menu_func'}) {
    $func->($treeview, $event, $path);
  }
  return Gtk2::EVENT_PROPAGATE;
}
sub _do_weblink_menu_popup {
  my ($treeview, $event, $path) = @_;
  my $menu = Gtk2::Menu->new;
  $menu->set_screen ($treeview->get_screen);
  my $url = _do_weblink_row_url ($treeview, $path);
  {
    my $item = Gtk2::ImageMenuItem->new_from_stock ('gtk-open');
    $item->{'url'} = $url;
    $item->signal_connect (activate => \&_do_weblink_menu_open);
    $menu->append ($item);
  }
  # LinkButton of Gtk 2.14 has a "Copy URL" message string (translated etc),
  # could show that
  {
    my $item = Gtk2::ImageMenuItem->new_from_stock ('gtk-copy');
    $item->{'url'} = $url;
    $item->signal_connect (activate => \&_do_weblink_menu_copy);
    $menu->append ($item);
  }
  $menu->show_all;
  $menu->popup (undef, undef, undef, undef,
                $event->button, $event->time);
}
sub _do_weblink_menu_open {
  my ($item) = @_;
  require App::Chart::Gtk2::GUI;
  App::Chart::Gtk2::GUI::browser_open ($item->{'url'});
}
sub _do_weblink_menu_copy {
  my ($item) = @_;
  my $clipboard = Gtk2::Clipboard->get_for_display

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

  my ($str) = @_;
  return ($str =~ /^[0-9]*(.[0-9]*)?$/);
}

# return true if $str is a valid number
sub validate_integer {
  my ($str) = @_;
  return ($str =~ /^[0-9]*$/);
}

sub popup {
  my ($class, $symbol, $parent) = @_;
  if (! defined $symbol) { $symbol = ''; }
  require App::Chart::Gtk2::Ex::ToplevelBits;
  return App::Chart::Gtk2::Ex::ToplevelBits::popup
    ($class,
     properties => { symbol => $symbol },
     screen => $parent);
}

1;
__END__

=for stopwords RawDialog

=head1 NAME

App::Chart::Gtk2::RawDialog -- raw data display dialog

=head1 SYNOPSIS

 use App::Chart::Gtk2::RawDialog;
 App::Chart::Gtk2::RawDialog->popup();

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::RawDialog> is a subclass of C<Gtk2::Dialog>.

    Gtk2::Widget
      Gtk2::Container
        Gtk2::Bin
          Gtk2::Window
            Gtk2::Dialog

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

etc from the database.

=head1 FUNCTIONS

=over 4

=item C<< App::Chart::Gtk2::RawDialog->new (key=>value,...) >>

Create and return a new RawDialog dialog widget.

=item C<< App::Chart::Gtk2::RawDialog->popup () >>

=item C<< App::Chart::Gtk2::RawDialog->popup ($symbol, $parent) >>

Create and open a C<RawDialog> dialog showing the data for C<$symbol>.
C<$symbol> can be omitted, or C<undef>, or the empty string, to display
nothing initially.

=back

=cut

lib/App/Chart/Gtk2/SeriesTreeView.pm  view on Meta::CPAN


=for stopwords SeriesTreeView

=head1 NAME

App::Chart::Gtk2::SeriesTreeView -- raw data display dialog

=head1 SYNOPSIS

 use App::Chart::Gtk2::SeriesTreeView;
 App::Chart::Gtk2::SeriesTreeView->popup();

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::SeriesTreeView> is a subclass of C<Gtk2::TreeView>.

    Gtk2::Widget
      Gtk2::Container
        Gtk2::TreeView
          App::Chart::Gtk2::SeriesTreeView

lib/App/Chart/Gtk2/SubprocessStopMenu.pm  view on Meta::CPAN

}

sub _update_sensitive {
  my ($self) = @_;
  my $subprocess = $self->{'subprocess'};

  my $stop = $self->{'stop'};
  $stop->set_sensitive ($subprocess && defined ($subprocess->pid));
}

sub popup_from_treeview {
  my ($self, $event, $treeview) = @_;
  ref $self or $self = $self->new;  # object or class method

  my ($path) = $treeview->get_path_at_pos ($event->x, $event->y);
  if (! $path) { return; }

  my $model = $treeview->get_model;  # $App::Chart::Gtk2::Subprocess::store
  my $iter = $model->get_iter ($path);
  my $subprocess = $model->get_value ($iter, 0);
  $self->set (subprocess => $subprocess);
  $self->set_screen ($treeview->get_screen);
  $self->popup (undef, undef, undef, undef, $event->button, $event->time);
}

1;
__END__

=for stopwords Subprocess undef subprocess

=head1 NAME

App::Chart::Gtk2::SubprocessStopMenu -- menu to stop or delete a Subprocess

=for test_synopsis my ($event, $treeview)

=head1 SYNOPSIS

 use App::Chart::Gtk2::SubprocessStopMenu;
 my $menu = App::Chart::Gtk2::SubprocessStopMenu->new;
 $menu->popup_from_treeview ($event, $treeview);

=head1 WIDGET HIERARCHY

C<App::Chart::Gtk2::SubprocessStopMenu> is a subclass of C<Gtk::Menu>,

    Gtk2::Widget
      Gtk2::Container
        Gtk2::MenuShell
          Gtk2::Menu
            App::Chart::Gtk2::SubprocessStopMenu

lib/App/Chart/Gtk2/Ticker.pm  view on Meta::CPAN

                             'centre'  => 0,
                             'pointer' => 1);
}
use Glib::Object::Subclass
  'Gtk2::Ex::TickerView',
  signals => { button_press_event => \&_do_button_press_event,

               menu_created => { param_types => ['Gtk2::Menu'],
                                 return_type => undef,
                               },
               menu_popup => { param_types   => ['Glib::Int',
                                                 'App::Chart::Gtk2::Ticker::menu_position'],
                               return_type   => undef,
                               class_closure => \&_do_menu_popup_action,
                               flags         => [ 'run-last', 'action' ],
                             },
             },
  properties => [Glib::ParamSpec->object
                 ('symlist',
                  'symlist',
                  'App::Chart::Gtk2::Symlist object for the symbols to display.',
                  # App::Chart::Gtk2::Symlist::Join is a ListModelConcat not
                  # a Symlist subclass, allow that by just Glib::Object here
                  'Glib::Object',
                  Glib::G_PARAM_READWRITE),
                ];
App::Chart::Gtk2::GUI::chart_style_class (__PACKAGE__);

# priority level "gtk" treating this as widget level default, for overriding
# by application or user RC
Gtk2::Rc->parse_string (<<'HERE');
binding "App__Chart__Gtk2__Ticker_keys" {
  bind "F10"             { "menu_popup" (0, centre) }
  bind "Pointer_Button3" { "menu_popup" (3, pointer) }
}
class "App__Chart__Gtk2__Ticker" binding:gtk "App__Chart__Gtk2__Ticker_keys"
HERE

sub INIT_INSTANCE {
  my ($self) = @_;
  $self->add_events (['button-press-mask', 'key-press-mask']);
  $self->set (fixed_height_mode => 1);
  $self->set_flags ('can-focus');

lib/App/Chart/Gtk2/Ticker.pm  view on Meta::CPAN


# 'button-press-event' class closure
sub _do_button_press_event {
  my ($self, $event) = @_;
  require App::Chart::Gtk2::Ex::BindingBits;
  App::Chart::Gtk2::Ex::BindingBits::activate_button_event
      ('App__Chart__Gtk2__Ticker_keys', $event, $self);
  return shift->signal_chain_from_overridden(@_);
}

# 'menu-popup' action signal class closure
sub _do_menu_popup_action {
  my ($self, $button, $where) = @_;
  ### Ticker: "menu-popup action $button $where"

  my $position_func; # undef for mouse position if $where empty or undef
  if ($where && $where ne 'pointer') {
    $position_func = $self->can("menu_position_func_$where");
    unless ($position_func) {
      Glib->warning (undef, warn "Ticker: unrecognised menu position '$where', default to mouse pointer");
    }
  }
  my $symbol;
  if (! $where || $where eq 'pointer') {

lib/App/Chart/Gtk2/Ticker.pm  view on Meta::CPAN

          if (my $iter = $model->get_iter ($path)) {
            $symbol = $model->get($iter, $model->COL_SYMBOL);
          }
        }
      }
    }
  }
  my $menu = $self->menu;
  $menu->set_screen ($self->get_screen);
  $menu->set (symbol => $symbol);
  $menu->popup (undef,  # parent menushell
                undef,  # parent menuitem
                $position_func,
                App::Chart::Glib::Ex::MoreUtils::ref_weak($self),  # position func data
                $button,
                Gtk2->get_current_event_time);
}

# 'row-deleted' signal on symlist model
sub _do_row_deleted {
  my ($model, $path, $ref_weak_self) = @_;

lib/App/Chart/Gtk2/TickerMenu.pm  view on Meta::CPAN

  my $self = $menuitem->get_parent || return;
  my $ticker = $self->get('ticker') || return;
  $ticker->hide;
}

sub _do_intraday {
  my ($menuitem) = @_;
  my $self = $menuitem->get_parent || return;
  ### TickerMenu intraday: $self->{'symbol'}
  require  App::Chart::Gtk2::Ex::ToplevelBits;
  App::Chart::Gtk2::Ex::ToplevelBits::popup
      ('App::Chart::Gtk2::IntradayDialog',
       properties => { symbol => $self->get('symbol') },
       screen => $self);
}

# open the main chart display on the current symbol
sub _do_chart {
  my ($menuitem) = @_;
  my $self = $menuitem->get_parent || return;
  my $ticker = $self->get('ticker');
  require App::Chart::Gtk2::Main;
  my $main = App::Chart::Gtk2::Main->find_for_dialog ($ticker || $self);
  $main->goto_symbol ($self->{'symbol'}, $ticker && $ticker->get('symlist'));
  $main->present;
}

# sub popup_from_ticker {
#   my ($class_or_self, $event, $treeview) = @_;
#   my $self = ref $class_or_self ? $class_or_self : $class_or_self->instance;
# 
#   my $watchlist = $treeview->get_toplevel;
#   require Scalar::Util;
#   Scalar::Util::weaken ($self->{'watchlist'} = $watchlist);
# 
#   my ($path) = $treeview->get_path_at_pos ($event->x, $event->y);
#   if (! $path) { return; }
# 
#   my $model = $treeview->get_model;  # App::Chart::Gtk2::WatchlistModel
#   my $symlist = $model->get_symlist;
#   my $iter = $symlist->get_iter ($path);
#   my $symbol = $symlist->get_value ($iter, $model->COL_SYMBOL);
#   $self->set (symbol => $symbol,
#               symlist => $symlist);
#   $self->set_screen ($treeview->get_screen);
#   $self->popup (undef, undef, undef, undef, $event->button, $event->time);
# }

1;
__END__

=for stopwords watchlist Watchlist TickerMenu Popup undef clickable symlist

=head1 NAME

App::Chart::Gtk2::TickerMenu -- menu for ticker

lib/App/Chart/Gtk2/VacuumDialog.pm  view on Meta::CPAN

use base 'App::Chart::Gtk2::Ex::ToplevelSingleton';

use Glib::Object::Subclass
  'Gtk2::Dialog',
  signals => { destroy => \&_do_destroy };

use constant { RESPONSE_START  => 0,
               RESPONSE_STOP   => 1,
               RESPONSE_CLEAR  => 2 };

# sub popup {
#   my ($class) = @_;
#   require Gtk2::Ex::WidgetCursor;
#   Gtk2::Ex::WidgetCursor->busy;
#   my $dialog = $class->instance;
#   $dialog->present;
#   return $dialog;
# }

sub INIT_INSTANCE {
  my ($self) = @_;

lib/App/Chart/Gtk2/VacuumDialog.pm  view on Meta::CPAN

=head1 DESCRIPTION

...

=head1 FUNCTIONS

=cut

# =over 4
# 
#  App::Chart::Gtk2::VacuumDialog->popup;
# 
# =item C<< App::Chart::Gtk2::VacuumDialog->popup () >>
# 
# Popup a C<VacuumDialog> dialog.
# 
# =back



( run in 1.658 second using v1.01-cache-2.11-cpan-364913b4093 )