46 #ifdef CHECK_MEMORY_LEAKS
48 #endif // CHECK_MEMORY_LEAKS
72 const FXString& title,
74 const std::vector<
GUIGlID>& ids,
76 FXMainWindow(parent->getApp(), title, icon, NULL, DECOR_ALL, 20, 20, 300, 300),
81 FXVerticalFrame* layout1 =
new FXVerticalFrame(hbox, LAYOUT_FILL_X | LAYOUT_FILL_Y | LAYOUT_TOP, 0, 0, 0, 0, 4, 4, 4, 4);
83 FXVerticalFrame* style1 =
new FXVerticalFrame(layout1, LAYOUT_FILL_X | LAYOUT_FILL_Y | LAYOUT_TOP | FRAME_THICK | FRAME_SUNKEN, 0, 0, 0, 0, 0, 0, 0, 0);
84 myList =
new FXList(style1,
this,
MID_CHOOSER_LIST, LAYOUT_FILL_X | LAYOUT_FILL_Y | LIST_SINGLESELECT | FRAME_SUNKEN | FRAME_THICK);
85 for (std::vector<GUIGlID>::const_iterator i = ids.begin(); i != ids.end(); ++i) {
91 bool selected = myParent->isSelected(o);
94 myList->appendItem(name.c_str(), icon, (
void*) & (*myIDs.find(o->
getGlID())));
95 glStorage.unblockObject(*i);
98 FXVerticalFrame* layout =
new FXVerticalFrame(hbox, LAYOUT_TOP, 0, 0, 0, 0, 4, 4, 4, 4);
100 this,
MID_CHOOSER_CENTER, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
101 0, 0, 0, 0, 4, 4, 4, 4);
102 new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X);
104 this,
MID_CHOOSER_FILTER, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
105 0, 0, 0, 0, 4, 4, 4, 4);
106 new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X);
108 this,
MID_CANCEL, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
109 0, 0, 0, 0, 4, 4, 4, 4);
111 myParent->getParent()->addChild(
this);
122 FXMainWindow::show();
129 int selected =
myList->getCurrentItem();
148 if (
myList->getNumItems() > 0) {
155 myList->makeItemVisible(
id);
157 myList->setCurrentItem(
id,
true);
165 int current =
myList->getCurrentItem();
166 if (current >= 0 &&
myList->isItemSelected(current)) {
176 FXEvent*
event = (FXEvent*)ptr;
177 switch (event->code) {
191 std::vector<GUIGlID> selectedGlIDs;
192 std::vector<FXString> selectedMicrosimIDs;
193 const int numItems =
myList->getNumItems();
194 for (
int i = 0; i < numItems; i++) {
197 selectedGlIDs.push_back(glID);
198 selectedMicrosimIDs.push_back(
myList->getItemText(i));
202 const int numSelected = (
const int)selectedGlIDs.size();
203 for (
int i = 0; i < numSelected; i++) {
204 myList->appendItem(selectedMicrosimIDs[i], flag, (
void*) & (*
myIDs.find(selectedGlIDs[i])));
void show()
sets the focus after the window is created to work-around bug in libfox
long onCmdFilter(FXObject *, FXSelector, void *)
Callback: Hides unselected items if pressed.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
~GUIDialog_GLObjChooser()
Destructor.
long onCmdCenter(FXObject *, FXSelector, void *)
Callback: The selected item shall be centered within the calling view.
FXDEFMAP(GUIDialog_GLObjChooser) GUIDialog_GLObjChooserMap[]
long onCmdText(FXObject *, FXSelector, void *)
Callback: Selects to current item if enter is pressed.
GUIGlID getGlID() const
Returns the numerical id of the object.
const unsigned char flag[]
GUIMainWindow * getParent()
Returns the main window.
FXList * myList
The list that holds the ids.
GUIGlChildWindow * myParent
The parent window.
void removeChild(FXMDIChild *child)
removes the given child window from the list
A storage for of displayed objects via their numerical id.
long onCmdClose(FXObject *, FXSelector, void *)
Callback: The dialog shall be closed.
void setView(GUIGlID id)
Centers the view onto the given artifact.
FXButton * myCenterButton
The button that triggers centering on the select object.
std::set< GUIGlID > myIDs
myList contains (void) pointers to elements of myIDs instead of the more
long onListKeyPress(FXObject *, FXSelector, void *)
Callback: Selects to current item if enter is pressed.
static FXIcon * getIcon(GUIIcon which)
FXTextField * myTextEntry
The text field.
long onChgText(FXObject *, FXSelector, void *)
Callback: Something has been typed into the the field.