sptk2 logo
SPTK Home Page
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
sptk::CFileDialog Class Reference

Base class for CFileOpenDialog and CFileSaveDialog. More...

#include <CFileDialog.h>

Inheritance diagram for sptk::CFileDialog:
sptk::CDialog sptk::CWindow sptk::CLayoutManager sptk::CWindowShape sptk::CLayoutClient sptk::CDirOpenDialog sptk::CFileOpenDialog sptk::CFileSaveDialog

Public Member Functions

String directory () const
 
void directory (const String &p)
 
void clearPatterns ()
 
void setPattern (const String &patternName)
 
void addPattern (const String &patternName, const String &pattern)
 
String pattern () const
 
void refreshDirectory (const String &dirName="")
 
String fileName () const
 
String fullFileName () const
 
void fileName (const String &fileName)
 
bool execute ()
 
- Public Member Functions inherited from sptk::CDialog
 CDialog (int w, int h, const char *label=nullptr)
 
 ~CDialog () override
 
virtual bool reset ()
 
int handle (int event) override
 
bool showModal ()
 
void alert (const String &s) const
 
void defaultButton (CButton *btn)
 
virtual void database (PoolDatabaseConnection *db)
 
PoolDatabaseConnectiondatabase () const
 
void table (const String &tableName)
 
String table () const
 
void table (PoolDatabaseConnection *db, const String &tableName, const String &keyFieldName)
 Fast setup of the database connection. More...
 
void keyField (const String &keyFieldName)
 
String keyField () const
 
void keyValue (int val)
 
int keyValue () const
 
virtual Fl_Group * newPage (const char *label, bool autoColor)
 
virtual Fl_Group * newScroll (const char *label, bool autoColor)
 
CButtonaddExtraButton (CButtonKind buttonKind, const char *label, Fl_Callback_p callback)
 
uint32_t fieldCount () const
 
CControloperator[] (const String &fieldName)
 Index operator to access controls with defined field name. More...
 
void rescan ()
 Makes dialog to scan the widgets inside.
 
void load (const xdoc::SNode &node) override
 
void save (const xdoc::SNode &node) const override
 
CDialogModalResult modalResult () const
 
String className () const override
 Returns widget class name (internal SPTK RTTI). More...
 
- Public Member Functions inherited from sptk::CWindow
 CWindow (int w, int h, const char *label=0L)
 Constructor. More...
 
 CWindow (int x, int y, int w, int h, const char *label=0L)
 Constructor. More...
 
void draw () override
 Draws a window, including an optional background image.
 
void show () override
 Custom show method.
 
void show (int argc, char *argv[])
 Custom show method. More...
 
void hide () override
 Custom hide method.
 
virtual void relayout ()
 Relayouts window's widgets that have CLayoutClient interface.
 
void clear () override
 Removes all the widgets inside the window. More...
 
void resize (int x, int y, int w, int h) override
 Resizes the window and inside widgets. More...
 
bool preferredSize (int &w, int &h) override
 Computes the optimal window size. More...
 
int handle (int event) override
 Custom window events handle. More...
 
void load (const std::shared_ptr< xdoc::Node > &node, CLayoutXMLmode xmlMode) override
 Loads window coordinates and widgets from XML node. More...
 
void load (const std::shared_ptr< xdoc::Node > &node) override
 Loads window coordinates and widgets from XML node. More...
 
void save (const std::shared_ptr< xdoc::Node > &node, CLayoutXMLmode xmlMode) const override
 Saves window coordinates and widgets into XML node. More...
 
virtual void save (const xdoc::SNode &node) const
 Saves window coordinates and widgets into XML node. More...
 
void loadPosition (const xdoc::SNode &node)
 Loads the window position from XML node. More...
 
void savePosition (const xdoc::SNode &node) const
 Saves the window position into XML node. More...
 
const Stringlabel () const override
 Returns the current label. More...
 
