Dev:Adding a Panel - Part II

From Synfig Studio :: Documentation
Revision as of 10:47, 21 April 2008 by PaulWise (Talk | contribs)

Jump to: navigation, search

Adding Widgets

This example will show how to add widgets to the boring panel that was made in Part I.

Source:Adding_a_Panel-Part_I

Defined in <gtkmm dir>dockable.h file, The only widgets defined are the "toolbar" and "toolbarbutton" so I will show these first. Then use some of the other widgets in the "canvasarea" and show how the toolbutton(s) can work together with the widgets in the "canvasarea" to modify, change or create items or parameters in Synfig Studio.

ADDING A TOOL BAR BUTTON

To use a toolbar button in your panel add this section of code to the class and function.

FILE: <mod dir>boringedit.h

CLASS: class Dock_BoringEdit : public Dockable

void on_add_pressed();

FILE: <mod dir>boringedit.cpp

FUNCTION: dock_BoringEdit::Dock_BoringEdit()

The button icon can be changed to any of the stock id icons. Here we have it set to "gtk-add". The link shows the GTK name, just use "gtk-about", "gtk-bold", "gtk-apply" in that fashion etc..

http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/namespaceGtk_1_1Stock.html#bf965c1d305e2880ac77f830477bb282

This function can be added as many times as you want. The widget will create a drop down box if widget(s) are larger than GUI allows.

add_button(
		Gtk::StockID("gtk-add"),
		_("Get Bline")
	)->signal_clicked().connect(
		sigc::mem_fun(
			*this,
			&Dock_BoringEdit::on_add_pressed
		)
	);

Then add this stub function "on_add_pressed" which will do noting except be a place holder for the signal of button(s).

void Dock_BoringEdit::on_add_pressed()
{
}


NOT FINISHED YET..