Logo ROOT  
Reference Guide
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 More...
 
virtual ~RFileDialog ()
 destructor More...
 
const std::string & GetFileName () const
 
const auto & GetNameFilters () const
 Returns array of name filters. More...
 
std::string GetSelectedFilter () const
 Returns selected filter Can differ from specified value - if it does not match to existing entry in NameFilters. More...
 
const EDialogTypesGetType () const
 
void Hide ()
 Hide ROOT Browser. More...
 
bool IsCompleted () const
 
void SetCallback (RFileDialogCallback_t callback)
 Assign callback. If file was already selected, immediately call it. More...
 
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. More...
 
void SetSelectedFilter (const std::string &name)
 Configure selected filter Has to be one of the string from NameFilters entry. More...
 
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) More...
 

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. More...
 
static std::string NewFile (const std::string &title="", const std::string &fname="")
 Start NewFile dialog. More...
 
static std::string OpenFile (const std::string &title="", const std::string &fname="")
 Start OpenFile dialog. More...
 
static std::string SaveAs (const std::string &title="", const std::string &fname="")
 Start SaveAs dialog. More...
 

Protected Member Functions

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

Static Protected Member Functions

static std::string Dialog (EDialogTypes kind, const std::string &title, const std::string &fname)
 Start specified dialog type. More...
 
static std::string TypeAsString (EDialogTypes kind)
 Returns dialog type as string String value used for configuring JS-side. More...
 

Protected Attributes

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

#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 345 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 398 of file RFileDialog.cxx.

◆ GetFileName()

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

Definition at line 96 of file RFileDialog.hxx.

◆ GetNameFilters()

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

Returns array of name filters.

Definition at line 87 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 189 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 158 of file RFileDialog.cxx.

◆ GetType()

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

Definition at line 79 of file RFileDialog.hxx.

◆ Hide()

void RFileDialog::Hide ( )

Hide ROOT Browser.

Definition at line 125 of file RFileDialog.cxx.

◆ InvokeCallBack()

void RFileDialog::InvokeCallBack ( )
protected

Invoke specified callback.

Definition at line 331 of file RFileDialog.cxx.

◆ IsCompleted()

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

Definition at line 95 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 385 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 365 of file RFileDialog.cxx.

◆ ProcessMsg()

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

Process received data from client.

Definition at line 267 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 375 of file RFileDialog.cxx.

◆ SendChPathMsg()

void RFileDialog::SendChPathMsg ( unsigned  connid)
protected

Sends new data after change current directory.

Definition at line 252 of file RFileDialog.cxx.

◆ SendInitMsg()

void RFileDialog::SendInitMsg ( unsigned  connid)
protected

Sends initial message to the client.

Definition at line 227 of file RFileDialog.cxx.

◆ SetCallback()

void RFileDialog::SetCallback ( RFileDialogCallback_t  callback)

Assign callback. If file was already selected, immediately call it.

Definition at line 99 of file RFileDialog.cxx.

◆ 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 85 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 149 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 111 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 134 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 59 of file RFileDialog.hxx.

◆ fDidSelect

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

! true when dialog is selected or closed

Definition at line 55 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 57 of file RFileDialog.hxx.

◆ fSelect

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

! result of file selection

Definition at line 58 of file RFileDialog.hxx.

◆ fSelectedFilter

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

! name of selected filter

Definition at line 56 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 53 of file RFileDialog.hxx.


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