NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
#include <imagepanel.hpp>
Public Member Functions | |
ImagePanel (wxFrame *parent, wxString file, wxBitmapType format) | |
ImagePanel constructor. More... | |
void | paintEvent (wxPaintEvent &evt) |
Called by the system of by wxWidgets when the panel needs to be redrawn. You can also trigger this call by calling Refresh()/Update(). More... | |
void | paintNow () |
Alternatively, you can use a clientDC to paint on the panel at any time. Using this generally does not free you from catching paint events, since it is possible that e.g. the window manager throws away your drawing when the window comes to the background, and expects you will redraw it when the window comes back (by sending a paint event). More... | |
void | OnSize (wxSizeEvent &event) |
Here we call refresh to tell the panel to draw itself again. So when the user resizes the image panel the image should be resized too. More... | |
void | render (wxDC &dc) |
Here we do the actual rendering. I put it in a separate method so that it can work no matter what type of DC (e.g. wxPaintDC or wxClientDC) is used. More... | |
double | getRelation () const |
wxToolBar * | getToolbar () |
void | keyPressed (wxKeyEvent &event) |
This function closes the parent frame, if the user presses the ESC key. More... | |
void | OnNavigationKey (wxNavigationKeyEvent &event) |
This member function chooses the next or previous image in the file list, depending on the arrow key pressed by the user. More... | |
void | OnEnter (wxMouseEvent &event) |
On enter event handler focuses this panel. More... | |
void | OnFocus (wxFocusEvent &event) |
On focus event handler. More... | |
void | OnLoseFocus (wxFocusEvent &event) |
On lose focus event handler. More... | |
void | OnSaveAs (wxCommandEvent &event) |
This member function handles the "save as" toolbar option of the parent frame. More... | |
void | OnCopy (wxCommandEvent &event) |
This member function handles the "copy" toolbar option of the parent frame. More... | |
void | OnNextImage (wxCommandEvent &event) |
This member function displays the next image in the current folder. More... | |
void | OnPreviousImage (wxCommandEvent &event) |
This member function displays the previous image in the current folder. More... | |
Private Member Functions | |
wxArrayString | getFileList (const wxString &dirname) |
This method returns a list of all files in the current folder (used for iterating over all images). More... | |
void | LoadImage (const wxString &filename, wxBitmapType=wxBITMAP_TYPE_ANY, bool doUpdateFrame=true) |
This method loads the specified file, updates the parent frame's size (if desired) and displays the image as a bitmap. More... | |
bool | LoadNextImage (const wxFileName &filename) |
This method tries to load the desired image file and returns, whether it was successful or not. More... | |
Private Attributes | |
wxImage | image |
wxBitmap | resized |
wxToolBar * | toptoolbar |
wxString | currentFile |
wxFrame * | parentFrame |
int | w |
int | h |
int | sized_w |
int | sized_h |
Definition at line 24 of file imagepanel.hpp.
ImagePanel::ImagePanel | ( | wxFrame * | parent, |
wxString | file, | ||
wxBitmapType | format | ||
) |
ImagePanel constructor.
parent | wxFrame* |
file | wxString |
format | wxBitmapType |
Definition at line 66 of file imagepanel.cpp.
References _guilang, date::format(), Language::get(), ID_COPYIMAGE, ID_NEXTIMAGE, ID_PREVIOUSIMAGE, ID_SAVEIMAGE, OnCopy(), OnNextImage(), OnPreviousImage(), and OnSaveAs().
|
private |
This method returns a list of all files in the current folder (used for iterating over all images).
dirname | const wxString& |
Definition at line 163 of file imagepanel.cpp.
Referenced by OnNextImage(), and OnPreviousImage().
|
inline |
Definition at line 45 of file imagepanel.hpp.
Referenced by LoadImage(), and NumeReWindow::openImage().
|
inline |
Definition at line 48 of file imagepanel.hpp.
References toptoolbar.
void ImagePanel::keyPressed | ( | wxKeyEvent & | event | ) |
This function closes the parent frame, if the user presses the ESC key.
event | wxKeyEvent& |
Definition at line 275 of file imagepanel.cpp.
|
private |
This method loads the specified file, updates the parent frame's size (if desired) and displays the image as a bitmap.
filename | const wxString& |
format | wxBitmapType |
doUpdateFrame | bool |
Definition at line 100 of file imagepanel.cpp.
References currentFile, date::format(), getRelation(), h, image, paintNow(), parentFrame, sized_h, sized_w, and w.
Referenced by LoadNextImage().
|
private |
This method tries to load the desired image file and returns, whether it was successful or not.
filename | const wxFileName& |
Definition at line 128 of file imagepanel.cpp.
References date::format(), and LoadImage().
Referenced by OnNextImage(), and OnPreviousImage().
void ImagePanel::OnCopy | ( | wxCommandEvent & | event | ) |
This member function handles the "copy" toolbar option of the parent frame.
event | wxCommandEvent& |
Definition at line 381 of file imagepanel.cpp.
References image.
Referenced by ImagePanel().
void ImagePanel::OnEnter | ( | wxMouseEvent & | event | ) |
On enter event handler focuses this panel.
event | wxMouseEvent& |
Definition at line 311 of file imagepanel.cpp.
void ImagePanel::OnFocus | ( | wxFocusEvent & | event | ) |
On focus event handler.
event | wxFocusEvent& |
Definition at line 325 of file imagepanel.cpp.
void ImagePanel::OnLoseFocus | ( | wxFocusEvent & | event | ) |
On lose focus event handler.
event | wxFocusEvent& |
Definition at line 339 of file imagepanel.cpp.
void ImagePanel::OnNavigationKey | ( | wxNavigationKeyEvent & | event | ) |
This member function chooses the next or previous image in the file list, depending on the arrow key pressed by the user.
event | wxNavigationKeyEvent& |
Definition at line 292 of file imagepanel.cpp.
References OnNextImage(), and OnPreviousImage().
void ImagePanel::OnNextImage | ( | wxCommandEvent & | event | ) |
This member function displays the next image in the current folder.
event | wxCommandEvent& |
Definition at line 399 of file imagepanel.cpp.
References currentFile, getFileList(), and LoadNextImage().
Referenced by ImagePanel(), and OnNavigationKey().
void ImagePanel::OnPreviousImage | ( | wxCommandEvent & | event | ) |
This member function displays the previous image in the current folder.
event | wxCommandEvent& |
Definition at line 428 of file imagepanel.cpp.
References currentFile, getFileList(), and LoadNextImage().
Referenced by ImagePanel(), and OnNavigationKey().
void ImagePanel::OnSaveAs | ( | wxCommandEvent & | event | ) |
This member function handles the "save as" toolbar option of the parent frame.
event | wxCommandEvent& |
Definition at line 354 of file imagepanel.cpp.
References _guilang, currentFile, Language::get(), and image.
Referenced by ImagePanel().
void ImagePanel::OnSize | ( | wxSizeEvent & | event | ) |
Here we call refresh to tell the panel to draw itself again. So when the user resizes the image panel the image should be resized too.
event | wxSizeEvent& |
Definition at line 259 of file imagepanel.cpp.
void ImagePanel::paintEvent | ( | wxPaintEvent & | evt | ) |
Called by the system of by wxWidgets when the panel needs to be redrawn. You can also trigger this call by calling Refresh()/Update().
evt | wxPaintEvent& |
Definition at line 182 of file imagepanel.cpp.
References render().
void ImagePanel::paintNow | ( | ) |
Alternatively, you can use a clientDC to paint on the panel at any time. Using this generally does not free you from catching paint events, since it is possible that e.g. the window manager throws away your drawing when the window comes to the background, and expects you will redraw it when the window comes back (by sending a paint event).
Definition at line 203 of file imagepanel.cpp.
References render().
Referenced by LoadImage().
void ImagePanel::render | ( | wxDC & | dc | ) |
Here we do the actual rendering. I put it in a separate method so that it can work no matter what type of DC (e.g. wxPaintDC or wxClientDC) is used.
dc | wxDC& |
Definition at line 221 of file imagepanel.cpp.
References h, image, resized, sized_h, sized_w, and w.
Referenced by paintEvent(), and paintNow().
|
private |
Definition at line 29 of file imagepanel.hpp.
Referenced by LoadImage(), OnNextImage(), OnPreviousImage(), and OnSaveAs().
|
private |
Definition at line 31 of file imagepanel.hpp.
Referenced by getRelation(), LoadImage(), and render().
|
private |
Definition at line 26 of file imagepanel.hpp.
Referenced by LoadImage(), OnCopy(), OnSaveAs(), and render().
|
private |
Definition at line 30 of file imagepanel.hpp.
Referenced by LoadImage().
|
private |
Definition at line 27 of file imagepanel.hpp.
Referenced by render().
|
private |
Definition at line 31 of file imagepanel.hpp.
Referenced by LoadImage(), and render().
|
private |
Definition at line 31 of file imagepanel.hpp.
Referenced by LoadImage(), and render().
|
private |
Definition at line 28 of file imagepanel.hpp.
Referenced by getToolbar().
|
private |
Definition at line 31 of file imagepanel.hpp.
Referenced by getRelation(), LoadImage(), and render().