Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::RFileDialog Class Reference

Web-based FileDialog.

web-based FileDialog.

Initial message send to client to configure layout.

Definition at line 41 of file RFileDialog.hxx.

Public Types

enum  EDialogTypes { kOpenFile , kSaveAs , kNewFile }
 

Public Member Functions

 RFileDialog (EDialogTypes kind=kOpenFile, const std::string &title="", const std::string &fname="")
 constructor When title not specified, default will be used
 
virtual ~RFileDialog ()
 destructor
 
bool GetCanChangePath () const
 Returns true if working path can be change with gui elements.
 
const std::string & GetFileName () const
 
const auto & GetNameFilters () const
 Returns array of name filters.
 
std::string GetSelectedFilter () const
 Returns selected filter Can differ from specified value - if it does not match to existing entry in NameFilters.
 
const EDialogTypesGetType () const
 
std::string GetWorkingPath () const
 Returns current working path.
 
void Hide ()
 Hide ROOT Browser.
 
bool IsCompleted () const
 
void SetCallback (RFileDialogCallback_t callback)
 Assign callback.
 
void SetCanChangePath (bool on=true)
 Configure if working path in dialog can be changed via gui elements.
 
void SetNameFilters (const std::vector< std::string > &arr)
 Set array of name filters like "Text files (*.txt)", "Any files (*)", "Image files (*png *.jpg)" Should be specified before starting dialog.
 
void SetSelectedFilter (const std::string &name)
 Configure selected filter Has to be one of the string from NameFilters entry.
 
void SetWorkingPath (const std::string &)
 Change current working path of file dialog If dialog already shown, change will be immediately applied.
 
void Show (const RWebDisplayArgs &args="")
 Show or update RFileDialog in web window If web window already started - just refresh it like "reload" button does Reset result of file selection (if any)
 

Static Public Member Functions

static std::shared_ptr< RFileDialogEmbed (const std::shared_ptr< RWebWindow > &window, unsigned connid, const std::string &args)
 Create dialog instance to use as embedded dialog inside other widget Embedded dialog started on the client side where FileDialogController.SaveAs() method called Such method immediately send message with "FILEDIALOG:" prefix On the server side widget should detect such message and call RFileDialog::Embed() providing received string as second argument.
 
static bool IsMessageToStartDialog (const std::string &msg)
 Check if this could be the message send by client to start new file dialog If returns true, one can call RFileDialog::Embedded() to really create file dialog instance inside existing widget.
 
static std::string NewFile (const std::string &title="", const std::string &fname="")
 Start NewFile dialog.
 
static std::string OpenFile (const std::string &title="", const std::string &fname="")
 Start OpenFile dialog.
 
static std::string SaveAs (const std::string &title="", const std::string &fname="")
 Start SaveAs dialog.
 

Protected Member Functions

std::string GetRegexp (const std::string &name) const
 Returns regexp for selected filter String should have form "Filter name (*.ext1 *.ext2 ...)
 
void InvokeCallBack ()
 Invoke specified callback.
 
void ProcessMsg (unsigned connid, const std::string &arg)
 Process received data from client.
 
void SendChPathMsg (unsigned connid)
 Sends new data after change current directory.
 
void SendInitMsg (unsigned connid)
 Sends initial message to the client.
 

Static Protected Member Functions

static std::string Dialog (EDialogTypes kind, const std::string &title, const std::string &fname)
 Start specified dialog type.
 
static void SetStartFunc (bool on)
 Set start dialog function for RWebWindow.
 
static std::string TypeAsString (EDialogTypes kind)
 Returns dialog type as string String value used for configuring JS-side.
 

Protected Attributes

RBrowserData fBrowsable
 ! central browsing element
 
RFileDialogCallback_t fCallback
 ! function receiving result, called once
 
bool fCanChangePath {true}
 ! if working path can be changed via gui elements
 
bool fDidSelect {false}
 ! true when dialog is selected or closed
 
EDialogTypes fKind {kOpenFile}
 ! dialog kind OpenFile, SaveAs, NewFile
 
std::vector< std::string > fNameFilters
 ! name filters
 
std::string fSelect
 ! result of file selection
 
std::string fSelectedFilter
 ! name of selected filter
 
std::string fTitle
 ! title, when not specified default will be used
 
std::shared_ptr< RWebWindowfWebWindow
 ! web window for file dialog
 

Friends

class Details::RWebWindowPlugin
 

#include <ROOT/RFileDialog.hxx>

Member Enumeration Documentation

◆ EDialogTypes

