mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Added ValueViewer,DataViewer,CardViewer and made related changes
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@49 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <gui/control/card_viewer.hpp>
|
||||
#include <data/stylesheet.hpp>
|
||||
#include <wx/dcbuffer.h>
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardViewer
|
||||
|
||||
CardViewer::CardViewer(Window* parent, int id, int style)
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, style)
|
||||
{}
|
||||
|
||||
wxSize CardViewer::DoGetBestSize() const {
|
||||
wxSize ws = GetSize(), cs = GetClientSize();
|
||||
return wxSize(set->stylesheet->card_width, set->stylesheet->card_height) + ws - cs;
|
||||
}
|
||||
|
||||
void CardViewer::onPaint(wxPaintEvent&) {
|
||||
wxBufferedPaintDC dc(this);
|
||||
dc.BeginDrawing();
|
||||
draw(dc);
|
||||
dc.EndDrawing();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Event table
|
||||
|
||||
BEGIN_EVENT_TABLE(CardViewer, wxControl)
|
||||
EVT_PAINT (CardViewer::onPaint)
|
||||
END_EVENT_TABLE ()
|
||||
@@ -0,0 +1,36 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
#ifndef HEADER_GUI_CONTROL_CARD_VIEWER
|
||||
#define HEADER_GUI_CONTROL_CARD_VIEWER
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <render/card/viewer.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardViewer
|
||||
|
||||
/// A control to view a single card
|
||||
class CardViewer : public wxControl, public DataViewer {
|
||||
public:
|
||||
CardViewer(Window* parent, int id, int style);
|
||||
|
||||
protected:
|
||||
/// Return the desired size of control
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
void onPaint(wxPaintEvent&);
|
||||
void onSize(wxSizeEvent&);
|
||||
|
||||
Bitmap buffer; /// < Off-screen buffer we draw to
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
Reference in New Issue
Block a user