screen: change ScreenType to WindowType and add WindowReference typedef

This commit is contained in:
Andrzej Rybczak
2012-09-14 17:43:11 +02:00
parent 0d27d6ded3
commit 830a2832b5
12 changed files with 27 additions and 25 deletions

View File

@@ -253,7 +253,7 @@ void Browser::mouseButtonPressed(MEVENT me)
}
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
/***********************************************************************/

View File

@@ -444,7 +444,7 @@ void MediaLibrary::mouseButtonPressed(MEVENT me)
}
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
Albums.clear();
Songs.clear();
}
@@ -472,7 +472,7 @@ void MediaLibrary::mouseButtonPressed(MEVENT me)
}
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
Songs.clear();
}
else if (!Songs.empty() && Songs.hasCoords(me.x, me.y))
@@ -493,7 +493,7 @@ void MediaLibrary::mouseButtonPressed(MEVENT me)
enterPressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
}

View File

@@ -107,7 +107,7 @@ void Outputs::mouseButtonPressed(MEVENT me)
enterPressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
void Outputs::FetchList()

View File

@@ -138,7 +138,7 @@ void Playlist::mouseButtonPressed(MEVENT me)
enterPressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
}

View File

@@ -295,7 +295,7 @@ void PlaylistEditor::mouseButtonPressed(MEVENT me)
}
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
Content->clear();
}
else if (!Content->empty() && Content->hasCoords(me.x, me.y))
@@ -321,7 +321,7 @@ void PlaylistEditor::mouseButtonPressed(MEVENT me)
enterPressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
}

View File

@@ -115,14 +115,18 @@ bool isVisible(BasicScreen *screen);
/// for the screen to be working properly and assumes that we didn't forget
/// about anything vital.
///
template <typename WindowT> class Screen : public BasicScreen
template <typename WindowT> struct Screen : public BasicScreen
{
typedef WindowT WindowType;
typedef typename std::add_lvalue_reference<WindowType>::type WindowReference;
private:
template <bool IsPointer, typename Result> struct access { };
template <typename Result> struct access<true, Result> {
static Result apply(WindowT w) { return *w; }
static Result apply(WindowType w) { return *w; }
};
template <typename Result> struct access<false, Result> {
static Result apply(WindowT &w) { return w; }
static Result apply(WindowReference w) { return w; }
};
typedef access<
@@ -133,8 +137,6 @@ template <typename WindowT> class Screen : public BasicScreen
> accessor;
public:
typedef WindowT ScreenType;
Screen() { }
Screen(WindowT w_) : w(w_) { }
@@ -178,7 +180,7 @@ public:
}
/// @return currently active window
typename std::add_lvalue_reference<WindowT>::type main() {
WindowReference main() {
return w;
}

View File

@@ -264,7 +264,7 @@ void SearchEngine::mouseButtonPressed(MEVENT me)
}
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
/***********************************************************************/

View File

@@ -244,7 +244,7 @@ void SelectedItemsAdder::mouseButtonPressed(MEVENT me)
enterPressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
void SelectedItemsAdder::SetDimensions()

View File

@@ -175,7 +175,7 @@ void SortPlaylistDialog::mouseButtonPressed(MEVENT me)
enterPressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
}

View File

@@ -56,8 +56,8 @@ private:
size_t m_height;
size_t m_width;
const std::remove_pointer<ScreenType>::type::Item::Type m_sort_entry;
const std::remove_pointer<ScreenType>::type::Item::Type m_cancel_entry;
const std::remove_pointer<WindowType>::type::Item::Type m_sort_entry;
const std::remove_pointer<WindowType>::type::Item::Type m_cancel_entry;
};
extern SortPlaylistDialog *mySortPlaylistDialog;

View File

@@ -641,7 +641,7 @@ void TagEditor::mouseButtonPressed(MEVENT me)
enterPressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
}
else if (w == FParser || w == FParserHelper)
@@ -662,7 +662,7 @@ void TagEditor::mouseButtonPressed(MEVENT me)
enterPressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
else if (FParserHelper->hasCoords(me.x, me.y))
{
@@ -689,7 +689,7 @@ void TagEditor::mouseButtonPressed(MEVENT me)
spacePressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
Tags->clear();
}
else if (!TagTypes->empty() && TagTypes->hasCoords(me.x, me.y))
@@ -714,7 +714,7 @@ void TagEditor::mouseButtonPressed(MEVENT me)
enterPressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
else if (!Tags->empty() && Tags->hasCoords(me.x, me.y))
{
@@ -728,7 +728,7 @@ void TagEditor::mouseButtonPressed(MEVENT me)
enterPressed();
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
}

View File

@@ -167,7 +167,7 @@ void TinyTagEditor::mouseButtonPressed(MEVENT me)
}
}
else
Screen<ScreenType>::mouseButtonPressed(me);
Screen<WindowType>::mouseButtonPressed(me);
}
void TinyTagEditor::SetEdited(const MPD::Song &s)