Enumerator
kOpenFile 
kSaveAs 
kNewFile 

Definition at line 45 of file RFileDialog.hxx.

Constructor & Destructor Documentation

◆ RFileDialog()

RFileDialog::RFileDialog ( EDialogTypes  kind = kOpenFile,
const std::string &  title = "",
const std::string &  fname = "" 
)

constructor When title not specified, default will be used

Definition at line 43 of file RFileDialog.cxx.

◆ ~RFileDialog()

RFileDialog::~RFileDialog ( )
virtual

destructor

Definition at line 90 of file RFileDialog.cxx.

Member Function Documentation

◆ Dialog()

std::string RFileDialog::Dialog ( EDialogTypes  kind,
const std::string &  title,
const std::string &  fname 
)
staticprotected

Start specified dialog type.

Definition at line 374 of file RFileDialog.cxx.

◆ Embed()

std::shared_ptr< RFileDialog > RFileDialog::Embed ( const std::shared_ptr< RWebWindow > &  window,
unsigned  connid,
const std::string &  args 
)
static

Create dialog instance to use as embedded dialog inside other widget Embedded dialog started on the client side where FileDialogController.SaveAs() method called Such method immediately send message with "FILEDIALOG:" prefix On the server side widget should detect such message and call RFileDialog::Embed() providing received string as second argument.

Returned instance of shared_ptr<RFileDialog> may be used to assign callback when file is selected

Definition at line 437 of file RFileDialog.cxx.

◆ GetCanChangePath()

bool ROOT::RFileDialog::GetCanChangePath ( ) const
inline

Returns true if working path can be change with gui elements.

Definition at line 100 of file RFileDialog.hxx.

◆ GetFileName()

const std::string & ROOT::RFileDialog::GetFileName ( ) const
inline

Definition at line 112 of file RFileDialog.hxx.

◆ GetNameFilters()

const auto & ROOT::RFileDialog::GetNameFilters ( ) const
inline

Returns array of name filters.

Definition at line 94 of file RFileDialog.hxx.

◆ GetRegexp()

std::string RFileDialog::GetRegexp ( const std::string &  name) const
protected

Returns regexp for selected filter String should have form "Filter name (*.ext1 *.ext2 ...)

Definition at line 191 of file RFileDialog.cxx.

◆ GetSelectedFilter()

std::string RFileDialog::GetSelectedFilter ( ) const

Returns selected filter Can differ from specified value - if it does not match to existing entry in NameFilters.

Definition at line 160 of file RFileDialog.cxx.

◆ GetType()

const EDialogTypes & ROOT::RFileDialog::GetType ( ) const
inline

Definition at line 86 of file RFileDialog.hxx.

◆ GetWorkingPath()

std::string RFileDialog::GetWorkingPath ( ) const

Returns current working path.

Definition at line 351 of file RFileDialog.cxx.

◆ Hide()

void RFileDialog::Hide ( )

Hide ROOT Browser.

Definition at line 127 of file RFileDialog.cxx.

◆ InvokeCallBack()

void RFileDialog::InvokeCallBack ( )
protected

Invoke specified callback.

Definition at line 360 of file RFileDialog.cxx.

◆ IsCompleted()

bool ROOT::RFileDialog::IsCompleted ( ) const
inline

Definition at line 111 of file RFileDialog.hxx.

◆ IsMessageToStartDialog()

bool RFileDialog::IsMessageToStartDialog ( const std::string &  msg)
static

Check if this could be the message send by client to start new file dialog If returns true, one can call RFileDialog::Embedded() to really create file dialog instance inside existing widget.

Definition at line 424 of file RFileDialog.cxx.

◆ NewFile()

std::string RFileDialog::NewFile ( const std::string &  title = "",
const std::string &  fname = "" 
)
static

Start NewFile dialog.

Blocks until file name is selected or Cancel button is pressed Returns selected file name (or empty string)

Definition at line 414 of file RFileDialog.cxx.

◆ OpenFile()

std::string RFileDialog::OpenFile ( const std::string &  title = "",
const std::string &  fname = "" 
)
static

Start OpenFile dialog.

Blocks until file name is selected or Cancel button is pressed Returns selected file name (or empty string)

Definition at line 394 of file RFileDialog.cxx.

◆ ProcessMsg()

void RFileDialog::ProcessMsg ( unsigned  connid,
const std::string &  arg 
)
protected

Process received data from client.

Definition at line 270 of file RFileDialog.cxx.

◆ SaveAs()

std::string RFileDialog::SaveAs ( const std::string &  title = "",
const std::string &  fname = "" 
)
static

