Implemented ImageValueViewer, and more of the related classes

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@54 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-27 22:10:09 +00:00
parent d9c9c40adf
commit 7192361c36
35 changed files with 485 additions and 37 deletions
+9 -7
View File
@@ -56,14 +56,14 @@ void CardListBase::onAction(const Action& action, bool undone) {
selectCardPos((long)sorted_card_list.size() - 1, true);
} else {
// select the new card
selectCard(action.card, false /*list will be refreshed anyway*/);
selectCard(action.card, false /*list will be refreshed anyway*/, true);
refreshList();
}
}
TYPE_CASE(action, RemoveCardAction) {
if (undone) {
// select the re-added card
selectCard(action.card, false /*list will be refreshed anyway*/);
selectCard(action.card, false /*list will be refreshed anyway*/, true);
refreshList();
} else {
long pos = selected_card_pos;
@@ -116,10 +116,12 @@ void CardListBase::selectNext() {
// ----------------------------------------------------------------------------- : CardListBase : Selection (private)
void CardListBase::selectCard(const CardP& card, bool focus) {
void CardListBase::selectCard(const CardP& card, bool focus, bool event) {
selected_card = card;
CardSelectEvent ev(card);
ProcessEvent(ev);
if (event) {
CardSelectEvent ev(card);
ProcessEvent(ev);
}
if (focus) {
findSelectedCardPos();
selectCurrentCard();
@@ -130,9 +132,9 @@ void CardListBase::selectCardPos(long pos, bool focus) {
if (selected_card_pos == pos && !focus) return; // this card is already selected
if ((size_t)pos < sorted_card_list.size()) {
// only if there is something to select
selectCard(sorted_card_list[pos], false);
selectCard(sorted_card_list[pos], false, true);
} else {
selectCard(CardP(), false);
selectCard(CardP(), false, true);
}
selected_card_pos = pos;
if (focus) selectCurrentCard();
+6 -3
View File
@@ -20,7 +20,10 @@ DECLARE_POINTER_TYPE(Field);
DECLARE_EVENT_TYPE(EVENT_CARD_SELECT, <not used>)
/// Handle CardSelectEvents
#define EVT_CARD_SELECT(id, handler) EVT_COMMAND(id, EVENT_CARD_SELECT, handler)
#define EVT_CARD_SELECT(id, handler) \
DECLARE_EVENT_TABLE_ENTRY(EVENT_CARD_SELECT, id, -1, \
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) \
(void (wxEvtHandler::*)(CardSelectEvent&)) (&handler), (wxObject*) NULL),
/// The event of selecting a card
struct CardSelectEvent : public wxCommandEvent {
@@ -50,7 +53,7 @@ class CardListBase : public wxListView, public SetView {
// --------------------------------------------------- : Selection
inline CardP getCard() const { return selected_card; }
inline void setCard(const CardP& card) { selectCard(card, true); }
inline void setCard(const CardP& card) { selectCard(card, true, false); }
/// Is there a previous card to select?
bool canSelectPrevious() const;
@@ -113,7 +116,7 @@ class CardListBase : public wxListView, public SetView {
/** If focus then the card is also focused and selected in the actual control.
* This should abviously not be done when the card is selected because it was selected (leading to a loop).
*/
void selectCard(const CardP& card, bool focus);
void selectCard(const CardP& card, bool focus, bool event);
/// Select a card at the specified position
void selectCardPos(long pos, bool focus);
/// Find the position for the selected_card