OSDN Git Service

fix cmake/Macros.cmake
[moflib/moflib.git] / moflib-1.0 / moflib / moflib / mof / widget / Pager.cpp
1 #include <mof/widget/WidgetView.hpp>
2 #include <mof/widget/Pager.hpp>
3 #include <deque>
4 #include <memory>
5 #include <mof/widget/NullView.hpp>
6 #include <mof/utilities.hpp>
7
8 namespace mof
9 {
10 namespace widget
11 {
12    struct Pager::Impl
13    {
14        std::deque<Page> pageQueue; 
15
16        Impl()
17            {
18                    pageQueue.push_back(Page(std::make_shared<NullView>(), ""));
19            }
20
21        ~Impl(){}
22    };
23
24 //{{{ constructor
25    Pager::Pager()
26    : pImpl_(new Impl)
27    {
28    }
29 //}}}
30 //{{{ destructor
31    Pager::~Pager()
32    {
33    }
34 //}}}
35 //{{{ getPage
36    const Page& Pager::getPage() const
37    {
38                 return pImpl_->pageQueue.front();
39    }
40 //}}}
41 //{{{ getPage
42    Page& Pager::getPage()
43    {
44                 return pImpl_->pageQueue.front();
45    }
46 //}}}
47 //{{{ addPage
48    void Pager::addPage( const Page& page )
49    {
50        pImpl_->pageQueue.push_back(page);
51    }
52 //}}}
53 //{{{ next
54    void Pager::next()
55    {
56        pImpl_->pageQueue.pop_front();
57    }
58 //}}}
59 //{{{ size
60    size_t Pager::size() const
61    {
62        return pImpl_->pageQueue.size();
63    }
64 //}}}
65
66 }// namespace widget
67 }// namespace mof
68