The text in the entry box (the one in the dialog that opens up on clicking ‘+’ at the bottom of style dialog) determines the value of ‘class’ attribute of an object. A default text value shows up in the dialog box if no object is selected in the drawing.
In case, one object is selected, by default its id shows up in the text dialog. The user can change this text if he/she wishes.
However, if two or more objects are selected, then the text value in the entry box contains id of each of the selected objects separated by a space. In all the cases, clicking ‘Add’ adds a new selector to the treeview.
Also if some selection exists, then the class attribute of the object is set with value equal to text in the entry box. If class attribute for an object already has a value, then the new value added by the user is appended to the existing one.
_setClassAttribute(std::vector<spobject *>) is used to append the values in case multiple objects are selected. This function is called when text in the entry box has to be set up.
First thing being adding a selector to the treeview by clicking on ‘+’ at the bottom, the signal emitted by clicking the button was connected to a function, its so called slot. Clicking this button now opens up a dialog box which contains an entry box in it.
Entry box is a single line text edit field. Adding it to the dialog box posed issues like:
Gtk-WARNING **: Attempting to add a widget with type gtkmmGtkEntry to a gtkmmGtkDialog, but as a GtkBin subclass a gtkmm__GtkDialog can only contain one widget at a time; it already contains a widget of type GtkVBox
I added a Gtk::VBox to the dialog, then added the entry box to this vertical box and I got the warning emphasized above. Nothing showed up in the dialog box. Empty. After struggling quite some time to solve this issue, I studied the source file of Dialog class. Some answers online showed usage of get_content_area() which however does not exist for the Dialog class now.
Studying its source file, the cause of the warning showed up. getVBox() is a function of the Dialog class, entailing the fact that it already has one. Solved the issue and added entry widget to the dialog. Besides, I added a button clicking which a selector with name equal to text in entry box will be added to the treeview of the style dialog.