Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions sources/Application/Views/BaseClasses/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

5 changes: 3 additions & 2 deletions sources/Application/Views/BaseClasses/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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_;
Expand Down