Dialog for selecting a file. More...
Public Types | |
enum | Update |
Layout update modes (see updateLayout()). | |
Public Member Functions | |
GFileDialog & | clone (GClone const &) override |
Clones the gadget according to GClone argument. | |
GString | basename () const |
returns the name of the selected file without the directory. | |
GString | dirname () const |
returns the selected directory. | |
GFileDialog & | setDir (GString const &path) |
changes the directory. More... | |
GFileDialog & | show (bool state=true) override |
Shows/hides the dialog. More... | |
GFileDialog & | alertFileExist (bool state) |
Displays an alert if the selected file already exists (useful for SaveDialog(s)). More... | |
GChoice & | choice () |
returns the prop that controls the selection. | |
virtual int | open () |
Shows the dialog and blocks. More... | |
int | result () const |
Returns the number of the button that was clicked. More... | |
virtual Gadget & | cancelButton () |
Returns/creates the Cancel button. More... | |
virtual Gadget & | okButton () |
Returns/creates the OK button (and creates a Cancel button if neeeded). More... | |
virtual GBox & | buttonBox () |
Returns/creates the box that contains the buttons. More... | |
virtual void | setButtons (GString const &buttons) |
Add/Changes buttons. More... | |
virtual GItem * | findButton (int pos) |
Returns the button at this position. More... | |
virtual int | startApp () |
Starts the event loop Same effect as GApp::start() with this window being the main window. More... | |
virtual bool | isModal () const |
Returns true if the window is modal. | |
virtual void | setModal (bool modal) |
Makes this window modal (arg is true) or not modal (arg is false). | |
virtual void | close () |
Closes the window. More... | |
virtual void | dieOnClose (bool dies=true) |
Specifies whether the window should be deleted when close() is called. More... | |
GPoint | pos () const override |
Returns the position of the gadget in its parent. More... | |
GWindow & | setOpacity (float opacity) |
opacity is between 0.f and 1.f. | |
void | add (Gadget *child, int index=-1) override |
Adds a Gadget child. More... | |
bool | isTopLevel () const override |
Returns true if the gadget is a Window or a Menu. | |
void | update () override |
Notifies the toolkit that this gadget needs to be repainted. More... | |
void | updateLayout (Update=Update::IfNeeded) override |
Notifies the toolkit that the layout needs to be updated. More... | |
virtual int | nearestChildIndex (GPoint const &wpoint, bool localpos) |
Searches the closest child from this location (in window coordinates). More... | |
int | childCount () const |
Returns the number of children. | |
virtual void | perform (std::function< void(Gadget &child)> fun) |
Calls a function on all box children. More... | |
virtual void | perform (std::function< void(Gadget &child, int index)> fun) |
Calls a function on all box children. More... | |
virtual bool | removeAt (int pos) |
Removes a child at a given position or a given place. More... | |
virtual void | removeChildren (Remove mode=Remove::InContent) |
Removes all children. More... | |
void | cleanup () override |
Removes all Props and children. More... | |
ChoiceBehavior | choiceBehavior () const |
Returns the GChoiceBehavior of the box. | |
void | setValue (GString const &) override |
Changes the gadget's value. More... | |
void | clearValues () override |
Clears the values of the gadget and its descendants. More... | |
void | doPaint (GRenderGraphics &, GRender *parent_render) override |
Paints the gadget. More... | |
Gadget * | doPick (GPoint const &, class GPickMode &) override |
Returns the gadget the gadget that contains this point. More... | |
void | blink (GString const &message="", GTime duration=350) |
Blinks the gadget, optionally showing a message. More... | |
GPropList const & | props () const |
Returns all props. More... | |
void | cssProps (class GPropMap &) |
Returns the props relative to this gadget in CSSs. More... | |
virtual GString | text () const |
Returns the text of the gadget (if any). More... | |
virtual void | removeProps () |
Removes all props (including conditional props and callbacks). More... | |
bool | isMultiLine () const |
Returns true if gadget displays multiline text. | |
virtual GWindow * | getWindow () const |
Returns the GWindow that contains the gadget (if any, null otherwise). | |
virtual bool | hasValue () const |
Returns true if the gadget has a value. More... | |
int | zlayer () const |
Returns the z-layer of the gadget. More... | |
GRect const & | wframe () |
Returns the frame (position and size) of the gadget in window coordinates. | |
virtual void | keepInside (GBox &box, GPoint &point) |
Changes point to keep the gadget inside an ancestor when moving or resizing it. | |
virtual GHandle | findHandle (GPoint const &wpos) |
Returns the handle that contains this position in window corrdinates. | |
bool | isActive () const |
Returns true if the gadget is currently active (eg pressed). | |
GadgetModes const & | modes () const |
Returns all gadget modes. | |
GEventType const & | eventMask () const |
Returns the events (ORed mask) that the gadget takes into account. | |
virtual void | doFire (GEvent &) |
Fires callbacks and conditional props (see GCond) that match this event. | |
virtual void | onAdd (GBox *parent) |
Called when the gadget is added to a parent. | |
virtual void | onRemove (GBox *parent) |
Called when the gadget is removed from a parent. | |
void | removeNotifiers (void *) override |
[Implementation] Notifies this object that it must no longer refer obj. | |
virtual void | error (GString const &funname, GString const &message) const |
Prints an error message. More... | |
void | operator delete (void *) |
delete does nothing, see GObject class. | |
void | forgetSmartPointers () |
Forgets all smart pointers pointing this object. More... | |
unsigned int | useCount () const |
Returns the numbers of smart pointers referencing the object. | |
GString | pathname () const |
returns the pathname of the selected file. | |
GString | stringValue () const override |
Returns the gadget's value as a string. More... | |
GFileDialog & | alertIf (GBool &test) |
Display an alert before opening the dialog if a condition is met (useful for OpenDialog(s)). More... | |
void | add (GString const &item) override |
Adds a Gadget child that is auto-created. More... | |
void | add (class GStateTransition &) |
Adds a callback function or a state transitions. More... | |
virtual void | add (GMenu *child) |
Adds a menu, a window, a dialog box to the gadget. More... | |
virtual GChoice * | choiceProp () |
Returns the prop that controls the exclusive selection of children, if any. More... | |
virtual GProp * | valueProp () override |
Returns the prop that stores the gadget's value. More... | |
virtual Gadget * | findChild (GadgetType &type, bool in_border=false) const |
Searches if the gadget contains a child gadget of (exactly) this class. More... | |
virtual Gadget * | childAt (int pos) const |
Returns the child at this position or at this place. More... | |
virtual int | childPos (Gadget *child) const |
Returns the position or the place of this child. More... | |
virtual Gadget * | childAtPoint (GPoint const &point, bool indirect=false, GPredicate const &={}) |
Returns the direct (or indirect) child containing this point. More... | |
GadgetList & | children () |
Returns the content aread child list. More... | |
virtual bool | contain (Gadget *child, bool indirect=false) const |
Returns true if the first argument is a direct (or indirect) child of the box. More... | |
virtual bool | contain (GProp *prop) const |
Returns true if the gadget contains this prop. | |
virtual bool | remove (Gadget *child) |
Removes a child. More... | |
bool | remove (GProp *prop) |
Removes a prop (including conditional props and callbacks). More... | |
GString | typeName () const override |
Returns the name and ID of the gadget's type. | |
Gadget * | toGadget () override |
Class conversions. | |
virtual GProp * | findProp (GPropType &) const |
Searches if the gadget contains a prop of this class or a derived class. More... | |
virtual GProp & | prop (GPropType &, bool in_css=false) |
Searches a prop of this class in the gadget and the CSS, and creates it if needed. More... | |
bool | isRichText () const |
Checks/changes whether HTML-like tags are interpreted when displaying text. More... | |
Gadget & | catchEvents (bool=true) |
Checks/changes whether the gadget catches events. More... | |
Gadget & | ignoreEvents (bool=true) |
Checks/changes whether the gadget ignores events. More... | |
virtual Gadget & | check (bool=true) |
Checks/changes whether the gadget is checked (ie selected). More... | |
Gadget & | setCheckable (bool=true) |
Checks/changes whether the gadget is checkable (ie can be selected). More... | |
virtual Gadget & | enable (bool=true) |
Checks/change whether the gadget is enabled. More... | |
GBox * | getParent () const |
Returns the parent gadget. More... | |
bool | read (GString const &filename, GIOMode=GIOMode::Auto) |
Reads the values or the children of this gadget recursively. | |
bool | write (GString const &filename, GIOMode) const |
Writes the values or the children of this gadget recursively. | |
bool | isColumn () const |
Returns the direction of the gadget. More... | |
virtual void | move (GPoint const &) |
Changes the position (in pixels) of the gadget. More... | |
virtual void | resize (float w, float h) |
Changes the preferred size (in pixels) of the gadget. More... | |
virtual void | reshapeInteractively () |
Allows reshaping a gadget interactivelly. More... | |
GPoint | wpos () const |
Returns the position of the gadget in its containing window. More... | |
GPoint | screenPos () const |
Returns the position of the gadget on the screen. | |
float | w () const |
Returns the dimension (size) of the gadget. | |
float | angleStart () const |
Returns/changes the starting angle and the extent when painting gadgets as pie slices. More... | |
bool | isActivable () const |
Ckecks/changes whether the gadget can be active. | |
bool | isDownActivable () const |
Ckecks/changes whether the gadget is active on mouse down rather than mouse up. | |
bool | isFocus () const |
Returns true if the gadget has/can have the focus. | |
bool | isInternal () const |
Ckecks/changes whether the gadget is an internal (implementation-specific) object. More... | |
template<class Subclass > | |
Subclass * | to () |
Class conversions. | |
void | ignoreSmartPointers () |
Checks/sets whether this object can be auto-deleted by smart pointers. More... | |
Static Public Member Functions | |
static int | alert (GString const &message, GString const &info="") |
Open an Alert dialog with one button. More... | |
static int | confirm (GString const &message, GString const &info="", GString const &buttons="") |
Open an Alert dialog with two buttons. More... | |
static GWindow * | findWindow (GPoint const &screenpos) |
find the window containg this point. | |
enum | Place : int8_t |
Placement of the gadget in a GBox parent. More... | |
Dialog for selecting a file.
By default, an GFileDialog is modal (see setModal()) and has a Cancel and a OK button.
|
stronginherited |
|
inlineoverridevirtual |
Returns the gadget's value as a string.
If the gadget has a value (see hasValue()) this method returns the gadget value converted to a string. Otherwise it returns the empty string.
Reimplemented from guit::Gadget.
GFileDialog & guit::GFileDialog::setDir | ( | GString const & | path) |
changes the directory.
"~" is the home dir, ":" the resource dir, ".." goes to the parent dir.
|
overridevirtual |
Shows/hides the dialog.
Reimplemented from guit::GDialog.
GFileDialog & guit::GFileDialog::alertIf | ( | GBool & | test) |
Display an alert before opening the dialog if a condition is met (useful for OpenDialog(s)).
If test() is true, an alert is displayed, typically to warn the user that the data has not been saved.
GFileDialog & guit::GFileDialog::alertFileExist | ( | bool | state) |
Displays an alert if the selected file already exists (useful for SaveDialog(s)).
If the selected file already exists, an alert is displayed to warn the user that this file will be overwritten if he proceeds.
|
staticinherited |
Open an Alert dialog with one button.
Opens a predefined dialog with a OK button that blocks until the user clicks the button.
|
staticinherited |
Open an Alert dialog with two buttons.
Opens a predefined dialog with a Cancel and a OK button that blocks until the user clicks one of the buttons.
|
virtualinherited |
|
inlineinherited |
Returns the number of the button that was clicked.
Returns the number of the button in the buttonBox(). By convention, 0 is the Cancel button and 1 the OK button.
|
virtualinherited |
Returns/creates the Cancel button.
Creates this button if needed. The Cancel button is the first button in the buttonBox(). result() will return 0 when this button is clicked.
|
virtualinherited |
Returns/creates the OK button (and creates a Cancel button if neeeded).
Creates the Cancel and OK buttons if needed, returns the OK button. The OK button is the second button in the buttonBox(). result() will return 1 when this button is clicked.
|
virtualinherited |
Returns/creates the box that contains the buttons.
Creates the box if needed. Additional buttons can be added to this box. By convention, the first button is the Cancel button (number 0), the second button is the OK button, etc.
|
virtualinherited |
Add/Changes buttons.
Remove previous buttons and creates as many buttons as there are tokens separated by commas in buttons. The first token must be the name of the Cancel button, the second token (if any) the name of the OK button, etc. result() will return the number of the corresponding button (starting at 0 for Cancel).
|
virtualinherited |
Returns the button at this position.
Returns null if there is no gadget at this position or if it is not a GItem.
|
virtualinherited |
Starts the event loop Same effect as GApp::start() with this window being the main window.
This function is blocking and must be called last.
|
virtualinherited |
Closes the window.
Called when the close button of the window bar is clicked or the OK, Cancel buttons of a GDialog subclass.
Fires the on::done trigger callbacks and cond props, then:
|
virtualinherited |
Specifies whether the window should be deleted when close() is called.
|
inlineoverridevirtualinherited |
Returns the position of the gadget in its parent.
Return the position on the screen if the gadget is a GWindow,
Reimplemented from guit::Gadget.
|
overridevirtualinherited |
Adds a Gadget child.
Adding operations are explained in the documentation of the Gadget class.
Reimplemented from guit::GBox.
|
overridevirtualinherited |
Adds a Gadget child that is auto-created.
The string is converted into a gadget that is added to the childlist (see add(Gadget*, int index)). The type of the created gadget depend on the type of the box, for instance:
Reimplemented from guit::Gadget.
|
inherited |
Adds a callback function or a state transitions.
operator<<() provides a more convenient API: a << b << c adds b and c to a. The appropriate adding function is automatically called.
|
virtualinherited |
Adds a menu, a window, a dialog box to the gadget.
operator<<() provides a more convenient API: a << b << c adds b and c to a. The appropriate adding function is automatically called.
If the gadget is a GItem or GButton, the GMenu, GWindow, GDialog given as an argument will be automatically opened when pressing the mouse on the item (GMenu) or clicking it (GWindow, GDialog).
Reimplemented in guit::GItem, and guit::GMenuBar.
|
overridevirtualinherited |
Notifies the toolkit that this gadget needs to be repainted.
The gadget is not repainted immediately, but after executing callback functions. The doPaint() method is then called.
Reimplemented from guit::Gadget.
|
overridevirtualinherited |
Notifies the toolkit that the layout needs to be updated.
By default (UpdateIfNeeded mode) the layout is not updated immediately, but after executing callback functions, and before repainting the gadget by calling doPaint().
Possible arguments are:
Reimplemented from guit::Gadget.
|
virtualinherited |
Returns the prop that controls the exclusive selection of children, if any.
returns null if this box does not enforce exclusive selection.
Reimplemented in guit::GChoiceBox.
|
overridevirtualinherited |
Returns the prop that stores the gadget's value.
If the gadget has a value (see hasValue()) this method returns the prop storing the value. Otherwise it returns null.
Reimplemented from guit::Gadget.
Reimplemented in guit::GChoiceBox.
|
virtualinherited |
Searches if the gadget contains a child gadget of (exactly) this class.
The first version returns the gadget as a Gadget* if it is found, and null otherwise. In addition, the second version casts the returned gadget to the desired type.
|
virtualinherited |
Returns the child at this position or at this place.
Reimplemented in guit::GTable.
|
virtualinherited |
Returns the position or the place of this child.
Returns -1 if child does not belong to the child list.
|
virtualinherited |
Returns the direct (or indirect) child containing this point.
|
virtualinherited |
Searches the closest child from this location (in window coordinates).
Returns the index of the closest direct childt, and -1 if none found.
|
inlineinherited |
Returns the content aread child list.
|
virtualinherited |
Returns true if the first argument is a direct (or indirect) child of the box.
If indirect is false (the default) searches only for direct children, otherwise searches for direct and indirect children.
|
virtualinherited |
Calls a function on all box children.
fun(child) is called on each element in the childlist. The operation is not performed on border children (see addToBorder()).
|
virtualinherited |
Calls a function on all box children.
fun(child, index) is called on each element in the childlist. index is the cofresponding position in the list. The operation is not performed on border children (see addToBorder()).
|
virtualinherited |
Removes a child.
Returns true if the child was actually removed (i.e. if it was in the child list), and false otherwise.
Reimplemented in guit::GOptionBox.
|
inherited |
Removes a prop (including conditional props and callbacks).
Returns true if the prop was actually removed (i.e. if it was belonging to the gadget).
|
virtualinherited |
Removes a child at a given position or a given place.
Reimplemented in guit::GOptionBox.
|
virtualinherited |
Removes all children.
Remove all children iin the content area and/or in the border depending on argument.
Reimplemented in guit::GOptionBox.
|
overridevirtualinherited |
Removes all Props and children.
Calls removeProps() then removeChidren()
Reimplemented from guit::Gadget.
|
overridevirtualinherited |
Changes the gadget's value.
If the gadget has a value (see hasValue()) this method changes the gadget value after converting value to the appropriate type. Otherwise it has no effect.
Reimplemented from guit::Gadget.
Reimplemented in guit::GChoiceBox.
|
overridevirtualinherited |
Clears the values of the gadget and its descendants.
Clearing means setting to the default value (0 for numbers, the empty string for strings, etc.)
Reimplemented from guit::Gadget.
|
overridevirtualinherited |
Paints the gadget.
Repaints the gadget then fires on::paint callbacks. For instance, mycallback can be called to draw on the gadget as follows;
Reimplemented from guit::Gadget.
Returns the gadget the gadget that contains this point.
The point is in window coordinates.
Reimplemented from guit::Gadget.
|
inherited |
Blinks the gadget, optionally showing a message.
Shows a message if message is not empty. The duration is in ms.
Searches if the gadget contains a prop of this class or a derived class.
The first version returns the prop as a GProp* if it is found, and null otherwise. In addition, the second version casts the returned prop to the desired type.
Searches a prop of this class in the gadget and the CSS, and creates it if needed.
This method always returns a mutable prop of the desired type:
|
inlineinherited |
Returns all props.
|
inherited |
Returns the props relative to this gadget in CSSs.
|
virtualinherited |
Returns the text of the gadget (if any).
Returns the text of gadgets that display text, e.g. Item, Label, Button, TextField, etc., and an empty string otherwise.
Reimplemented in guit::GItem, and guit::GTextItem.
|
virtualinherited |
Removes all props (including conditional props and callbacks).
|
inlineinherited |
Checks/changes whether HTML-like tags are interpreted when displaying text.
HTML-like tags such as <b>, <i>, etc. will be interpreted when rendering text. This option is true by default, except for gadgets that edit text (e.g. TextField and TextArea).
|
inherited |
Checks/changes whether the gadget catches events.
The gadget will receive events that should have been received by its descendants. The received GEvent will be set so that:
|
inherited |
Checks/changes whether the gadget ignores events.
The gadget and its descendants will then ignore all events.
|
virtualinherited |
Checks/changes whether the gadget is checked (ie selected).
check() has not effect if isCheckable() is false; see setCheckable().
|
inherited |
Checks/changes whether the gadget is checkable (ie can be selected).
setCheckable(true) makes any gadget checkable. Some gadgets (e.g. GCheckItem, GRadioItem) are checkable by default, but most others are not.
|
virtualinherited |
Checks/change whether the gadget is enabled.
|
inlineinherited |
Returns the parent gadget.
|
inlinevirtualinherited |
Returns true if the gadget has a value.
Gadgets such as TextField, Slider, ChartItem, ChoiceBox, OptionBox, ComboBox have a value. This methods then returns true, and false otherwise.
Reimplemented in guit::GTextItem, guit::GChoiceBox, guit::GItem, and guit::GValueItem.
|
inlineinherited |
Returns the direction of the gadget.
The direction can be changed by adding a GFlow prop to the gadget.
|
virtualinherited |
Changes the position (in pixels) of the gadget.
This function is a shortcut that changes the value of the gadget's GPos prop (and adds a GPos to the gadget if it doesn't already have one). Importantly, the gadget won't be auto laid-out any longer if this function is called (or a GPos is directly added to the gadget).
Gadgets that are automatically laid out don't need a GPos. Gadgets that are positioned manually need a GPos that specifies their position and (optionally) their zlayer().
The position is relative to the parent gadget, or to the screen if the gadget is a GWindow. The zlayer() of auto-laid out gadgets is 0, the zlayer() of other gadgets is > 0 (see GPos).
A GPos prop can be directly added to a gadget as follows:
Adding a GPos rather than calling move() allows:
Reimplemented in guit::GLineShape.
|
virtualinherited |
Changes the preferred size (in pixels) of the gadget.
This function is a shortcut that changes the value of the gadgte's GSIze prop (and adds a GSize to the gadget if it doesn't already have one). The actual size of the gadget also depends on its GFlex prop and the GAlign prop of its parent.
The GSize prop can also be added directly by using the << operator (see move() for an example). Adding a GSize rather than calling resize() allows:
|
virtualinherited |
Allows reshaping a gadget interactivelly.
Adds the appropriate GPos and GSize props to the gadget so that it will display handles allowing to reshape it when it is checked. "Reshaping" both means changing the position and the size (e.g. when dragging left-side handles). The second version of this function allows reshaping a gadget just after instantiating it. The GMouseEvent argument typically corresponds to a mouse down event in a gadget that serves as a canvas for drawing other gadgets (or geometrical shapes, see GShape).
Reimplemented in guit::GLineShape.
|
inlineinherited |
Returns the z-layer of the gadget.
The z-layer is 0 if the gadget is auto laid-out and > 0 otherwise (see GPos prop).
|
inlineinherited |
Returns the position of the gadget in its containing window.
Return 0 if the gadget is a GWindow.
|
inherited |
|
inlineinherited |
Ckecks/changes whether the gadget is an internal (implementation-specific) object.
internal objects are ignored when inspecting, reading or writting gadgets.
|
virtualinherited |
Prints an error message.
|
inlineinherited |
Checks/sets whether this object can be auto-deleted by smart pointers.
ignoreSmartPointers() has a permanent effect, contrary to forgetSmartPointers(). Objects not created by calling new are never auto-deleted by smart pointers.
|
inlineinherited |
Forgets all smart pointers pointing this object.
The smart pointers that are currently pointing to the object won't auto-delete it. forgetSmartPointers() has a temporary effect, contrary to ignoreSmartPointers().