46 #ifdef CHECK_MEMORY_LEAKS
48 #endif // CHECK_MEMORY_LEAKS
72 const FXString& title,
75 FXMainWindow(parent->getApp(), title, icon, NULL, DECOR_ALL, 20, 20, 300, 300),
79 FXVerticalFrame* layout1 =
new FXVerticalFrame(hbox, LAYOUT_FILL_X | LAYOUT_FILL_Y | LAYOUT_TOP, 0, 0, 0, 0, 4, 4, 4, 4);
81 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);
82 myList =
new FXList(style1,
this,
MID_CHOOSER_LIST, LAYOUT_FILL_X | LAYOUT_FILL_Y | LIST_SINGLESELECT | FRAME_SUNKEN | FRAME_THICK);
83 for (std::vector<GUIGlID>::const_iterator i = ids.begin(); i != ids.end(); ++i) {
89 bool selected = myParent->isSelected(o);
92 myList->appendItem(name.c_str(), icon, (
void*) & (*myIDs.find(o->
getGlID())));
93 glStorage.unblockObject(*i);
96 FXVerticalFrame* layout =
new FXVerticalFrame(hbox, LAYOUT_TOP, 0, 0, 0, 0, 4, 4, 4, 4);
98 this,
MID_CHOOSER_CENTER, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
99 0, 0, 0, 0, 4, 4, 4, 4);
100 new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X);
102 this,
MID_CHOOSER_FILTER, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
103 0, 0, 0, 0, 4, 4, 4, 4);
104 new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X);
106 this,
MID_CANCEL, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
107 0, 0, 0, 0, 4, 4, 4, 4);
109 myParent->getParent()->addChild(
this);
120 FXMainWindow::show();
127 int selected =
myList->getCurrentItem();
146 if (
myList->getNumItems() > 0) {
153 myList->makeItemVisible(
id);
155 myList->setCurrentItem(
id,
true);
163 int current =
myList->getCurrentItem();
164 if (current >= 0 &&
myList->isItemSelected(current)) {
174 FXEvent*
event = (FXEvent*)ptr;
175 switch (event->code) {
189 std::vector<GUIGlID> selectedGlIDs;
190 std::vector<FXString> selectedMicrosimIDs;
191 const int numItems =
myList->getNumItems();
192 for (
int i = 0; i < numItems; i++) {
195 selectedGlIDs.push_back(glID);
196 selectedMicrosimIDs.push_back(
myList->getItemText(i));
200 const int numSelected = (
const int)selectedGlIDs.size();
201 for (
int i = 0; i < numSelected; i++) {
202 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.