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

📄 fontselection.cc

📁 gfc编程示例 gfc sample of Linux GFC
💻 CC
字号:
#include "fontselection.hh"#include <gfc/gtk/box.hh>#include <gfc/gtk/button.hh>#include <gfc/gtk/fontselection.hh>#include <gfc/pango/font.hh>#include <iostream>FontSelectionWindow::FontSelectionWindow(){	// Sets the border width of the window.	set_title("Font Selecton Example");	set_border_width(10);	Gtk::VBox *vbox = new Gtk::VBox;	add(*vbox);	// Create a label and add it to the vbox	label = new Gtk::Label("Welcome to GFC");	label->set_size_request(300, 100);	vbox->pack_start(*label);	// Creates a new button and add it to the vbox	Gtk::Button *button = new Gtk::Button("Select a font");	vbox->pack_start(*button);	// When the button receives the "clicked" signal, it calls the on_select_font() slot.	button->sig_clicked().connect(sigc::mem_fun(this, &FontSelectionWindow::on_select_font));	// The final step is to display this newly created widgets.	vbox->show_all();}FontSelectionWindow::~FontSelectionWindow(){}voidFontSelectionWindow::on_select_font(){	// Create a temporary FontSelectionDialog on the stack	Gtk::FontSelectionDialog dialog("Select a font");	// Call Gtk::Dialog::run() which runs a modal dialog	if (dialog.run())	{		// Get the selected font name		String font_name = dialog.get_font_name();		// Print the font name to the standard output		std::cout << "The selected font name is \"" << font_name << "\"" << std::endl;				// Modify the label's font and destroy the dialog		Pango::FontDescription font_desc(font_name);		label->modify_font(&font_desc);		dialog.dispose();	}}int main (int argc, char *argv[]){	using namespace Main;	init(&argc, &argv);	FontSelectionWindow 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 + -