Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SelectCropAspectRatioDialog.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
2 
11 /* This is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This software is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public
22  * License along with this software. If not, see
23  * <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef _SELECTCROPASPECTRATIODIALOG_H
28 #define _SELECTCROPASPECTRATIODIALOG_H
29 
30 #include <wx/dialog.h>
31 #include <wx/listbox.h>
32 #include <wx/filename.h>
33 #include <vector>
34 
35 class SelectAspectRatioDialog :public wxDialog
36 {
37 public:
39  SelectAspectRatioDialog(wxWindow* parent);
43  double GetSelectedAspectRatio() const;
44 protected:
46  void OnOk(wxCommandEvent& e);
48  void OnAddAspectRatio(wxCommandEvent& e);
50  void OnRemoveAspectRatio(wxCommandEvent& e);
52  void OnListBoxSelect(wxCommandEvent& e);
53 private:
58  void FillListBox();
60  wxFileName GetAspectRatioFilename() const;
62  void LoadAspectRatios();
64  void SaveAspectRatios();
66  wxArrayString m_aspectRatioStrings;
68  std::vector<double> m_aspectRatios;
70  wxListBox* m_aspectList;
71 };
72 
73 #endif //_SELECTCROPASPECTRATIODIALOG_H
std::vector< double > m_aspectRatios
vector with values of all aspect ratios, ratio=width/height
void OnListBoxSelect(wxCommandEvent &e)
event handler for activation/deactivation of buttons if necessary
void OnOk(wxCommandEvent &e)
handler for Ok, check for valid inputs
wxArrayString m_aspectRatioStrings
array with names of all aspect ratios
void LoadAspectRatios()
load aspect ratios from file
void SaveAspectRatios()
save the aspect ratios to the file
double GetSelectedAspectRatio() const
returns the selected aspect ratio
void OnRemoveAspectRatio(wxCommandEvent &e)
handler for removing selected aspect ratio
void OnAddAspectRatio(wxCommandEvent &e)
handler for adding new aspect ratio setting
wxListBox * m_aspectList
pointer to wxListBox of aspect ratios
wxFileName GetAspectRatioFilename() const
returns the file name for the list of aspect ratios
~SelectAspectRatioDialog()
destructor, save position and list of aspect ratios
SelectAspectRatioDialog(wxWindow *parent)
constructor, build dialog and load settings from file
void FillListBox()
read the settings from the file and add them to the list box if the file does not exist...
void ListBoxSelectionChanged()
implementation of activation/deactivation of buttons if necessary