diff --git a/sources/Application/Views/BaseClasses/View.cpp b/sources/Application/Views/BaseClasses/View.cpp index 625fa1b9..689ae8ef 100644 --- a/sources/Application/Views/BaseClasses/View.cpp +++ b/sources/Application/Views/BaseClasses/View.cpp @@ -243,18 +243,22 @@ void View::EnableNotification() { if ((SDL_GetTicks() - notificationTime_) <= NOTIFICATION_TIMEOUT) { SetColor(CD_NORMAL); GUITextProperties props; - DrawString(10, 2, displayNotification_, props); - } else { + int xOffset = 4; + DrawString(xOffset, notiDistY_, displayNotification_.c_str(), props); + } else { displayNotification_ = ""; } } /* - Set displayed notification and save the current time + Set displayed notification + Saves the current time + Optionally set display y offset if not in a project (default == 2) + Allows negative offsets, use with care! */ -void View::SetNotification(const char *notification) { - notificationTime_ = SDL_GetTicks(); - displayNotification_ = (char*) notification; - isDirty_ = true; +void View::SetNotification(const char *notification, int offset) { + notificationTime_ = SDL_GetTicks(); + displayNotification_ = notification; + notiDistY_ = offset; + isDirty_ = true; } - diff --git a/sources/Application/Views/BaseClasses/View.h b/sources/Application/Views/BaseClasses/View.h index b7fff153..3d0f787f 100644 --- a/sources/Application/Views/BaseClasses/View.h +++ b/sources/Application/Views/BaseClasses/View.h @@ -119,7 +119,7 @@ class View : public Observable { void DoModal(ModalView *view, ModalViewCallback cb = 0); void EnableNotification(); - void SetNotification(const char *notification); + void SetNotification(const char *notification, int offset = 2); protected: virtual void ProcessButtonMask(unsigned short mask, bool pressed) = 0; @@ -161,7 +161,8 @@ class View : public Observable { bool locked_; uint32_t notificationTime_; uint16_t NOTIFICATION_TIMEOUT; - char *displayNotification_; + std::string displayNotification_; + int notiDistY_; static bool initPrivate_; ModalView *modalView_; ModalViewCallback modalViewCallback_;