Adding a Panel - Part II

From Synfig Studio :: Documentation
Jump to: navigation, search
  These are highly out of date please note that the directory "gtkmm" has been renamed to "gui", 
  Panel is now know has Dock. Also, some files were moved into subfolders, take a look 
  inside the "gui/docks" folder is a good start to understand how Docks and Dockable Class work.

Adding Widgets

This example will show how to add widgets to the boring panel that was made in 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.


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..

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.


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()