📄 wastetimewindow.cc
字号:
#include "WasteTimeWindow.h"#include <iostream>using namespace std;WasteTimeWindow::WasteTimeWindow( BaseObjectType* base_object, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml) : Gtk::Window(base_object){ // Get the progress bar widget and change it to "activity mode", // i.e. a block that bounces back and forth instead of a normal // progress bar that fills to completion. glade_xml->get_widget("Progress Bar", d_progress_bar); // d_progress_bar = // dynamic_cast<Gtk::ProgressBar*>(what_a_waste->get_widget("Progress Bar")); d_progress_bar->pulse(); // Add a timeout to update the progress bar every 100 milliseconds or so d_timeout_function_connection = Glib::signal_timeout().connect( sigc::mem_fun(*this, &WasteTimeWindow::update_progress_bar), 100);}WasteTimeWindow::~WasteTimeWindow(){ d_timeout_function_connection.disconnect();}boolWasteTimeWindow::on_delete_event(GdkEventAny* event){ // Tell the user how much time they used cout << "You wasted " << d_wasted_time_tracker.elapsed() << " seconds with this program." << endl; // Calling hide() on an object that was passed to Gtk::Main::Run() causes // Gtk:Main::Quit() to be called. hide(); // No other handlers need be called... return true;}boolWasteTimeWindow::update_progress_bar(){ d_progress_bar->pulse(); // Return true so the function will be called again; returning false removes // this timeout function. return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -