Skip to content
Snippets Groups Projects
Commit b229a6d8 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

*** empty log message ***

parent e5b496f0
No related branches found
No related tags found
No related merge requests found
...@@ -294,7 +294,7 @@ fileDialogs${OBJEXT}: fileDialogs.cpp ../Common/GmshConfig.h \ ...@@ -294,7 +294,7 @@ fileDialogs${OBJEXT}: fileDialogs.cpp ../Common/GmshConfig.h \
../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h \ ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/SPoint2.h ../Geo/SVector3.h \
../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SPoint3.h \ ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/SPoint3.h \
../Geo/SBoundingBox3d.h ../Common/Context.h ../Geo/CGNSOptions.h \ ../Geo/SBoundingBox3d.h ../Common/Context.h ../Geo/CGNSOptions.h \
../Mesh/meshPartitionOptions.h fileChooser.h ../Mesh/meshPartitionOptions.h
extraDialogs${OBJEXT}: extraDialogs.cpp GUI.h paletteWindow.h \ extraDialogs${OBJEXT}: extraDialogs.cpp GUI.h paletteWindow.h \
../Common/GmshDefines.h ../Common/OpenFile.h ../Common/CreateFile.h \ ../Common/GmshDefines.h ../Common/OpenFile.h ../Common/CreateFile.h \
../Common/Options.h ../Post/ColorTable.h Draw.h ../Geo/GModel.h \ ../Common/Options.h ../Post/ColorTable.h Draw.h ../Geo/GModel.h \
......
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
#ifndef _FILE_PICKER_H_
#define _FILE_PICKER_H_
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_File_Input.H>
// The FLTK team doesn't want to add a position() method to the file
// chooser, so we have to derive our own. To make things worse, the
// original file chooser doesn't expose its window to the world, so
// we need to use a cheap hack to get to it. Even worse is the hack
// used to get the focus on the file input widget. Sigh...
class fileChooser : public Fl_File_Chooser {
private:
Fl_Window *_win;
Fl_File_Input *_in;
public:
fileChooser(const char *d, const char *p, int t, const char *title)
: Fl_File_Chooser(d, p, t, title)
{
_win = dynamic_cast<Fl_Window*>(newButton->parent()->parent());
_in = dynamic_cast<Fl_File_Input *>(previewButton->parent()->parent()->resizable());
}
void show()
{
if(_win){
_win->show();
rescan(); // necessary since fltk 1.1.7
if(_in)
_in->take_focus();
else
_win->take_focus();
}
else
Fl_File_Chooser::show();
}
void position(int x, int y){ if(_win) _win->position(x,y); }
int x(){ if(_win) return _win->x(); else return 100; }
int y(){ if(_win) return _win->y(); else return 100; }
};
#endif
...@@ -34,7 +34,39 @@ ...@@ -34,7 +34,39 @@
#include <FL/Fl_Native_File_Chooser.H> #include <FL/Fl_Native_File_Chooser.H>
static Fl_Native_File_Chooser *fc = 0; static Fl_Native_File_Chooser *fc = 0;
#else #else
#include "fileChooser.h" #include <FL/Fl_File_Chooser.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_File_Input.H>
class fileChooser : public Fl_File_Chooser {
// we derive our own so we can set its position (The original file
// chooser doesn't expose its window to the world, so we need to use
// a cheap hack to get to it. Even worse is the hack used to get the
// focus on the file input widget.)
private:
Fl_Window *_win;
Fl_File_Input *_in;
public:
fileChooser(const char *d, const char *p, int t, const char *title)
: Fl_File_Chooser(d, p, t, title)
{
_win = dynamic_cast<Fl_Window*>(newButton->parent()->parent());
_in = dynamic_cast<Fl_File_Input *>(previewButton->parent()->parent()->resizable());
}
void show()
{
if(_win){
_win->show();
rescan(); // necessary since fltk 1.1.7
if(_in) _in->take_focus();
else _win->take_focus();
}
else
Fl_File_Chooser::show();
}
void position(int x, int y){ if(_win) _win->position(x,y); }
int x(){ if(_win) return _win->x(); else return 100; }
int y(){ if(_win) return _win->y(); else return 100; }
};
static fileChooser *fc = 0; static fileChooser *fc = 0;
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment