mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
added native look editor and the set info panel
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@82 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -18,13 +18,6 @@ DECLARE_TYPEOF_COLLECTION(ValueViewer*);
|
||||
|
||||
// ----------------------------------------------------------------------------- : DataEditor
|
||||
|
||||
#define FOR_EACH_EDITOR \
|
||||
FOR_EACH(v, viewers) \
|
||||
if (ValueEditor* e = v->getEditor())
|
||||
#define FOR_EACH_EDITOR_REVERSE \
|
||||
FOR_EACH_REVERSE(v, viewers) \
|
||||
if (ValueEditor* e = v->getEditor())
|
||||
|
||||
DataEditor::DataEditor(Window* parent, int id, long style)
|
||||
: CardViewer(parent, id, style)
|
||||
, current_viewer(nullptr)
|
||||
|
||||
@@ -110,5 +110,14 @@ class DataEditor : public CardViewer {
|
||||
/// By default a DataEditor edits cards
|
||||
typedef DataEditor CardEditor;
|
||||
|
||||
// ----------------------------------------------------------------------------- : Utility
|
||||
|
||||
#define FOR_EACH_EDITOR \
|
||||
FOR_EACH(v, viewers) \
|
||||
if (ValueEditor* e = v->getEditor())
|
||||
#define FOR_EACH_EDITOR_REVERSE \
|
||||
FOR_EACH_REVERSE(v, viewers) \
|
||||
if (ValueEditor* e = v->getEditor())
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@ DEFINE_EVENT_TYPE(EVENT_CARD_SELECT);
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardListBase
|
||||
|
||||
CardListBase::CardListBase(Window* parent, int id, int additional_style)
|
||||
CardListBase::CardListBase(Window* parent, int id, long additional_style)
|
||||
: wxListView(parent, id, wxDefaultPosition, wxDefaultSize, additional_style | wxLC_REPORT | wxLC_VIRTUAL | wxLC_SINGLE_SEL)
|
||||
{
|
||||
// create image list
|
||||
|
||||
@@ -47,7 +47,7 @@ struct CardSelectEvent : public wxCommandEvent {
|
||||
*/
|
||||
class CardListBase : public wxListView, public SetView {
|
||||
public:
|
||||
CardListBase(Window* parent, int id, int additional_style = 0);
|
||||
CardListBase(Window* parent, int id, long additional_style = 0);
|
||||
~CardListBase();
|
||||
|
||||
// --------------------------------------------------- : Selection
|
||||
|
||||
@@ -12,7 +12,7 @@ DECLARE_TYPEOF_COLLECTION(CardP);
|
||||
|
||||
// ----------------------------------------------------------------------------- : FilteredCardList
|
||||
|
||||
FilteredCardList::FilteredCardList(Window* parent, int id, int style)
|
||||
FilteredCardList::FilteredCardList(Window* parent, int id, long style)
|
||||
: CardListBase(parent, id, style)
|
||||
{}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class CardListFilter {
|
||||
/// A card list that lists a subset of the cards in the set
|
||||
class FilteredCardList : public CardListBase {
|
||||
public:
|
||||
FilteredCardList(Window* parent, int id, int style = 0);
|
||||
FilteredCardList(Window* parent, int id, long style = 0);
|
||||
|
||||
/// Change the filter to use
|
||||
void setFilter(const CardListFilterP& filter_);
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| 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/native_look_editor.hpp>
|
||||
#include <gui/value/editor.hpp>
|
||||
#include <gui/util.hpp>
|
||||
#include <data/stylesheet.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(ValueViewerP);
|
||||
typedef IndexMap<FieldP,StyleP> IndexMap_FieldP_StyleP;
|
||||
DECLARE_TYPEOF_NO_REV(IndexMap_FieldP_StyleP);
|
||||
|
||||
// ----------------------------------------------------------------------------- : NativeLookEditor
|
||||
|
||||
NativeLookEditor::NativeLookEditor(Window* parent, int id, long style)
|
||||
: DataEditor(parent, id, style)
|
||||
{}
|
||||
|
||||
void NativeLookEditor::draw(DC& dc) {
|
||||
RotatedDC rdc(dc, 0, RealRect(RealPoint(0,0),GetClientSize()), 1, 0);
|
||||
DataViewer::draw(rdc, wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||
}
|
||||
void NativeLookEditor::drawViewer(RotatedDC& dc, ValueViewer& v) {
|
||||
// draw background
|
||||
Style& s = *v.getStyle();
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
dc.DrawRectangle(s.getRect().grow(1));
|
||||
// draw label
|
||||
dc.SetFont(*wxNORMAL_FONT);
|
||||
dc.DrawText(capitalize_sentence(s.fieldP->name), RealPoint(margin_left, s.top + 1));
|
||||
// draw 3D border
|
||||
draw_control_border(this, dc.getDC(), wxRect(s.left - 1, s.top - 1, s.width + 2, s.height + 2));
|
||||
// draw viewer
|
||||
v.draw(dc);
|
||||
ValueEditor* e = v.getEditor();
|
||||
if (e) e->drawSelection(dc);
|
||||
}
|
||||
|
||||
void NativeLookEditor::resizeViewers() {
|
||||
// size stuff
|
||||
UInt y = margin;
|
||||
int w;
|
||||
GetClientSize(&w, 0);
|
||||
const int default_height = 17;
|
||||
// Set editor sizes
|
||||
FOR_EACH(v, viewers) {
|
||||
StyleP s = v->getStyle();
|
||||
s->left = margin + label_width;
|
||||
s->top = y;
|
||||
s->width = w - s->left - margin;
|
||||
s->height = default_height;
|
||||
ValueEditor* e = v->getEditor();
|
||||
if (e) e->determineSize();
|
||||
y += s->height + vspace;
|
||||
}
|
||||
}
|
||||
|
||||
void NativeLookEditor::onInit() {
|
||||
// Give fieldEditors a chance to show/hide controls (scrollbar) when selecting other editors
|
||||
FOR_EACH_EDITOR {
|
||||
e->onShow(true);
|
||||
}
|
||||
resizeViewers();
|
||||
}
|
||||
|
||||
wxSize NativeLookEditor::DoGetBestSize() const {
|
||||
return wxSize(200, 200);
|
||||
}
|
||||
void NativeLookEditor::onSize(wxSizeEvent& ev) {
|
||||
// CardViewre::onSize(ev);
|
||||
resizeViewers();
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(NativeLookEditor, DataEditor)
|
||||
EVT_SIZE (NativeLookEditor::onSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : SetInfoEditor
|
||||
|
||||
SetInfoEditor::SetInfoEditor(Window* parent, int id, long style)
|
||||
: NativeLookEditor(parent, id, style)
|
||||
{}
|
||||
|
||||
void SetInfoEditor::onChangeSet() {
|
||||
setStyles(set->stylesheet->set_info_style);
|
||||
setData(set->data);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : StylingEditor
|
||||
|
||||
StylingEditor::StylingEditor(Window* parent, int id, long style)
|
||||
: NativeLookEditor(parent, id, style)
|
||||
{}
|
||||
|
||||
void StylingEditor::showStylesheet(const StyleSheetP& stylesheet) {
|
||||
this->stylesheet = stylesheet;
|
||||
setStyles(stylesheet->styling_style);
|
||||
setData(set->stylingDataFor(*stylesheet));
|
||||
}
|
||||
|
||||
void StylingEditor::onChangeSet() {
|
||||
showStylesheet(set->stylesheet);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| 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_NATIVE_LOOK_EDITOR
|
||||
#define HEADER_GUI_CONTROL_NATIVE_LOOK_EDITOR
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <gui/control/card_editor.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : NativeLookEditor
|
||||
|
||||
/// A data editor with a platform native look
|
||||
class NativeLookEditor : public DataEditor {
|
||||
public:
|
||||
NativeLookEditor(Window* parent, int id, long style = 0);
|
||||
|
||||
/// Uses a native look
|
||||
virtual bool nativeLook() const { return true; }
|
||||
virtual bool drawBorders() const { return false; }
|
||||
|
||||
virtual void draw(DC& dc);
|
||||
virtual void drawViewer(RotatedDC& dc, ValueViewer& v);
|
||||
|
||||
protected:
|
||||
// Best size doesn't really matter, as long as it is not too small
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual void onInit();
|
||||
|
||||
private:
|
||||
static const UInt margin = 6;
|
||||
static const UInt margin_left = 4;
|
||||
static const UInt label_width = 150;
|
||||
static const UInt vspace = 10;
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
void onSize(wxSizeEvent&);
|
||||
/// Resize the viewers so they match with this control
|
||||
void resizeViewers();
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : SetInfoEditor
|
||||
|
||||
/// Editor for set.data
|
||||
class SetInfoEditor : public NativeLookEditor {
|
||||
public:
|
||||
SetInfoEditor(Window* parent, int id, long style = 0);
|
||||
protected:
|
||||
virtual void onChangeSet();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : StylingEditor
|
||||
|
||||
/// Editor for styling data
|
||||
class StylingEditor : public NativeLookEditor {
|
||||
public:
|
||||
StylingEditor(Window* parent, int id, long style = 0);
|
||||
|
||||
/// Show the styling for given stylesheet in the editor
|
||||
void showStylesheet(const StyleSheetP& stylesheet);
|
||||
|
||||
protected:
|
||||
virtual void onChangeSet();
|
||||
|
||||
private:
|
||||
StyleSheetP stylesheet; ///< The stylesheet for which we are showing the styling data
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
@@ -25,7 +25,7 @@ class CardsPanel : public SetWindowPanel {
|
||||
~CardsPanel();
|
||||
|
||||
void onChangeSet();
|
||||
|
||||
|
||||
// --------------------------------------------------- : UI
|
||||
|
||||
virtual void initUI (wxToolBar* tb, wxMenuBar* mb);
|
||||
|
||||
@@ -7,10 +7,77 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <gui/set/set_info_panel.hpp>
|
||||
#include <gui/control/native_look_editor.hpp>
|
||||
#include <gui/icon_menu.hpp>
|
||||
#include <util/window_id.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : SetInfoPanel
|
||||
|
||||
SetInfoPanel::SetInfoPanel(Window* parent, int id)
|
||||
: SetWindowPanel(parent, id)
|
||||
{
|
||||
// init controls
|
||||
editor = new SetInfoEditor(this, wxID_ANY);
|
||||
// init sizer
|
||||
wxSizer* s = new wxBoxSizer(wxVERTICAL);
|
||||
s->Add(editor, 1, wxEXPAND, 2);
|
||||
s->SetSizeHints(this);
|
||||
SetSizer(s);
|
||||
}
|
||||
|
||||
void SetInfoPanel::onChangeSet() {
|
||||
editor->setSet(set);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : UI
|
||||
|
||||
void SetInfoPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
|
||||
// Toolbar
|
||||
tb->AddTool(ID_FORMAT_BOLD, _(""), Bitmap(_("TOOL_BOLD")), wxNullBitmap, wxITEM_CHECK, _("Bold"));
|
||||
tb->AddTool(ID_FORMAT_ITALIC, _(""), Bitmap(_("TOOL_ITALIC")), wxNullBitmap, wxITEM_CHECK, _("Italic"));
|
||||
tb->AddTool(ID_FORMAT_SYMBOL, _(""), Bitmap(_("TOOL_SYMBOL")), wxNullBitmap, wxITEM_CHECK, _("Symbols"));
|
||||
tb->Realize();
|
||||
// Menus
|
||||
IconMenu* menuFormat = new IconMenu();
|
||||
menuFormat->Append(ID_FORMAT_BOLD, _("TOOL_BOLD"), _("Bold\tCtrl+B"), _("Makes the selected text bold"), wxITEM_CHECK);
|
||||
menuFormat->Append(ID_FORMAT_ITALIC, _("TOOL_ITALIC"), _("Italic\tCtrl+I"), _("Makes the selected text italic"), wxITEM_CHECK);
|
||||
menuFormat->Append(ID_FORMAT_SYMBOL, _("TOOL_SYMBOL"), _("Symbols\tCtrl+M"), _("Draws the selected text with symbols"), wxITEM_CHECK);
|
||||
menuFormat->Append(ID_FORMAT_REMINDER, _("TOOL_REMINDER"), _("Reminder Text\tCtrl+R"), _("Show reminder text for the selected keyword"), wxITEM_CHECK);
|
||||
mb->Insert(2, menuFormat, _("&Format"));
|
||||
}
|
||||
|
||||
void SetInfoPanel::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
|
||||
// Toolbar
|
||||
tb->DeleteTool(ID_FORMAT_BOLD);
|
||||
tb->DeleteTool(ID_FORMAT_ITALIC);
|
||||
tb->DeleteTool(ID_FORMAT_SYMBOL);
|
||||
// Menus
|
||||
delete mb->Remove(2);
|
||||
}
|
||||
|
||||
void SetInfoPanel::onUpdateUI(wxUpdateUIEvent& e) {
|
||||
switch (e.GetId()) {
|
||||
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_SYMBOL: {
|
||||
e.Enable(editor->canFormat(e.GetId()));
|
||||
e.Check (editor->hasFormat(e.GetId()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetInfoPanel::onCommand(int id) {
|
||||
switch (id) {
|
||||
case ID_FORMAT_BOLD: case ID_FORMAT_ITALIC: case ID_FORMAT_SYMBOL: {
|
||||
editor->doFormat(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Clipboard
|
||||
|
||||
bool SetInfoPanel::canCut() const { return editor->canCut(); }
|
||||
bool SetInfoPanel::canCopy() const { return editor->canCopy(); }
|
||||
bool SetInfoPanel::canPaste() const { return editor->canPaste(); }
|
||||
void SetInfoPanel::doCut() { editor->doCut(); }
|
||||
void SetInfoPanel::doCopy() { editor->doCopy(); }
|
||||
void SetInfoPanel::doPaste() { editor->doPaste(); }
|
||||
|
||||
@@ -12,11 +12,35 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <gui/set/panel.hpp>
|
||||
|
||||
class SetInfoEditor;
|
||||
|
||||
// ----------------------------------------------------------------------------- : SetInfoPanel
|
||||
|
||||
class SetInfoPanel : public SetWindowPanel {
|
||||
public:
|
||||
SetInfoPanel(Window* parent, int id);
|
||||
|
||||
// --------------------------------------------------- : UI
|
||||
|
||||
virtual void initUI (wxToolBar* tb, wxMenuBar* mb);
|
||||
virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb);
|
||||
virtual void onUpdateUI(wxUpdateUIEvent& e);
|
||||
virtual void onCommand(int id);
|
||||
|
||||
// --------------------------------------------------- : Clipboard
|
||||
|
||||
virtual bool canCut() const;
|
||||
virtual bool canCopy() const;
|
||||
virtual bool canPaste() const;
|
||||
virtual void doCut();
|
||||
virtual void doCopy();
|
||||
virtual void doPaste();
|
||||
|
||||
protected:
|
||||
virtual void onChangeSet();
|
||||
|
||||
private:
|
||||
SetInfoEditor* editor;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
+6
-11
@@ -116,16 +116,13 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
|
||||
// NOTE: place the CardsPanel last in the panels list,
|
||||
// this way the card list is the last to be told of a set change
|
||||
// this way everyone else already uses the new set when it sends a CardSelectEvent
|
||||
addPanel(menuWindow, tabBar, new CardsPanel (this, wxID_ANY), 2, _("F5"), _("Cards"), _("Cards"), _("Edit the cards in the set"));
|
||||
// addPanel(menuWindow, tabBar, new SetInfoPanel (this, wxID_ANY), 0, _("F6"));
|
||||
addPanel(menuWindow, tabBar, new StylePanel (this, wxID_ANY), 1, _("F7"), _("Style"), _("Style"), _("Change the style of cards"));
|
||||
addPanel(menuWindow, tabBar, new CardsPanel (this, wxID_ANY), 3, _("F5"), _("Cards"), _("Cards"), _("Edit the cards in the set"));
|
||||
addPanel(menuWindow, tabBar, new SetInfoPanel (this, wxID_ANY), 0, _("F6"), _("Set info"), _("&Set Information"), _("Edit information about the set, its creator, etc."));
|
||||
addPanel(menuWindow, tabBar, new StylePanel (this, wxID_ANY), 1, _("F7"), _("Style"), _("Style"), _("Change the style of cards"));
|
||||
// addPanel(menuWindow, tabBar, new KeywordsPanel(this, wxID_ANY), 2, _("F8"));
|
||||
// addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 3, _("F9"), _("Stats"), _("Statistics"), _("Show statistics about the cards in the set"));
|
||||
//addPanel(*s, *menuWindow, *tabBar, new DraftPanel (&this, wxID_ANY), 4, _("F10"))
|
||||
// selectPanel(idWindowMin + 4); // select cards panel
|
||||
|
||||
addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 0, _("F9"), _("Stats"), _("Statistics"), _("Show statistics about the cards in the set"));
|
||||
selectPanel(ID_WINDOW_MIN+2); // test
|
||||
addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 2, _("F9"), _("Stats"), _("Statistics"), _("Show statistics about the cards in the set"));
|
||||
// addPanel(*s, *menuWindow, *tabBar, new DraftPanel (&this, wxID_ANY), 4, _("F10"))
|
||||
selectPanel(ID_WINDOW_MIN + 3); // select cards panel
|
||||
|
||||
// loose ends
|
||||
tabBar->Realize();
|
||||
@@ -227,8 +224,6 @@ void SetWindow::onChangeSet() {
|
||||
// make sure there is always at least one card
|
||||
// some things need this
|
||||
if (set->cards.empty()) set->cards.push_back(new_shared1<Card>(*set->game));
|
||||
// does the set need a scriptUpdater? If so, we can do it
|
||||
// if (!set->scriptUpdater) scriptUpdater.set = set;
|
||||
// all panels view the same set
|
||||
FOR_EACH(p, panels) {
|
||||
p->setSet(set);
|
||||
|
||||
+58
-2
@@ -11,6 +11,12 @@
|
||||
#include <util/rotation.hpp>
|
||||
#include <wx/mstream.h>
|
||||
|
||||
#if defined(wxMSW) && wxUSE_UXTHEME
|
||||
#include <wx/msw/uxtheme.h>
|
||||
#include <tmschema.h>
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------- : DC related
|
||||
|
||||
/// Fill a DC with a single color
|
||||
@@ -43,7 +49,7 @@ void draw_checker(RotatedDC& dc, const RealRect& rect) {
|
||||
|
||||
// ----------------------------------------------------------------------------- : Image related
|
||||
|
||||
Image load_resource_image(String name) {
|
||||
Image load_resource_image(const String& name) {
|
||||
#ifdef __WXMSW__
|
||||
// Load resource
|
||||
// based on wxLoadUserResource
|
||||
@@ -61,4 +67,54 @@ Image load_resource_image(String name) {
|
||||
wxMemoryInputStream stream(data, len);
|
||||
return wxImage(stream);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Platform look
|
||||
|
||||
// Draw a basic 3D border
|
||||
void draw3DBorder(DC& dc, int x1, int y1, int x2, int y2) {
|
||||
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW));
|
||||
dc.DrawLine(x1, y1, x2, y1);
|
||||
dc.DrawLine(x1, y1, x1, y2);
|
||||
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));
|
||||
dc.DrawLine(x1-1, y1-1, x2+1, y1-1);
|
||||
dc.DrawLine(x1-1, y1-1, x1-1, y2+1);
|
||||
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT));
|
||||
dc.DrawLine(x1, y2, x2, y2);
|
||||
dc.DrawLine(x2, y1, x2, y2+1);
|
||||
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT));
|
||||
dc.DrawLine(x1-1, y2+1, x2+1, y2+1);
|
||||
dc.DrawLine(x2+1, y1-1, x2+1, y2+2);
|
||||
}
|
||||
|
||||
void draw_control_border(Window* win, DC& dc, const wxRect& rect) {
|
||||
#if defined(wxMSW) && wxUSE_UXTHEME
|
||||
RECT r;
|
||||
wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get();
|
||||
if (themeEngine && themeEngine->IsAppThemed()) {
|
||||
wxUxThemeHandle hTheme(win, L_("EDIT"));
|
||||
r.left = rect.x -1;
|
||||
r.top = rect.y -1;
|
||||
r.right = rect.x + rect.width + 1;
|
||||
r.bottom = rect.y + rect.height + 1;
|
||||
if (hTheme) {
|
||||
wxUxThemeEngine::Get()->DrawThemeBackground(
|
||||
hTheme,
|
||||
dc.GetHDC(),
|
||||
EP_EDITTEXT,
|
||||
ETS_NORMAL,
|
||||
&r,
|
||||
NULL
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
r.left = rect.x - 2;
|
||||
r.top = rect.y - 2;
|
||||
r.right = rect.x + rect.width + 2;
|
||||
r.bottom = rect.y + rect.height + 2;
|
||||
DrawEdge((HDC)dc.GetHDC(), &r, EDGE_SUNKEN, BF_RECT);
|
||||
#else
|
||||
draw3DBorder(dc, rect.x - 1, rect.y - 1, rect.x + rect.width, rect.y + rect.height);
|
||||
#endif
|
||||
}
|
||||
|
||||
+7
-1
@@ -29,7 +29,13 @@ void draw_checker(RotatedDC& dc, const RealRect&);
|
||||
// ----------------------------------------------------------------------------- : Resource related
|
||||
|
||||
/// Load an image from a resource
|
||||
Image load_resource_image(String name);
|
||||
Image load_resource_image(const String& name);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Platform look
|
||||
|
||||
/// Draws a border for a control *around* a rect
|
||||
/** Based on wxRendererXP::DrawComboBoxDropButton */
|
||||
void draw_control_border(Window* win, DC& dc, const wxRect& rect);
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
@@ -95,6 +95,15 @@ class ValueEditor {
|
||||
|
||||
/// The cursor type to use when the mouse is over this control
|
||||
virtual wxCursor cursor() const { return wxCursor(); }
|
||||
/// determines prefered size in the native look, update the style
|
||||
virtual void determineSize() {}
|
||||
/// The editor is shown or hidden
|
||||
virtual void onShow(bool) {}
|
||||
|
||||
/// Draw selection indicators
|
||||
/** note: the drawing of the value is done by the viewer, only a selection indicator is drawn here
|
||||
*/
|
||||
virtual void drawSelection(RotatedDC& dc) {}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : Utility
|
||||
|
||||
Reference in New Issue
Block a user