vdk 2.4.0
Public Member Functions | Public Attributes | Private Member Functions | List of all members
VDKFileChooser Class Reference

Provides a wrap for GtkFileChooser widget. More...

#include <vdkfilechooser.h>

Inheritance diagram for VDKFileChooser:
Inheritance graph
[legend]
Collaboration diagram for VDKFileChooser:
Collaboration graph
[legend]

Public Member Functions

 VDKFileChooser (VDKForm *owner, FileStringArray *selections, char *title)
 
void AddFilterPattern (char *name, char *pattern)
 
void SetDefaultFilter (char *name)
 
void RemoveFilter (char *name)
 
- Public Member Functions inherited from VDKForm
 VDKForm (VDKApplication *app, char *title=(char *) NULL, int mode=v_box, GtkWindowType display=GTK_WINDOW_TOPLEVEL)
 
 VDKForm (VDKForm *owner, char *title=(char *) NULL, int mode=v_box, GtkWindowType display=GTK_WINDOW_TOPLEVEL)
 
virtual ~VDKForm ()
 
bool Destroy ()
 
virtual int isA ()
 
VDKBoxBox ()
 
virtual void Show (GtkWindowPosition pos=GTK_WIN_POS_NONE)
 
virtual void Hide ()
 
virtual void ShowModal (GtkWindowPosition pos=GTK_WIN_POS_NONE)
 
bool IsModal ()
 
virtual void Add (VDKObject *obj, int justify=l_justify, int expand=TRUE, int fill=TRUE, int padding=1)
 
VDKFormOwner ()
 
virtual bool CanClose (void)
 
virtual void Close (void)
 
void Raise ()
 
void Lower ()
 
- Public Member Functions inherited from VDKObject
VDKRgb GetBackground (GtkStateType state=GTK_STATE_NORMAL)
 
VDKRgb GetForeground (GtkStateType state=GTK_STATE_NORMAL)
 
 VDKObject (VDKForm *owner=NULL)
 
 VDKObject (VDKForm *owner, GtkWidget *widget)
 
virtual ~VDKObject ()
 
bool Destroy ()
 
VDKFormOwner ()
 
virtual GtkWidget * Widget ()
 
GtkWidget * ConnectingWidget ()
 
GtkWidget * WrappedWidget ()
 
virtual void SetFont (VDKFont *f)
 
VDKFontGetFont ()
 
void SetVisible (bool visible)
 
bool GetVisible ()
 
void SetCursor (VDKCursorType)
 
VDKCursorType GetCursor ()
 
virtual void SetForeground (VDKRgb color, GtkStateType state=GTK_STATE_NORMAL)
 
virtual void SetBackground (VDKRgb color, GtkStateType state=GTK_STATE_NORMAL)
 
void SetSize (int w, int h)
 
void SetUsize (VDKPoint s)
 
virtual void SetTip (char *)
 
ItemListItems ()
 
void Draw (GdkRectangle *area=NULL)
 
void SignalEmit (int signal)
 
void SignalEmit (char *sig)
 
void SignalEmitParent (int signal)
 
void SignalEmitParent (char *sig)
 
void GrabFocus ()
 
VDKObjectParent (VDKObject *p=NULL)
 
int SignalConnect (VDKObject *obj, char *signal, bool(VDKObject::*method)(VDKObject *), bool gtk=true, bool after=false)
 
int SignalConnect (char *signal, bool(VDKObject::*method)(VDKObject *), bool gtk=true, bool after=false)
 
bool SignalDisconnect (int connection)
 
int EventConnect (VDKObject *obj, char *event, bool(VDKObject::*method)(VDKObject *, GdkEvent *), bool after=false)
 
int EventConnect (char *, bool(VDKObject::*)(VDKObject *, GdkEvent *), bool after=false)
 
bool EventDisconnect (int connection)
 

Public Attributes

VDKReadWriteValueProp< VDKFileChooser, bool > MultiSelection
 