String className () const override
 Returns widget class name (internal SPTK RTTI). More...
 
virtual void label (const String &l)
 
virtual const Stringlabel () const
 
- Public Member Functions inherited from sptk::CLayoutManager
 CLayoutManager (Fl_Group *group, int layoutSize, CLayoutAlign ca)
 
 ~CLayoutManager () override=default
 
virtual void clear ()
 Removes all the children. More...
 
int layoutSpacing () const
 
void layoutSpacing (int ls)
 
void layoutGrowMode (CLayoutGrowMode gm=CLayoutGrowMode::LGM_AUTO_GROW)
 
CLayoutGrowMode layoutGrowMode () const
 
void relayout ()
 
void frame (CFrame *frame, bool drawBackground=true)
 Defines frame. More...
 
const CFrameframe () const
 Returnes the current frame.
 
uint32_t frameWidth () const
 Returns frame width.
 
virtual void loadLayout (const xdoc::SNode &node, CLayoutXMLmode xmlMode)
 Loads group controls data from XML node. More...
 
virtual void saveLayout (const xdoc::SNode &node, CLayoutXMLmode xmlMode) const
 Saves group controls data into XML node. More...
 
void nameIndex (CWidgetNamesMap &index, bool recursive, bool clean=true) const
 Builds an index of internal widget names. More...
 
bool noXml () const
 Returns flag of blocking XML processing. More...
 
void noXml (bool noXml)
 Sets flag of blocking XML processing. More...
 
- Public Member Functions inherited from sptk::CLayoutClient
 CLayoutClient (Fl_Widget *widget, int layoutSize, CLayoutAlign ca)
 
virtual ~CLayoutClient ()
 
CLayoutAlign layoutAlign () const
 
void layoutAlign (CLayoutAlign al)
 
int layoutSize () const
 
void layoutSize (int ls)
 
virtual void label (const String &l)
 
virtual const Stringlabel () const
 
void name (const char *aname)
 
void name (const String &aname)
 
const Stringname () const
 
virtual bool preferredSize (int &w, int &h)
 
virtual bool computeSize (int &w, int &h)
 
virtual String className () const
 
Fl_Widget * widget () const
 
virtual void load (const xdoc::SNode &node, CLayoutXMLmode xmlMode)
 
virtual void load (const std::shared_ptr< xdoc::Node > &node)
 
virtual void save (const std::shared_ptr< xdoc::Node > &node, CLayoutXMLmode xmlMode) const
 
- Public Member Functions inherited from sptk::CWindowShape
 CWindowShape (sptk::CWindow *window)
 Constructor. More...
 
virtual ~CWindowShape ()
 Destructor.
 
bool shapeResizing ()
 Returns true if the window is resizing as a result of border drag. More...
 

Protected Member Functions

void createFolder ()
 
 CFileDialog (const String &label, bool saveMode)
 
- Protected Member Functions inherited from sptk::CDialog
virtual bool okPressed ()
 
virtual bool cancelPressed ()
 
virtual void scanControls ()
 
virtual bool buildQueries ()
 
virtual bool load ()
 
virtual bool save ()
 
- Protected Member Functions inherited from sptk::CLayoutManager
bool autoLayout (int x, int y, int &w, int &h, bool resizeWidgets) const
 
virtual void paintBackground ()
 
- Protected Member Functions inherited from sptk::CLayoutClient
int lastPreferredH () const
 
int lastPreferredW () const
 
void lastPreferredH (int height)
 
void lastPreferredW (int width)
 
- Protected Member Functions inherited from sptk::CWindowShape
int mouseZone (int mouseX, int mouseY) const
 Computes mouse zone from window coordinates. More...
 
void changeSize (int mouseX, int mouseY)
 Resizes the window based on mouse zone and mouse screen coordinates. More...
 
virtual int shapeCursorHandle (int event)
 Changes the window cursor based on the mouse position in the window. More...
 
void initShapeExtension ()
 Initializes shape extension. More...
 