Start SaveAs dialog.

Blocks until file name is selected or Cancel button is pressed Returns selected file name (or empty string)

Definition at line 404 of file RFileDialog.cxx.

◆ SendChPathMsg()

void RFileDialog::SendChPathMsg ( unsigned  connid)
protected

Sends new data after change current directory.

Definition at line 255 of file RFileDialog.cxx.

◆ SendInitMsg()

void RFileDialog::SendInitMsg ( unsigned  connid)
protected

Sends initial message to the client.

Definition at line 229 of file RFileDialog.cxx.

◆ SetCallback()

void RFileDialog::SetCallback ( RFileDialogCallback_t  callback)

Assign callback.

Argument of callback is selected file name. If file was already selected, immediately call it

Definition at line 101 of file RFileDialog.cxx.

◆ SetCanChangePath()

void ROOT::RFileDialog::SetCanChangePath ( bool  on = true)
inline

Configure if working path in dialog can be changed via gui elements.

Definition at line 97 of file RFileDialog.hxx.

◆ SetNameFilters()

void ROOT::RFileDialog::SetNameFilters ( const std::vector< std::string > &  arr)
inline

Set array of name filters like "Text files (*.txt)", "Any files (*)", "Image files (*png *.jpg)" Should be specified before starting dialog.

Definition at line 92 of file RFileDialog.hxx.

◆ SetSelectedFilter()

void RFileDialog::SetSelectedFilter ( const std::string &  name)

Configure selected filter Has to be one of the string from NameFilters entry.

Definition at line 151 of file RFileDialog.cxx.

◆ SetStartFunc()

void RFileDialog::SetStartFunc ( bool  on)
staticprotected

Set start dialog function for RWebWindow.

Definition at line 490 of file RFileDialog.cxx.

◆ SetWorkingPath()

void RFileDialog::SetWorkingPath ( const std::string &  path)

Change current working path of file dialog If dialog already shown, change will be immediately applied.

Definition at line 337 of file RFileDialog.cxx.

◆ Show()

void RFileDialog::Show ( const RWebDisplayArgs args = "")

Show or update RFileDialog in web window If web window already started - just refresh it like "reload" button does Reset result of file selection (if any)

Definition at line 113 of file RFileDialog.cxx.

◆ TypeAsString()

std::string RFileDialog::TypeAsString ( EDialogTypes  kind)
staticprotected

Returns dialog type as string String value used for configuring JS-side.

Definition at line 136 of file RFileDialog.cxx.

Friends And Related Symbol Documentation

◆ Details::RWebWindowPlugin

friend class Details::RWebWindowPlugin
friend

Definition at line 42 of file RFileDialog.hxx.

Member Data Documentation

◆ fBrowsable

RBrowserData ROOT::RFileDialog::fBrowsable
protected

! central browsing element

Definition at line 55 of file RFileDialog.hxx.

◆ fCallback

RFileDialogCallback_t ROOT::RFileDialog::fCallback
protected

! function receiving result, called once

Definition at line 64 of file RFileDialog.hxx.

◆ fCanChangePath

bool ROOT::RFileDialog::fCanChangePath {true}
protected

! if working path can be changed via gui elements

Definition at line 56 of file RFileDialog.hxx.

◆ fDidSelect

bool ROOT::RFileDialog::fDidSelect {false}
protected

! true when dialog is selected or closed

Definition at line 60 of file RFileDialog.hxx.

◆ fKind

EDialogTypes ROOT::RFileDialog::fKind {kOpenFile}
protected

! dialog kind OpenFile, SaveAs, NewFile

Definition at line 53 of file RFileDialog.hxx.

◆ fNameFilters

std::vector<std::string> ROOT::RFileDialog::fNameFilters
protected

! name filters

Definition at line 62 of file RFileDialog.hxx.

◆ fSelect

std::string ROOT::RFileDialog::fSelect
protected

! result of file selection

Definition at line 63 of file RFileDialog.hxx.

◆ fSelectedFilter

std::string ROOT::RFileDialog::fSelectedFilter
protected

! name of selected filter

Definition at line 61 of file RFileDialog.hxx.

◆ fTitle

std::string ROOT::RFileDialog::fTitle
protected

! title, when not specified default will be used

Definition at line 54 of file RFileDialog.hxx.

◆ fWebWindow

std::shared_ptr<RWebWindow> ROOT::RFileDialog::fWebWindow
protected

! web window for file dialog

Definition at line 58 of file RFileDialog.hxx.

Libraries for ROOT::RFileDialog:

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