screen: change ScreenType to WindowType and add WindowReference typedef
This commit is contained in:
@@ -253,7 +253,7 @@ void Browser::mouseButtonPressed(MEVENT me)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ void MediaLibrary::mouseButtonPressed(MEVENT me)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
Albums.clear();
|
Albums.clear();
|
||||||
Songs.clear();
|
Songs.clear();
|
||||||
}
|
}
|
||||||
@@ -472,7 +472,7 @@ void MediaLibrary::mouseButtonPressed(MEVENT me)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
Songs.clear();
|
Songs.clear();
|
||||||
}
|
}
|
||||||
else if (!Songs.empty() && Songs.hasCoords(me.x, me.y))
|
else if (!Songs.empty() && Songs.hasCoords(me.x, me.y))
|
||||||
@@ -493,7 +493,7 @@ void MediaLibrary::mouseButtonPressed(MEVENT me)
|
|||||||
enterPressed();
|
enterPressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ void Outputs::mouseButtonPressed(MEVENT me)
|
|||||||
enterPressed();
|
enterPressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Outputs::FetchList()
|
void Outputs::FetchList()
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ void Playlist::mouseButtonPressed(MEVENT me)
|
|||||||
enterPressed();
|
enterPressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ void PlaylistEditor::mouseButtonPressed(MEVENT me)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
Content->clear();
|
Content->clear();
|
||||||
}
|
}
|
||||||
else if (!Content->empty() && Content->hasCoords(me.x, me.y))
|
else if (!Content->empty() && Content->hasCoords(me.x, me.y))
|
||||||
@@ -321,7 +321,7 @@ void PlaylistEditor::mouseButtonPressed(MEVENT me)
|
|||||||
enterPressed();
|
enterPressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
src/screen.h
14
src/screen.h
@@ -115,14 +115,18 @@ bool isVisible(BasicScreen *screen);
|
|||||||
/// for the screen to be working properly and assumes that we didn't forget
|
/// for the screen to be working properly and assumes that we didn't forget
|
||||||
/// about anything vital.
|
/// 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 <bool IsPointer, typename Result> struct access { };
|
||||||
template <typename Result> struct access<true, Result> {
|
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> {
|
template <typename Result> struct access<false, Result> {
|
||||||
static Result apply(WindowT &w) { return w; }
|
static Result apply(WindowReference w) { return w; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef access<
|
typedef access<
|
||||||
@@ -133,8 +137,6 @@ template <typename WindowT> class Screen : public BasicScreen
|
|||||||
> accessor;
|
> accessor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef WindowT ScreenType;
|
|
||||||
|
|
||||||
Screen() { }
|
Screen() { }
|
||||||
Screen(WindowT w_) : w(w_) { }
|
Screen(WindowT w_) : w(w_) { }
|
||||||
|
|
||||||
@@ -178,7 +180,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @return currently active window
|
/// @return currently active window
|
||||||
typename std::add_lvalue_reference<WindowT>::type main() {
|
WindowReference main() {
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ void SearchEngine::mouseButtonPressed(MEVENT me)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ void SelectedItemsAdder::mouseButtonPressed(MEVENT me)
|
|||||||
enterPressed();
|
enterPressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectedItemsAdder::SetDimensions()
|
void SelectedItemsAdder::SetDimensions()
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ void SortPlaylistDialog::mouseButtonPressed(MEVENT me)
|
|||||||
enterPressed();
|
enterPressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ private:
|
|||||||
size_t m_height;
|
size_t m_height;
|
||||||
size_t m_width;
|
size_t m_width;
|
||||||
|
|
||||||
const std::remove_pointer<ScreenType>::type::Item::Type m_sort_entry;
|
const std::remove_pointer<WindowType>::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_cancel_entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SortPlaylistDialog *mySortPlaylistDialog;
|
extern SortPlaylistDialog *mySortPlaylistDialog;
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ void TagEditor::mouseButtonPressed(MEVENT me)
|
|||||||
enterPressed();
|
enterPressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (w == FParser || w == FParserHelper)
|
else if (w == FParser || w == FParserHelper)
|
||||||
@@ -662,7 +662,7 @@ void TagEditor::mouseButtonPressed(MEVENT me)
|
|||||||
enterPressed();
|
enterPressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
else if (FParserHelper->hasCoords(me.x, me.y))
|
else if (FParserHelper->hasCoords(me.x, me.y))
|
||||||
{
|
{
|
||||||
@@ -689,7 +689,7 @@ void TagEditor::mouseButtonPressed(MEVENT me)
|
|||||||
spacePressed();
|
spacePressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
Tags->clear();
|
Tags->clear();
|
||||||
}
|
}
|
||||||
else if (!TagTypes->empty() && TagTypes->hasCoords(me.x, me.y))
|
else if (!TagTypes->empty() && TagTypes->hasCoords(me.x, me.y))
|
||||||
@@ -714,7 +714,7 @@ void TagEditor::mouseButtonPressed(MEVENT me)
|
|||||||
enterPressed();
|
enterPressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
else if (!Tags->empty() && Tags->hasCoords(me.x, me.y))
|
else if (!Tags->empty() && Tags->hasCoords(me.x, me.y))
|
||||||
{
|
{
|
||||||
@@ -728,7 +728,7 @@ void TagEditor::mouseButtonPressed(MEVENT me)
|
|||||||
enterPressed();
|
enterPressed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ void TinyTagEditor::mouseButtonPressed(MEVENT me)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Screen<ScreenType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyTagEditor::SetEdited(const MPD::Song &s)
|
void TinyTagEditor::SetEdited(const MPD::Song &s)
|
||||||
|
|||||||
Reference in New Issue
Block a user