VDKReadWriteValueProp< VDKFileChooser, GtkFileChooserAction > Action
 
- Public Attributes inherited from VDKObject
VDKReadWriteValueProp< VDKObject, VDKRgbNormalBackground
 
VDKReadWriteValueProp< VDKObject, VDKFont * > Font
 
SizeObjectProp Usize
 
VDKReadWriteValueProp< VDKObject, bool > Enabled
 
VDKReadWriteValueProp< VDKObject, VDKCursorType > Cursor
 
VDKReadWriteValueProp< VDKObject, bool > Visible
 

Private Member Functions

void Setup (void)
 

Additional Inherited Members

- Protected Attributes inherited from VDKForm
VDKApplicationapp
 
ChildList childs
 
GtkWidget * window
 
VDKBoxbox
 
bool isModal
 
bool never_showed
 
VDKPoint _oldSize
 
int modalCount
 
- Protected Attributes inherited from VDKObject
VDKObjectSignal s_clicked
 
GtkWidget * widget
 
GtkWidget * sigwid
 
VDKObjectparent
 

Detailed Description

Provides a wrap for GtkFileChooser widget.

Usage
#include <vdk/vdkfilechooser.h>
FileStringArray selections;
VDKFileChooser* fc = new VDKFileChooser(this, &selections,"File chooser");
// fc->MultiSelection = true; // comment out for multi selection mode
fc->AddFilterPattern("All files","*");
fc->AddFilterPattern("C sources","*.c");
fc->AddFilterPattern("CC sources","*.cc");
fc->AddFilterPattern("C/CC headers","*.h");
fc->SetDefaultFilter("All files");
fc->ShowModal();
// returns selections array filled with 1 or more filenames pending
// on selection mode (set with MultiSelection property)
if(selections.size() == 1)
{
printf("\nSelected:%s",(char*) selections[0]);
fflush(stdout);
}
else if(selections.size() > 1)
{
for(int t = 0; t < selections.size(); t++)
printf("\nSelected:%s",(char*) selections[t]);
fflush(stdout);
}
On return selections will be an empty array if user presses "cancel" button.

Constructor & Destructor Documentation

◆ VDKFileChooser()

END_SIGNAL_MAP VDKFileChooser::VDKFileChooser ( VDKForm owner,
FileStringArray selections,
char *  title 
)

Constructor

Parameters
owner
selectionsa FileStringArray pointer
titlewindow title

Member Function Documentation

◆ AddFilterPattern()

void VDKFileChooser::AddFilterPattern ( char *  name,
char *  pattern 
)

Add a filter based on a pattern

Parameters
namea human readable name
patterna filter pattern (ie: *.cc")

◆ RemoveFilter()

void VDKFileChooser::RemoveFilter ( char *  name)

remove <name> filter from filter's list

Parameters
namea human readable name

◆ SetDefaultFilter()

void VDKFileChooser::SetDefaultFilter ( char *  name)

set <name> filter as default

Parameters
namea human readable name

◆ Setup()

void VDKFileChooser::Setup ( void  )
privatevirtual

Must be overridden by subclasses, in this method user fills form with useful widgets

Implements VDKForm.

Member Data Documentation

◆ Action

VDKReadWriteValueProp<VDKFileChooser,GtkFileChooserAction> VDKFileChooser::Action

sets file chooser mode, can be one of following:

  • GTK_FILE_CHOOSER_ACTION_OPEN Indicates open mode. The file chooser will only let the user pick an existing file. (this is the default mode)
  • GTK_FILE_CHOOSER_ACTION_SAVE Indicates save mode. The file chooser will let the user pick an existing file, or type in a new filename.
  • GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER Indicates an Open mode for selecting folders. The file chooser will let the user pick an existing folder.
  • GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER Indicates a mode for creating a new folder. The file chooser will let the user name an existing or new folder.

◆ MultiSelection

VDKReadWriteValueProp<VDKFileChooser,bool> VDKFileChooser::MultiSelection

setting this property to true allow selecting more than one file (false by default)


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