1 /*
2  * gnote
3  *
4  * Copyright (C) 2010-2014,2017,2019 Aurimas Cernius
5  * Copyright (C) 2009 Hubert Figuiere
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef __NOTEBOOKS_SPECIALNOTEBOOKS_HPP_
24 #define __NOTEBOOKS_SPECIALNOTEBOOKS_HPP_
25 
26 
27 #include <set>
28 
29 #include "notebook.hpp"
30 #include "tag.hpp"
31 
32 
33 namespace gnote {
34 
35 class IconManager;
36 
37 namespace notebooks {
38 
39 
40 class SpecialNotebook
41   : public Notebook
42 {
43 public:
44   typedef std::shared_ptr<SpecialNotebook> Ptr;
45 
46   virtual Glib::RefPtr<Gdk::Pixbuf> get_icon(IconManager & m) = 0;
47 protected:
SpecialNotebook(NoteManagerBase & m,const Glib::ustring & s)48   SpecialNotebook(NoteManagerBase & m, const Glib::ustring &s)
49     : Notebook(m, s, true)
50     {
51     }
52   virtual Tag::Ptr    get_tag() const override;
53   virtual Note::Ptr   get_template_note() const override;
54 };
55 
56 
57 class AllNotesNotebook
58   : public SpecialNotebook
59 {
60 public:
61   typedef std::shared_ptr<AllNotesNotebook> Ptr;
62   AllNotesNotebook(NoteManagerBase &);
63   virtual Glib::ustring get_normalized_name() const override;
64   virtual bool        contains_note(const Note::Ptr & note, bool include_system = false) override;
65   virtual bool        add_note(const Note::Ptr &) override;
66   virtual Glib::RefPtr<Gdk::Pixbuf> get_icon(IconManager & m) override;
67 };
68 
69 
70 class UnfiledNotesNotebook
71   : public SpecialNotebook
72 {
73 public:
74   typedef std::shared_ptr<UnfiledNotesNotebook> Ptr;
75   UnfiledNotesNotebook(NoteManagerBase &);
76   virtual Glib::ustring get_normalized_name() const override;
77   virtual bool        contains_note(const Note::Ptr & note, bool include_system = false) override;
78   virtual bool        add_note(const Note::Ptr &) override;
79   virtual Glib::RefPtr<Gdk::Pixbuf> get_icon(IconManager & m) override;
80 };
81 
82 
83 class PinnedNotesNotebook
84   : public SpecialNotebook
85 {
86 public:
87   typedef std::shared_ptr<PinnedNotesNotebook> Ptr;
88   PinnedNotesNotebook(NoteManagerBase &);
89   virtual Glib::ustring get_normalized_name() const override;
90   virtual bool        contains_note(const Note::Ptr & note, bool include_system = false) override;
91   virtual bool        add_note(const Note::Ptr &) override;
92   virtual Glib::RefPtr<Gdk::Pixbuf> get_icon(IconManager & m) override;
93 };
94 
95 
96 class ActiveNotesNotebook
97   : public SpecialNotebook
98 {
99 public:
100   typedef std::shared_ptr<ActiveNotesNotebook> Ptr;
101   ActiveNotesNotebook(NoteManagerBase &);
102   virtual Glib::ustring get_normalized_name() const override;
103   virtual bool        contains_note(const Note::Ptr & note, bool include_system = false) override;
104   virtual bool        add_note(const Note::Ptr &) override;
105   virtual Glib::RefPtr<Gdk::Pixbuf> get_icon(IconManager & m) override;
106   bool empty();
107   sigc::signal<void> signal_size_changed;
108 private:
109   void on_note_deleted(const NoteBase::Ptr & note);
110 
111   std::set<Note::Ptr> m_notes;
112 };
113 
114 
115 }
116 }
117 
118 #endif
119 
120