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

Web-based FileDialog.

web-based FileDialog.

Initial message send to client to configure layout.

Definition at line 38 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< RFileDialogEmbedded (const std::shared_ptr< RWebWindow > &window, 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::Embedded() providing received string as second argument.
 
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 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
 

#include <ROOT/RFileDialog.hxx>

Member Enumeration Documentation

◆ EDialogTypes

Enumerator
kOpenFile 
kSaveAs 
kNewFile 

Definition at line 41 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.

◆ Embedded()

std::shared_ptr< RFileDialog > RFileDialog::Embedded ( const std::shared_ptr< RWebWindow > &  window,
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::Embedded() 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 427 of file RFileDialog.cxx.

◆ GetCanChangePath()

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

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

Definition at line 94 of file RFileDialog.hxx.

◆ GetFileName()

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

Definition at line 106 of file RFileDialog.hxx.

◆ GetNameFilters()

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

Returns array of name filters.

Definition at line 88 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::Experimental::RFileDialog::GetType ( ) const
inline

Definition at line 80 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::Experimental::RFileDialog::IsCompleted ( ) const
inline

Definition at line 105 of file RFileDialog.hxx.

◆ 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::Experimental::RFileDialog::SetCanChangePath ( bool  on = true)
inline

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

Definition at line 91 of file RFileDialog.hxx.

◆ SetNameFilters()

void ROOT::Experimental::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 86 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.

◆ 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.

Member Data Documentation

◆ fBrowsable

RBrowserData ROOT::Experimental::RFileDialog::fBrowsable
protected

! central browsing element

Definition at line 51 of file RFileDialog.hxx.

◆ fCallback

RFileDialogCallback_t ROOT::Experimental::RFileDialog::fCallback
protected

! function receiving result, called once

Definition at line 60 of file RFileDialog.hxx.

◆ fCanChangePath

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

! if working path can be changed via gui elements

Definition at line 52 of file RFileDialog.hxx.

◆ fDidSelect

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

! true when dialog is selected or closed

Definition at line 56 of file RFileDialog.hxx.

◆ fKind

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

! dialog kind OpenFile, SaveAs, NewFile

Definition at line 49 of file RFileDialog.hxx.

◆ fNameFilters

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

! name filters

Definition at line 58 of file RFileDialog.hxx.

◆ fSelect

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

! result of file selection

Definition at line 59 of file RFileDialog.hxx.

◆ fSelectedFilter

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

! name of selected filter

Definition at line 57 of file RFileDialog.hxx.

◆ fTitle

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

! title, when not specified default will be used

Definition at line 50 of file RFileDialog.hxx.

◆ fWebWindow

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

! web window for file dialog

Definition at line 54 of file RFileDialog.hxx.

Libraries for ROOT::Experimental::RFileDialog:

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