OSDN Git Service

BrowseRefs: Added option to delete branch or tag.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / RepositoryBar.h
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-2008 - TortoiseSVN\r
4 \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
9 \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
14 \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
18 //\r
19 #pragma once\r
20 \r
21 #include "GitRev.h"\r
22 #include "HistoryCombo.h"\r
23 #include "Tooltip.h"\r
24 #include "XPImageButton.h"\r
25 \r
26 class CRepositoryTree;\r
27 \r
28 /**\r
29  * \ingroup TortoiseProc\r
30  * Interface definition\r
31  */\r
32 class IRepo\r
33 {\r
34 public:\r
35         virtual bool ChangeToUrl(CString& url, GitRev& rev, bool bAlreadyChecked) = 0;\r
36         virtual CString GetRepoRoot() = 0;\r
37 };\r
38 \r
39 /**\r
40  * \ingroup TortoiseProc\r
41  * Provides a CReBarCtrl which can be used as a "control center" for the\r
42  * repository browser. To associate the repository bar with any repository\r
43  * tree control, call AssocTree() once after both objects are created. As\r
44  * long as they are associated, the bar and the tree form a "team" of\r
45  * controls that work together.\r
46  */\r
47 class CRepositoryBar : public CReBarCtrl\r
48 {\r
49         DECLARE_DYNAMIC(CRepositoryBar)\r
50 \r
51 public:\r
52         CRepositoryBar();\r
53         virtual ~CRepositoryBar();\r
54 \r
55 public:\r
56         /**\r
57          * Creates the repository bar. Set \a in_dialog to TRUE when the bar\r
58          * is placed inside of a dialog. Otherwise it is assumed that the\r
59          * bar is placed in a frame window.\r
60          */\r
61         bool Create(CWnd* parent, UINT id, bool in_dialog = true);\r
62 \r
63         /**\r
64          * Show the given \a svn_url in the URL combo and the revision button.\r
65          */\r
66         void ShowUrl(const CString& url, GitRev rev);\r
67 \r
68         /**\r
69          * Show the given \a svn_url in the URL combo and the revision button,\r
70          * and select it in the associated repository tree. If no \a svn_url\r
71          * is given, the current values are used (which effectively refreshes\r
72          * the tree).\r
73          */\r
74         void GotoUrl(const CString& url = CString(), GitRev rev = GitRev(), bool bAlreadyChecked = false);\r
75 \r
76         /**\r
77          * Returns the current URL.\r
78          */\r
79         CString GetCurrentUrl() const;\r
80 \r
81         /**\r
82          * Returns the current revision\r
83          */\r
84         GitRev GetCurrentRev() const;\r
85 \r
86         /**\r
87          * Saves the URL history of the HistoryCombo.\r
88          */\r
89         void SaveHistory();\r
90         \r
91         /**\r
92          * Set the revision\r
93          */\r
94         void SetRevision(GitRev rev);\r
95 \r
96         void SetFocusToURL();\r
97 \r
98         void SetIRepo(IRepo * pRepo) {m_pRepo = pRepo;}\r
99 \r
100         void SetHeadRevision(const GitRev& rev) {m_headRev = rev;}\r
101         afx_msg void OnGoUp();\r
102 protected:\r
103         virtual BOOL PreTranslateMessage(MSG* pMsg);\r
104         afx_msg void OnCbnSelChange();\r
105         afx_msg void OnBnClicked();\r
106         afx_msg void OnDestroy();\r
107 \r
108         DECLARE_MESSAGE_MAP()\r
109 \r
110 private:\r
111         CString m_url;\r
112         GitRev m_rev;\r
113 \r
114         IRepo * m_pRepo;\r
115 \r
116         class CRepositoryCombo : public CHistoryCombo \r
117         {\r
118                 CRepositoryBar *m_bar;\r
119         public:\r
120                 CRepositoryCombo(CRepositoryBar *bar) : m_bar(bar) {}\r
121                 virtual bool OnReturnKeyPressed();\r
122         } m_cbxUrl;\r
123 \r
124         CButton m_btnRevision;\r
125         CXPImageButton m_btnUp;\r
126 \r
127         GitRev  m_headRev;\r
128         CToolTips m_tooltips;\r
129         HICON   m_UpIcon;\r
130 };\r
131 \r
132 \r
133 /**\r
134  * \ingroup TortoiseProc\r
135  * Implements a visual container for a CRepositoryBar which may be added to a\r
136  * dialog. A CRepositoryBarCnr is not needed if the CRepositoryBar is attached\r
137  * to a frame window.\r
138  */\r
139 class CRepositoryBarCnr : public CStatic\r
140 {\r
141         DECLARE_DYNAMIC(CRepositoryBarCnr)\r
142 \r
143 public:\r
144         CRepositoryBarCnr(CRepositoryBar *repository_bar);\r
145         ~CRepositoryBarCnr();\r
146 \r
147         // Generated message map functions\r
148 protected:\r
149         afx_msg BOOL OnEraseBkgnd(CDC* pDC);\r
150         afx_msg void OnSize(UINT nType, int cx, int cy);\r
151         afx_msg UINT OnGetDlgCode();\r
152         afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);\r
153 \r
154         virtual void DrawItem(LPDRAWITEMSTRUCT);\r
155 \r
156         DECLARE_MESSAGE_MAP()\r
157 \r
158 private:\r
159         CRepositoryBar *m_pbarRepository;\r
160 \r
161 };\r
162 \r
163 \r