bool borderCleared () const
 Returns true if border was cleared for the shape.
 
void shapeApply ()
 Sets the shape to the window during window->draw()
 
void resizingShape (int w, int h)
 Calls resizeShape() from inside CWindow::resize()
 
virtual void shapeResize (int w, int h)
 Shape resize. More...
 

Static Protected Member Functions

static String removeTrailingSlash (const String &dirname)
 Removes a trailing slash in the directory name. More...
 
static void new_folder_cb (Fl_Widget *, void *)
 
static void home_cb (Fl_Widget *, void *)
 
static void up_cb (Fl_Widget *, void *)
 
static void dirview_cb (Fl_Widget *w, void *)
 
static void lookin_cb (Fl_Widget *w, void *)
 
static void pattern_cb (Fl_Widget *w, void *)
 

Protected Attributes

DirectoryDS m_directory
 
CListViewm_directoryView
 
CComboBoxm_lookInCombo
 
CInputm_fileNameInput
 
CComboBoxm_patternCombo
 
- Protected Attributes inherited from sptk::CDialog
CButtonm_okButton
 
CButtonm_cancelButton
 
CButtonm_defaultButton
 
String m_tableName
 
String m_keyField
 
int m_keyValue
 
CControlList m_defaultFields
 
CControlList m_allFields
 
CGroupm_buttonGroup
 
CDialogTabsm_pages
 
Querym_selectQuery
 
Querym_updateQuery
 
Querym_insertQuery
 
bool m_queriesBuilt
 
bool m_controlsScanned
 
CControlList m_specialProcessingControls
 
CDialogModalResult m_modalResult
 
- Protected Attributes inherited from sptk::CLayoutManager
int m_layoutSpacing
 
CLayoutGrowMode m_layoutGrowMode
 
Fl_Group * m_group
 
CFramem_frame
 
bool m_frameDrawBackground
 
bool m_noXml
 
- Protected Attributes inherited from sptk::CLayoutClient
Fl_Widget * m_widget
 
String m_name
 
String m_label
 
CLayoutAlign m_layoutAlign
 
- Protected Attributes inherited from sptk::CWindowShape
int m_resizingZone {0}
 
int m_pushedX {0}
 
int m_pushedY {0}
 
std::vector< CShapePointm_shapePoints
 
bool m_shapeChanged {true}
 
int m_borderWidth {6}
 
bool m_borderCleared {false}
 
bool m_shapeExtension {false}
 

Static Protected Attributes

static const char slashChar
 
static const char slashStr []
 
- Static Protected Attributes inherited from sptk::CLayoutManager
static std::map< std::string, Fl_Boxtype > m_boxTypeNames
 
static createControlCallbackMap controlCreator
 

Additional Inherited Members

- Static Public Member Functions inherited from sptk::CLayoutManager
static void registerControl (std::string typeName, createControlCallback creator) noexcept
 Register control type for loading layouts. More...
 
static const std::map< std::string, Fl_Boxtype > & boxTypeNames ()
 Returns a read-only map of box type names and corresponding constants.
 

Detailed Description

Base class for CFileOpenDialog and CFileSaveDialog.

Actually implements most of these classes functionality. Can't be used by itself, only as a base class.

Constructor & Destructor Documentation

◆ CFileDialog()

sptk::CFileDialog::CFileDialog ( const String label,
bool  saveMode 
)
protected

Constructor

Parameters
labelWindow caption
saveModeTrue for File Save Dialog and false for File Open Dialog.

Member Function Documentation

◆ addPattern()

void sptk::CFileDialog::addPattern ( const String patternName,
const String pattern 
)

Adds the file name patern to the pattern combo box

Parameters
patternNameThe name of the pattern, like "All files"
patternOne or more the patterns, separated with semicolon like "*.cpp;*.cxx"

◆ clearPatterns()

void sptk::CFileDialog::clearPatterns ( )

