3 /// Utility functions specific to Barry Desktop
7 Copyright (C) 2009-2010, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
23 #include "barrydesktop.h"
24 #include "windowids.h"
26 const wxChar
*ButtonNames
[] = {
32 _T("browsedatabases"),
38 const wxChar
*StateNames
[] = {
45 //////////////////////////////////////////////////////////////////////////////
48 std::string
GetBaseFilename(const std::string
&filename
)
50 std::string file
= BARRYDESKTOP_BASEDATADIR
;
52 if( wxFileExists(wxString(file
.c_str(), wxConvUTF8
)) )
55 // fall back to the devel tree
59 /// Returns full path and filename for given filename.
60 /// 'filename' should have no directory component, as the
61 /// directory will be prepended and returned.
62 wxString
GetImageFilename(const wxString
&filename
)
64 // try the official install directory first
65 wxString file
= _T(BARRYDESKTOP_IMAGEDIR
);
67 if( wxFileExists(file
) )
70 // oops, assume we're running from the build directory,
71 // and use the images dir
72 file
= wxPathOnly(wxGetApp().argv
[0]);
73 file
+= _T("/../images/");
78 wxString
GetButtonFilename(int id
, int state
)
80 return GetImageFilename(
81 wxString(ButtonNames
[id
- MainMenu_FirstButton
]) +