NewForm Class Reference

A form for picking the theme of a new track. More...

#include <NewForm.h>

Inheritance diagram for NewForm:

VBox List of all members.

Public Member Functions

 NewForm (Gtk::Window &window)
 Create a new form.
virtual ~NewForm ()
sigc::signal< void, std::string > signal_theme_picked ()
 Signal emmited when the user picks a theme.
void find_themes ()
 Find and list avaliable themes.
void grab_focus ()
 Give the theme list keyboard focus for the window it is inside.

Protected Member Functions

void set_themes ()
 Find the themes.
void add_themes_from (std::string filename)
 Add themes in a directory.
void on_dir_changed (const Glib::RefPtr< Gio::File > &file, const Glib::RefPtr< Gio::File > &other_file, Gio::FileMonitorEvent event_type, std::string path)
 Change the list when a directory changes.
void test_themes_avaliable ()
 Show warning if there are no themes, otherwise show the themes.
void on_new_button_clicked ()
 Callback for when the button to confirm the theme choice was pressed.
void on_item_activated (const Gtk::TreeModel::Path &path)
 Callback for when an theme was activated from the theme_icon_view.
bool add_file (Glib::RefPtr< Gio::FileInfo > file_info, std::string path)
 Add a file to the list, or monitor a directory, if it could contain a theme.

Protected Attributes

Gtk::Window & window
 parent window
Gtk::Label caption
 message asking user to select a theme.
Gtk::IconView theme_icon_view
 shows the list of themes
Gtk::Button create_button
 a button to press when you have picked the theme.
Gtk::ScrolledWindow m_scrolled_window
 contain the icons
NewForm::ThemeModelColumns theme_model_columns
 description of data to show per theme icon.
Glib::RefPtr< Gtk::ListStore > list_model_ptr
 list of themes.
std::vector< Glib::RefPtr<
Gio::FileMonitor > > 
dir_mon
 directory monitors and their paths
sigc::signal< void, std::string > m_signal_theme_picked
 signal for when theme selected.
bool m_loading
 True if 'loading' is displayed.

Classes

class  ThemeModelColumns
 description of data to show per theme icon. More...

Detailed Description

A form for picking the theme of a new track.

Definition at line 24 of file NewForm.h.


Constructor & Destructor Documentation

NewForm::NewForm ( Gtk::Window &  window  ) 

Create a new form.

Parameters:
window the window the forms sits on. When NewForm needs to make a message box appear, it will be centred over this window.

Definition at line 18 of file NewForm.cpp.

NewForm::~NewForm (  )  [virtual]

Definition at line 53 of file NewForm.cpp.


Member Function Documentation

bool NewForm::add_file ( Glib::RefPtr< Gio::FileInfo >  file_info,
std::string  path 
) [protected]

Add a file to the list, or monitor a directory, if it could contain a theme.

A valid file or directory must contain the word 'theme' (it is case sensitive) in the name, must not be hidden, must not contain a '.', and must not end in '~'. If the file is invlaid, it is ignored.

Parameters:
file_info Information about the file/directory to check.
path the path to the file to use in the full theme file name.
Returns:
true if the file or directory was used, false if not.

Definition at line 235 of file NewForm.cpp.

void NewForm::add_themes_from ( std::string  filename  )  [protected]

Add themes in a directory.

The directory will be monitored fo future changes. It is recursive, so a theme directory under the given directory will also be added and monitored.

Parameters:
filename the directory to add.

Definition at line 80 of file NewForm.cpp.

void NewForm::find_themes (  ) 

Find and list avaliable themes.

This must be called after creation if the NewForm is going to do anything other than say "Loading". This is a separate to the constuctor, so that finding the themes on disk doesn't delay the time until the main window appears.

Definition at line 58 of file NewForm.cpp.

void NewForm::grab_focus (  ) 

Give the theme list keyboard focus for the window it is inside.

Definition at line 70 of file NewForm.cpp.

void NewForm::on_dir_changed ( const Glib::RefPtr< Gio::File > &  file,
const Glib::RefPtr< Gio::File > &  other_file,
Gio::FileMonitorEvent  event_type,
std::string  path 
) [protected]

Change the list when a directory changes.

Parameters:
path the path from the working directory to the directory being monitored that causes this event.

iterate over objects in list to find the one that was deleted.

Definition at line 107 of file NewForm.cpp.

void NewForm::on_item_activated ( const Gtk::TreeModel::Path &  path  )  [protected]

Callback for when an theme was activated from the theme_icon_view.

Definition at line 229 of file NewForm.cpp.

void NewForm::on_new_button_clicked (  )  [protected]

Callback for when the button to confirm the theme choice was pressed.

Definition at line 200 of file NewForm.cpp.

void NewForm::set_themes (  )  [protected]

Find the themes.

Looks for themes in the data directory. Also causes the data directory to be monitored. Must not be called multiple times.

Definition at line 75 of file NewForm.cpp.

sigc::signal< void, std::string > NewForm::signal_theme_picked (  ) 

Signal emmited when the user picks a theme.

The singal should be wired to a function

 void on_pick_theme(std::string filename)
where the parameter is the filename of the theme.
Returns:
signal that is emmited when the user double clicks a theme or clicks new with a theme selected.

Definition at line 224 of file NewForm.cpp.

void NewForm::test_themes_avaliable (  )  [protected]

Show warning if there are no themes, otherwise show the themes.

Definition at line 162 of file NewForm.cpp.


Member Data Documentation

Gtk::Label NewForm::caption [protected]

message asking user to select a theme.

Definition at line 58 of file NewForm.h.

Gtk::Button NewForm::create_button [protected]

a button to press when you have picked the theme.

Definition at line 62 of file NewForm.h.

std::vector<Glib::RefPtr<Gio::FileMonitor> > NewForm::dir_mon [protected]

directory monitors and their paths

Definition at line 93 of file NewForm.h.

Glib::RefPtr<Gtk::ListStore> NewForm::list_model_ptr [protected]

list of themes.

Definition at line 90 of file NewForm.h.

bool NewForm::m_loading [protected]

True if 'loading' is displayed.

Definition at line 99 of file NewForm.h.

Gtk::ScrolledWindow NewForm::m_scrolled_window [protected]

contain the icons

Definition at line 64 of file NewForm.h.

sigc::signal<void, std::string> NewForm::m_signal_theme_picked [protected]

signal for when theme selected.

Definition at line 96 of file NewForm.h.

Gtk::IconView NewForm::theme_icon_view [protected]

shows the list of themes

Definition at line 60 of file NewForm.h.

NewForm::ThemeModelColumns NewForm::theme_model_columns [protected]

description of data to show per theme icon.

Gtk::Window& NewForm::window [protected]

parent window

Definition at line 56 of file NewForm.h.


The documentation for this class was generated from the following files:
Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:16 2010 by Doxygen version 1.4.7 for Racer version svn335.