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

Provides a wrap for GtkFileChooser widget. More...

#include <vdkfilechooser.h>

Inheritance diagram for VDKFileChooser:
VDKForm VDKObject VDKNotCopyAble

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)
virtual void Setup (void)=0
void Raise ()
void Lower ()
void SetVisible (bool flag)
bool GetVisible ()
- 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 ()
virtual GtkWidget * Widget ()
GtkWidget * ConnectingWidget ()
GtkWidget * WrappedWidget ()
virtual void SetFont (VDKFont *f)
VDKFontGetFont ()
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

Additional Inherited Members

- Protected Attributes inherited from VDKForm
VDKApplicationapp
ChildList childs
GtkWidget * window
VDKBoxbox
bool isModal
bool never_showed
VDKPoint _oldSize
int modalCount

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

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

Constructor

Parameters
owner
selectionsa FileStringArray pointer
titlewindow title

Member Function Documentation

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

Add a filter based on a pattern

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

remove <name> filter from filter's list

Parameters
namea human readable name
void VDKFileChooser::SetDefaultFilter ( char *  name)

set <name> filter as default

Parameters
namea human readable name

Member Data Documentation

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