⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helloworld2.cc

📁 gfc编程示例 gfc sample of Linux GFC
💻 CC
字号:
#include "helloworld2.hh"#include <gfc/gtk/box.hh>#include <gfc/gtk/button.hh>#include <iostream>HelloWorld2::HelloWorld2(){	// This is a new call, which just sets the title of our new window to "Hello Buttons!"	set_title("Hello Buttons!");	// Sets the border width of the window.	set_border_width(10);	// We create a box to pack widgets into. The box is not really visible, it is just used	// as a tool to arrange widgets.	Gtk::HBox *box1 = new Gtk::HBox;	// Put the box into the main window.	add(*box1);	// Creates a new button with the label "Button 1".	Gtk::Button *button = new Gtk::Button("Button 1");	// Now when the button is clicked, we call the slot function with a pointer to "button 1" bound to it.	button->sig_clicked().connect(sigc::bind(sigc::mem_fun(this, &HelloWorld2::on_clicked), "button 1"));	// Instead of Gtk::Container::add, we pack this button into the invisible box, which has been added to the window.	box1->pack_start(*button);	// Always remember this step, this tells Inti that our preparation for this button is complete,	// and it can now be displayed.	button->show();	// Do these same steps again to create a second button	button = new Gtk::Button("Button 2");	// Call the same slot function with a different argument, passing a pointer to "button 2" instead. 	button->sig_clicked().connect(sigc::bind(sigc::mem_fun(this, &HelloWorld2::on_clicked), "button 2"));	box1->pack_start(*button);	// The order in which we show the buttons is not really important, but Irecommend showing the window last,	// so it all pops up at once.	button->show();	box1->show();}HelloWorld2::~HelloWorld2(){}voidHelloWorld2::on_clicked(const char *text){	std::cout << "Hello again" << " - " << text << " " << "was pressed" << std::endl;}int main (int argc, char *argv[]){	using namespace Main;	init(&argc, &argv);	HelloWorld2 window;	window.sig_destroy().connect(sigc::ptr_fun(&GFC::Main::quit));	window.show();	run();	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -