2021-10-16 20:53:12 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <gtkmm.h>
|
|
|
|
|
2021-10-17 20:40:21 +08:00
|
|
|
enum class ViewMode{
|
|
|
|
MODE_ICON,
|
2021-10-21 20:49:20 +08:00
|
|
|
MODE_LIST
|
2021-10-17 20:40:21 +08:00
|
|
|
};
|
|
|
|
|
2021-10-16 20:53:12 +08:00
|
|
|
class FileWindow : public Gtk::Window{
|
|
|
|
public:
|
|
|
|
FileWindow();
|
2021-10-21 20:49:20 +08:00
|
|
|
~FileWindow();
|
2021-10-17 20:40:21 +08:00
|
|
|
private:
|
|
|
|
//List Model
|
|
|
|
class ModelColumns : public Gtk::TreeModelColumnRecord{
|
|
|
|
public:
|
|
|
|
ModelColumns(){
|
|
|
|
add(m_col_path);add(m_col_display_name);add(m_col_pixbuf);add(m_col_is_dir);
|
|
|
|
}
|
|
|
|
Gtk::TreeModelColumn<Glib::ustring> m_col_path;
|
|
|
|
Gtk::TreeModelColumn<Glib::ustring> m_col_display_name;
|
|
|
|
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>> m_col_pixbuf;
|
|
|
|
Gtk::TreeModelColumn<bool> m_col_is_dir;
|
|
|
|
};
|
|
|
|
|
2021-10-20 22:30:04 +08:00
|
|
|
ModelColumns columns;
|
2021-10-17 20:40:21 +08:00
|
|
|
Gtk::TreeView m_treeview;
|
|
|
|
Gtk::IconView m_iconview;
|
|
|
|
Glib::RefPtr<Gtk::TreeSelection> m_selection;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> m_liststore;
|
|
|
|
|
|
|
|
//File Proprties
|
|
|
|
Glib::RefPtr<Gdk::Pixbuf> file_pixbuf;
|
|
|
|
Glib::RefPtr<Gdk::Pixbuf> folder_pixbuf;
|
2021-10-21 20:49:20 +08:00
|
|
|
Glib::ustring parent_str,tmp_str;
|
2021-10-17 20:40:21 +08:00
|
|
|
ViewMode view_mode;
|
|
|
|
|
|
|
|
//Child Widgets
|
2021-10-21 20:49:20 +08:00
|
|
|
Gtk::Box vbox,btnbox,menubox;
|
2021-10-17 20:40:21 +08:00
|
|
|
Gtk::Toolbar m_toolbar,m_viewbar;
|
|
|
|
Gtk::ToolButton up_button,home_button,new_button,delete_button;
|
|
|
|
Gtk::ToolItem view_item,menu_item;
|
|
|
|
Gtk::ScrolledWindow m_sw;
|
|
|
|
Gtk::Button view_button;
|
|
|
|
Gtk::MenuButton menubtn;
|
2021-10-20 22:30:04 +08:00
|
|
|
Gtk::Stack stack;
|
2021-10-21 20:49:20 +08:00
|
|
|
Gtk::Popover popover;
|
|
|
|
Gtk::CheckButton show_hidden;
|
|
|
|
Gtk::InfoBar m_infobar;
|
|
|
|
Gtk::Label info_label;
|
2021-10-20 22:30:04 +08:00
|
|
|
|
|
|
|
//Initalize Functions
|
|
|
|
void fill_store();
|
2021-10-21 20:49:20 +08:00
|
|
|
void initalize_views();
|
2021-10-20 22:30:04 +08:00
|
|
|
int sort_func(const Gtk::TreeModel::iterator &a,const Gtk::TreeModel::iterator &b);
|
2021-10-17 20:40:21 +08:00
|
|
|
|
|
|
|
//Signal Handlers
|
2021-10-20 22:30:04 +08:00
|
|
|
void item_activated(const Gtk::TreePath &path);
|
2021-10-21 20:49:20 +08:00
|
|
|
void row_activated(const Gtk::TreePath &path,Gtk::TreeViewColumn * sel_column);
|
|
|
|
void btnup_clicked();
|
|
|
|
void btnhome_clicked();
|
|
|
|
void btnnew_clicked();
|
|
|
|
void btndel_clicked();
|
|
|
|
void btnview_clicked();
|
|
|
|
void infobar_response(int response_id);
|
2021-10-16 20:53:12 +08:00
|
|
|
};
|