App-Chart

 view release on metacpan or  search on metacpan

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

#
# You should have received a copy of the GNU General Public License along
# with Chart.  If not, see <http://www.gnu.org/licenses/>.

package App::Chart::Gtk2::RawDialog;
use 5.010;
use strict;
use warnings;
use Gtk2 1.220;
use Locale::TextDomain 1.18;
use Locale::TextDomain 'App-Chart';
use List::Util qw(min max);

use Gtk2::Ex::Datasheet::DBI;
use Gtk2::Ex::WidgetCursor;

use Gtk2::Ex::Units;

# hack for Gtk2::Ex::Datasheet::DBI 2.1
{ package Gtk2::Ex::Datasheet::DBI::CellRendererText;
  sub GET_SIZE {
    my ($self, $widget, $cell_area) = @_;
    return $self->SUPER::GET_SIZE ($widget, $cell_area);
  }
}

use App::Chart::Gtk2::Ex::NotebookLazyPages;
use App::Chart::Gtk2::GUI;
use App::Chart::Intraday;
use App::Chart::Gtk2::SeriesTreeView;
use App::Chart::Gtk2::RawLatest;
use App::Chart::Gtk2::RawInfo;

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


use Glib::Object::Subclass
  'Gtk2::Dialog',
  properties => [Glib::ParamSpec->string
                 ('symbol',
                   __('Symbol'),
                  'The symbol to display.',
                  '', # default
                  Glib::G_PARAM_READWRITE),];


use constant { RESPONSE_INSERT  => 0,
               RESPONSE_DELETE  => 1,
               RESPONSE_APPLY   => 2,
               RESPONSE_UNDO    => 3,
               RESPONSE_REFRESH => 4,
             };

# sub _do_edited {
#   my ($cell, $pathstr, $newstr, $self) = @_;
#   my $path = Gtk2::TreePath->new_from_string ($pathstr);
#   my $model = $self->{'model'};
#   my $treeview = $self->{'treeview'};
#   my $iter = $model->get_iter ($path);
#   my ($treepath, $treeviewcolumn) = $treeview->get_cursor;
#   my $col = $treeviewcolumn->{'model_col'};
#   $model->set_value ($iter, $col, $newstr);
# }

# sub _do_data_changed {
#   my ($self, $symbol_hash) = @_;
#   my $symbol = $self->{'symbol'};
#   if (List::Util::first {$_ eq $symbol} @symbol_list) {
#     $self->refresh;
#   }
# }

sub INIT_INSTANCE {
  my ($self) = @_;
  $self->set_title (__('Chart: RawDialog'));
  $self->{'symbol'} = ''; # default

  #   App::Chart::chart_dirbroadcast()->connect_for_object ('data-changed',
  #                                          \&_do_data_changed, $self);

  $self->add_buttons ('gtk-add'     => RESPONSE_INSERT,
                      'gtk-delete'  => RESPONSE_DELETE,
                      'gtk-apply'   => RESPONSE_APPLY,
                      'gtk-undo'    => RESPONSE_UNDO,
                      'gtk-refresh' => RESPONSE_REFRESH,
                      'gtk-close'   => 'close',
                      'gtk-help'    => 'help');
  $self->signal_connect ('response', \&_do_response);

  my $vbox = $self->vbox;

  $vbox->pack_start (Gtk2::Label->new
                     ('Warning, this dialog is not quite right.'),
                     0,0,0);

  my $notebook = $self->{'notebook'} = Gtk2::Notebook->new;
  $vbox->pack_start ($notebook, 1,1,0);

  {
    my $scrolled = Gtk2::ScrolledWindow->new;
    $notebook->append_page ($scrolled, __('Series'));
    App::Chart::Gtk2::Ex::NotebookLazyPages::set_init
        ($notebook, $scrolled, \&_init_series);
  }
  {
    my $div_vbox = Gtk2::VBox->new;
    $notebook->append_page ($div_vbox, __('Dividends'));
    App::Chart::Gtk2::Ex::NotebookLazyPages::set_init
        ($notebook, $div_vbox, \&_init_dividends);
  }
  {
    my $split_vbox = Gtk2::VBox->new;
    $notebook->append_page ($split_vbox, __('Splits'));
    App::Chart::Gtk2::Ex::NotebookLazyPages::set_init
        ($notebook, $split_vbox, \&_init_splits);
  }

  {
    my $scrolled = Gtk2::ScrolledWindow->new;
    $notebook->append_page ($scrolled, __('Latest'));



( run in 0.700 second using v1.01-cache-2.11-cpan-39bf76dae61 )