Removes all the defined file name paterns

◆ createFolder()

void sptk::CFileDialog::createFolder ( )
protected

Creates a new folder. The folder name is asked interactively.

◆ directory() [1/2]

String sptk::CFileDialog::directory ( ) const
inline

Returns the dialog's current directory

References sptk::DirectoryDS::directory().

◆ directory() [2/2]

void sptk::CFileDialog::directory ( const String p)

Sets the dialog's current directory

◆ dirview_cb()

static void sptk::CFileDialog::dirview_cb ( Fl_Widget *  w,
void *   
)
staticprotected

Internal directory double-clicked callback

◆ execute()

bool sptk::CFileDialog::execute ( )

Initializes the dialog and shows it in the modal mode

◆ fileName() [1/2]

String sptk::CFileDialog::fileName ( ) const
inline

Returns the list of currently selected files without the full path, as a simicolon-separated string.

Returns
The list of the selected file names.

References sptk::VariantAdaptors::asString(), and sptk::CInput::data().

◆ fileName() [2/2]

void sptk::CFileDialog::fileName ( const String fileName)

Set the currently selected file name in edit entry

Parameters
fileNameThe name of the file.

◆ fullFileName()

String sptk::CFileDialog::fullFileName ( ) const

Returns the list of currently selected files with the full path, as a simicolon-separated string

Returns
The list of the selected full file names.

◆ home_cb()

static void sptk::CFileDialog::home_cb ( Fl_Widget *  ,
void *   
)
staticprotected

Internal home button callback

◆ lookin_cb()

static void sptk::CFileDialog::lookin_cb ( Fl_Widget *  w,
void *   
)
staticprotected

Internal look-in combo callback

◆ new_folder_cb()

static void sptk::CFileDialog::new_folder_cb ( Fl_Widget *  ,
void *   
)
staticprotected

Internal create folder button callback

◆ pattern()

String sptk::CFileDialog::pattern ( ) const

Returns currently selected pattern

◆ pattern_cb()

static void sptk::CFileDialog::pattern_cb ( Fl_Widget *  w,
void *   
)
staticprotected

Internal pattern combo callback

◆ refreshDirectory()

void sptk::CFileDialog::refreshDirectory ( const String dirName = "")

Sets the new directory, if parameter dir is defined, and reloads the file list.

Parameters
dirNameThe name of the directory

◆ removeTrailingSlash()

static String sptk::CFileDialog::removeTrailingSlash ( const String dirname)
staticprotected

Removes a trailing slash in the directory name.

Parameters
dirnameDirectory name

◆ setPattern()

void sptk::CFileDialog::setPattern ( const String patternName)

Sets the file name patern in pattern combo box

Parameters
patternNameThe name of the pattern as defined in call of addPattern()

◆ up_cb()

static void sptk::CFileDialog::up_cb ( Fl_Widget *  ,
void *   
)
staticprotected

Internal go up button callback

Member Data Documentation

◆ m_directory

DirectoryDS sptk::CFileDialog::m_directory
protected

Directory Dataset

◆ m_directoryView

CListView* sptk::CFileDialog::m_directoryView
protected

File list in the directory

◆ m_fileNameInput

CInput* sptk::CFileDialog::m_fileNameInput
protected

The file name input box

◆ m_lookInCombo

CComboBox* sptk::CFileDialog::m_lookInCombo
protected

The combo with the list of the lookup directories

◆ m_patternCombo

CComboBox* sptk::CFileDialog::m_patternCombo
protected

The file mask (pattern) selection combo

◆ slashChar

const char sptk::CFileDialog::slashChar
staticprotected

Default slash character, '\' on Windows and '/' on Unux.

◆ slashStr

const char sptk::CFileDialog::slashStr[]
staticprotected

Default slash character string, "\\" on Windows and "/" on Unux.


The documentation for this class was generated from the following file:

Fri Oct 14 2022 09:58:36: SPTK 5.4.1