Show CFileMenu.h syntax highlighted
#ifndef __CFILEMENU_H__
#define __CFILEMENU_H__
#include <osgIntrospectionToolKit/signalslib.hpp>
#include <string>
#include <QtGui/QMenu>
#include <osg/Node>
#define UNTITLED_OSGFILENAME "untitled.osg"
namespace osgDesigner
{
class CFileMenu : public QMenu
{
Q_OBJECT
public:
CFileMenu();
virtual ~CFileMenu();
bool openFile(const std::string& filename);
bool saveFile();
bool saveFile(const std::string& fileName, bool setCurrent = true);
const std::string& getCurrentOsgFilename() const;
void setCurrentOsgFileName(const std::string& fileName);
// ** Action Accessor
QAction * actionNew();
QAction * actionOpen();
QAction * actionSave();
QAction * actionClose();
///////////////////////////////////
// ** Static Utility Function ** //
///////////////////////////////////
static osg::Node* getNodeFromFile(const std::string& fileName);
// static osg::Image* getImageFromFile(const std::string& fileName);
static bool chooseOsgFileOpenDialog(std::string& fileName);
static bool chooseOsgFileOpenDialog(std::string& fileName, const std::string& lastOpenDirectory);
static bool chooseOsgFileSaveDialog(std::string& fileName, const std::string& currentOsgFileName);
public slots:
void actionNewSlot();
void actionOpenSlot();
void actionRecentsSlot(QAction * action);
void actionSaveSlot();
void actionSaveAsSlot();
void actionCloseSlot();
void actionQuitSlot();
private:
void _refreshRecentFileMenu();
bool _showSaveFileAsDialog();
bool _showSaveBeforeCloseDialog();
void _retranslateUi(CFileMenu * fileMenu);
std::string _currentOsgFileName;
QAction * _actionNew;
QAction * _actionOpen;
QMenu * _menuRecents;
QAction * _actionSave;
QAction * _actionSaveAs;
QAction * _actionClose;
QAction * _actionQuit;
};
inline QAction * CFileMenu::actionNew()
{ return (_actionNew); }
inline QAction * CFileMenu::actionOpen()
{ return (_actionOpen); }
inline QAction * CFileMenu::actionSave()
{ return (_actionSave); }
inline QAction * CFileMenu::actionClose()
{ return (_actionClose); }
}
#endif /*CFILEMENU_H_*/
See more files for this project here