bool Liveplay::on_keyboard_arrows(GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval, GdkModifierType modifier, Liveplay& self) { if (keyval == GDK_KEY_Left || keyval == GDK_KEY_Right) { Gtk::Adjustment *a = self.brightness_slider->get_adjustment(); double val = a->get_value(); double step = a->get_step_increment(); if (keyval == GDK_KEY_Left) { val -= step; } else { val += step; } a->set_value(val); } else { Gtk::Adjustment *a = self.background_slider->get_adjustment(); double val = a->get_value(); double step = a->get_step_increment(); if (keyval == GDK_KEY_Down) { val -= step; } else { val += step; } a->set_value(val); } return true; }
// // 左スクロール // void ImageViewMain::scroll_left() { #ifdef _DEBUG std::cout << "ImageViewMain::scroll_left\n"; #endif Gtk::Adjustment* hadjust = m_scrwin->get_hadjustment(); if( !hadjust ) return; hadjust->set_value( MAX( 0, hadjust->get_value() - hadjust->get_step_increment() ) ); }
// // 上スクロール // void ImageViewMain::scroll_up() { #ifdef _DEBUG std::cout << "ImageViewMain::scroll_up\n"; #endif Gtk::Adjustment* vadjust = m_scrwin->get_vadjustment(); if( !vadjust ) return; vadjust->set_value( MAX( 0, vadjust->get_value() - vadjust->get_step_increment() ) ); }
// // 右スクロール // void ImageViewMain::scroll_right() { #ifdef _DEBUG std::cout << "ImageViewMain::scroll_right\n"; #endif Gtk::Adjustment* hadjust = m_scrwin->get_hadjustment(); if( !hadjust ) return; hadjust->set_value( MIN( hadjust->get_upper() - hadjust->get_page_size(), hadjust->get_value() + hadjust->get_step_increment() ) ); }
// // 下スクロール // void ImageViewMain::scroll_down() { #ifdef _DEBUG std::cout << "ImageViewMain::scroll_down\n"; #endif Gtk::Adjustment* vadjust = m_scrwin->get_vadjustment(); if( !vadjust ) return; vadjust->set_value( MIN( vadjust->get_upper() - vadjust->get_page_size(), vadjust->get_value() + vadjust->get_step_increment() ) ); }