#include <vdkfilechooser.h>
#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); }
END_SIGNAL_MAP VDKFileChooser::VDKFileChooser | ( | VDKForm * | owner, | |
FileStringArray * | selections, | |||
char * | title | |||
) |
Constructor
owner | ||
selections | a FileStringArray pointer | |
title | window title |
void VDKFileChooser::Setup | ( | void | ) | [private, virtual] |
Must be overridden by subclasses, in this method user fills form with useful widgets
Implements VDKForm.
void VDKFileChooser::AddFilterPattern | ( | char * | name, | |
char * | pattern | |||
) |
Add a filter based on a pattern
name | a human readable name | |
pattern | a filter pattern (ie: *.cc") |
void VDKFileChooser::SetDefaultFilter | ( | char * | name | ) |
set <name> filter as default
name | a human readable name |
void VDKFileChooser::RemoveFilter | ( | char * | name | ) |
remove <name> filter from filter's list
name | a human readable name |
VDKReadWriteValueProp<VDKFileChooser,bool> VDKFileChooser::MultiSelection |
setting this property to true allow selecting more than one file (false by default)
VDKReadWriteValueProp<VDKFileChooser,GtkFileChooserAction> VDKFileChooser::Action |
sets file chooser mode, can be one of following: