1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2008 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
21 // forward declarations
\r
23 class CRevisionGraphOptionList;
\r
25 /** Default implementation class for interfaces
\r
26 * that derive from IRevisionGraphOption.
\r
29 template<class Base>
\r
30 class IRevisionGraphOptionImpl : public Base
\r
42 /// construction / destruction
\r
44 IRevisionGraphOptionImpl ( CRevisionGraphOptionList& list
\r
47 virtual ~IRevisionGraphOptionImpl() {};
\r
51 /// implement IRevisionGraphOption
\r
53 virtual UINT CommandID() const;
\r
54 virtual int Priority() const;
\r
56 virtual bool IsAvailable() const;
\r
57 virtual bool IsSelected() const;
\r
58 virtual bool IsActive() const;
\r
60 virtual void ToggleSelection();
\r
62 virtual void Prepare();
\r
67 template<class Base>
\r
68 IRevisionGraphOptionImpl<Base>::IRevisionGraphOptionImpl
\r
69 ( CRevisionGraphOptionList& list
\r
72 : priority (priority)
\r
76 list.Add (static_cast<typename Base::I*>(this));
\r
79 // implement IRevisionGraphOption
\r
81 template<class Base>
\r
82 UINT IRevisionGraphOptionImpl<Base>::CommandID() const
\r
87 template<class Base>
\r
88 int IRevisionGraphOptionImpl<Base>::Priority() const
\r
93 template<class Base>
\r
94 bool IRevisionGraphOptionImpl<Base>::IsAvailable() const
\r
99 template<class Base>
\r
100 bool IRevisionGraphOptionImpl<Base>::IsSelected() const
\r
105 template<class Base>
\r
106 bool IRevisionGraphOptionImpl<Base>::IsActive() const
\r
108 return IsSelected();
\r
111 template<class Base>
\r
112 void IRevisionGraphOptionImpl<Base>::ToggleSelection()
\r
114 selected = !selected;
\r
117 template<class Base>
\r
118 void IRevisionGraphOptionImpl<Base>::Prepare()
\r
122 /** Implement a simple boolean option.
\r
125 template<class Base, int Prio, UINT ID>
\r
126 class CRevisionGraphOptionImpl : public IRevisionGraphOptionImpl<Base>
\r
130 typedef typename CRevisionGraphOptionImpl<Base, Prio, ID> inherited;
\r
134 /// construction / destruction
\r
136 CRevisionGraphOptionImpl (CRevisionGraphOptionList& list)
\r
137 : IRevisionGraphOptionImpl<Base>(list, Prio, ID)
\r
142 /** Implement an IOrderedTraversalOption boolean option.
\r
145 template<class Base, int Prio, UINT ID, bool CopyiesFirst, bool RootFirst>
\r
146 class COrderedTraversalOptionImpl
\r
147 : public CRevisionGraphOptionImpl<Base, Prio, ID>
\r
151 /// for simplied construction by the _derived_ class
\r
153 typedef typename COrderedTraversalOptionImpl< Base
\r
157 , RootFirst> inherited;
\r
161 /// construction / destruction
\r
163 COrderedTraversalOptionImpl (CRevisionGraphOptionList& list)
\r
164 : CRevisionGraphOptionImpl<Base, Prio, ID>(list)
\r
168 /// implement IOrderedTraversalOption
\r
170 virtual bool WantsCopiesFirst() const
\r
172 return CopyiesFirst;
\r
175 virtual bool WantsRootFirst() const
\r
181 /** Allow for two or more interfaces to be implemented by the same option.
\r
184 template<class I1, class I2>
\r
185 class CCombineInterface
\r
186 : public virtual I1
\r
187 , public virtual I2
\r