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 EDialogTypes & | GetType () 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< RFileDialog > | Embed (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< RWebWindow > | fWebWindow |
! web window for file dialog | |
Friends | |
class | Details::RWebWindowPlugin |
#include <ROOT/RFileDialog.hxx>
Enumerator | |
---|---|
kOpenFile | |
kSaveAs | |
kNewFile |
Definition at line 45 of file RFileDialog.hxx.
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 44 of file RFileDialog.cxx.
|
virtual |
destructor
Definition at line 91 of file RFileDialog.cxx.
|
staticprotected |
Start specified dialog type.
Definition at line 375 of file RFileDialog.cxx.
|
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 438 of file RFileDialog.cxx.
|
inline |
Returns true if working path can be change with gui elements.
Definition at line 100 of file RFileDialog.hxx.
|
inline |
Definition at line 112 of file RFileDialog.hxx.
|
inline |
Returns array of name filters.
Definition at line 94 of file RFileDialog.hxx.
|
protected |
Returns regexp for selected filter String should have form "Filter name (*.ext1 *.ext2 ...)
Definition at line 192 of file RFileDialog.cxx.
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 161 of file RFileDialog.cxx.
|
inline |
Definition at line 86 of file RFileDialog.hxx.
std::string RFileDialog::GetWorkingPath | ( | ) | const |
Returns current working path.
Definition at line 352 of file RFileDialog.cxx.
void RFileDialog::Hide | ( | ) |
Hide ROOT Browser.
Definition at line 128 of file RFileDialog.cxx.
|
protected |
Invoke specified callback.
Definition at line 361 of file RFileDialog.cxx.
|
inline |
Definition at line 111 of file RFileDialog.hxx.
|
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 425 of file RFileDialog.cxx.
|
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 415 of file RFileDialog.cxx.
|
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 395 of file RFileDialog.cxx.
|
protected |
Process received data from client.
Definition at line 271 of file RFileDialog.cxx.
|
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 405 of file RFileDialog.cxx.
|
protected |
Sends new data after change current directory.
Definition at line 256 of file RFileDialog.cxx.
|
protected |
Sends initial message to the client.
Definition at line 230 of file RFileDialog.cxx.
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 102 of file RFileDialog.cxx.
|
inline |
Configure if working path in dialog can be changed via gui elements.
Definition at line 97 of file RFileDialog.hxx.
|
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.
void RFileDialog::SetSelectedFilter | ( | const std::string & | name | ) |
Configure selected filter Has to be one of the string from NameFilters entry.
Definition at line 152 of file RFileDialog.cxx.
|
staticprotected |
Set start dialog function for RWebWindow.
Definition at line 491 of file RFileDialog.cxx.
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 338 of file RFileDialog.cxx.
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 114 of file RFileDialog.cxx.
|
staticprotected |
Returns dialog type as string String value used for configuring JS-side.
Definition at line 137 of file RFileDialog.cxx.
|
friend |
Definition at line 42 of file RFileDialog.hxx.
|
protected |
! central browsing element
Definition at line 55 of file RFileDialog.hxx.
|
protected |
! function receiving result, called once
Definition at line 64 of file RFileDialog.hxx.
|
protected |
! if working path can be changed via gui elements
Definition at line 56 of file RFileDialog.hxx.
|
protected |
! true when dialog is selected or closed
Definition at line 60 of file RFileDialog.hxx.
|
protected |
! dialog kind OpenFile, SaveAs, NewFile
Definition at line 53 of file RFileDialog.hxx.
|
protected |
! name filters
Definition at line 62 of file RFileDialog.hxx.
|
protected |
! result of file selection
Definition at line 63 of file RFileDialog.hxx.
|
protected |
! name of selected filter
Definition at line 61 of file RFileDialog.hxx.
|
protected |
! title, when not specified default will be used
Definition at line 54 of file RFileDialog.hxx.
|
protected |
! web window for file dialog
Definition at line 58 of file RFileDialog.hxx.