Download
(38Kb)
Download
Updated: 03-11-13 06:45 PM
Pictures
File Info
Updated:03-11-13 06:45 PM
Created:07-22-12 05:55 PM
Downloads:2,408
Favorites:20
MD5:

Notifications

Version: 2.0.1
by: Haleth [More]

Introduction

Notifications is an addon that does nothing by itself, but allows other addons to easily show a notification banner at the top of the screen which can display a message + the name of the addon, an icon, play a sound, animate when showing and hiding, and optionally execute a function when clicked. If no icon is provided, the default icon is shown.

If more notifications come in while one is still showing, they will be displayed one by one, so you have time to read and react to each of them.

Additionally, when you are away, these notifications are stored and shown to you as soon as you come back. If you have unread notifications when you log out, they will be shown to you when you log back in.

Usage

Moving the cursor over the banner prevents it from disappearing as long as the cursor is in place. Clicking it will execute the function specified by the addon upon display if present, and dismiss the banner. Right-clicking will only dismiss the banner. To dismiss all incoming banners with one click, hold shift.

Type '/testalert' to show a test notification. '/testalert true' shows a custom icon.

Examples of usage in addons is notifying you of incoming mail, calendar events, whispers while you are afk, UI messages, etc. It all depends on the people implementing it.

Options

There are in-game options for simple settings. These can be accessed through the default AddOns settings panel, or by typing /notifications.

Users can also change all options including appearance at the top of notifications.lua, including appearance and animation behaviour. Explanation is added where necessary.

Developers who include Notifications in their UI can modify it in their code, allowing users to update Notifications without needing to edit the lua code. Read the 'Developer' section below for more info.

Plugins

EventNotifier - alerts you of mail, calendar events and guild events.

Bug reports

Please report all issues at my GitHub.


Developer

Showing a notification is easy. There is only one function used for this:

Lua Code:
  1. Notifications:Alert(message, clickFunc, texture, ...)
  • (string) message: message to display
  • (function) clickFunc (optional): function to execute on click. Set to nil when not using, but still adding a texture.
  • (string) texture (optional): path of a texture to use for the icon. Default icon is shown if omitted.
  • (numbers) ... (optional): arguments passed to SetTexCoord() for the icon; defaults to .08, .92, .08, .92 if omitted.

Your addon's name is passed automatically and does not need to be provided as a parameter.

You can also customize the behaviour and appearance of Notifications when embedded in your UI, so that users can update this addon without having to wait for you to upload a custom version.

Add Notifications as an optional dependency to your addon's ToC, and make sure it is loaded before accessing the options through Notifications.options. After your edits, call Notifications:Update() to apply the new settings.

This example code applies the Tukui style to Notifications if it is loaded.

Code:
## OptionalDeps: Notifications, Tukui
Lua Code:
  1. if Notifications and Tukui then
  2.     -- locally import option table references
  3.     local options = Notifications.options
  4.     local _, C = unpack(Tukui)
  5.  
  6.     local borderR, borderG, borderB = unpack(C.general.bordercolor)
  7.  
  8.     -- set the new values
  9.     options.bgRed, options.bgGreen, options.bgBlue = unpack(C.general.backdropcolor)
  10.     options.bgAlpha = 1
  11.     options.borderRed, options.borderGreen, options.borderBlue = borderR, borderG, borderB
  12.     options.separatorRed, options.separatorGreen, options.separatorBlue = borderR, borderG, borderB
  13.     options.inset = -1
  14.    
  15.     -- call the update function
  16.     Notifications:Update()
  17. end

If your addon supports Notifications, you can PM me or leave a comment and I'll add it to the list of supported addons.

Credits

Sound effect obtained from http://www.freesfx.co.uk

2.0.1

Flagging as compatible with patch 5.2.0.

2.0

Added an in-game options GUI with a few settings. It will be expanded in the future. Includes a command (/notifications) to open.
Added Aurora theme support for this GUI.
Banner now expands on when hovering the cursor over it if the text is truncated.
Unread notifications are now stored on logout and shown on login.
You can now shift-click the banner to dismiss all incoming alerts.

1.0.1

The banner should now appear over all other UI frames apart from tooltips.

1.0

Initial release
Optional Files (0)


Post A Reply Comment Options
Unread 09-15-12, 09:47 PM  
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view AddOns

Forum posts: 583
File comments: 438
Uploads: 22
Originally Posted by Haleth
Ekaterina; Sorry for the slow reply! I'm not getting this error. What other addons do you have enabled?

I'm trying to think of a way to add more flexible options. I might just make the base addon provide the functions needed, and then let people come up with their own small 'layout' addons, a bit like how oUF works.

10leej; In your UI you can use Notifications:SetBackdrop(nil) and then create the border on Notifications.
Ah was wondering was too lazy to dig through the code to see if Notifications would be a valid frame to hit there.
__________________
Tweets YouTube Website
Report comment to moderator  
Reply With Quote
Unread 09-15-12, 03:42 AM  
Haleth
This Space For Rent
 
Haleth's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1173
File comments: 1146
Uploads: 17
Ekaterina; Sorry for the slow reply! I'm not getting this error. What other addons do you have enabled?

I'm trying to think of a way to add more flexible options. I might just make the base addon provide the functions needed, and then let people come up with their own small 'layout' addons, a bit like how oUF works.

10leej; In your UI you can use Notifications:SetBackdrop(nil) and then create the border on Notifications.
Report comment to moderator  
Reply With Quote
Unread 09-06-12, 03:38 PM  
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view AddOns

Forum posts: 583
File comments: 438
Uploads: 22
How would I go about skinning a plugin to match my UI? The function I use for my border is created by an older version of !Beautycase

Code:
frame:CreateBorder(12,1,1,1)
__________________
Tweets YouTube Website
Report comment to moderator  
Reply With Quote
Unread 08-02-12, 11:55 PM  
Ekaterina
A Theradrim Guardian
AddOn Author - Click to view AddOns

Forum posts: 65
File comments: 50
Uploads: 1
Originally Posted by Haleth
New version is here! Check the changelog.
I get the following error when I try to change position:

Code:
 
4x FrameXML\UIDropDownMenu.lua:995: attempt to index local "filterText" (a nil value)
FrameXML\UIDropDownMenu.lua:995: in function "UIDropDownMenu_SetText"
FrameXML\UIDropDownMenu.lua:540: in function "UIDropDownMenu_Refresh"
FrameXML\UIDropDownMenu.lua:638: in function "UIDropDownMenu_SetSelectedID"
Notifications-1.0\gui.lua:216: in function "func"
FrameXML\UIDropDownMenu.lua:706: in function "UIDropDownMenuButton_OnClick"
<string>:"*:OnClick":1: in function <string>:"*:OnClick":1
Locals:
frame = NotificationsOptionsPanelPositionLeft {
 0 = <userdata>
 selectedID = 1
}
useValue = nil
dropdownLevel = 1
button = DropDownList1Button1 {
 0 = <userdata>
 checked = 1
 value = "TOP"
 func = <func> @Notifications\gui.lua:214
}
checked = 1
checkImage = DropDownList1Button1Check {
 0 = <userdata>
}
uncheckImage = DropDownList1Button1UnCheck {
 0 = <userdata>
}
normalText = nil
width = nil
maxWidth = 0
somethingChecked = true
listFrame = DropDownList1 {
 0 = <userdata>
 dropdown = NotificationsOptionsPanelPosition {}
 isCounting = 1
 showTimer = 2
 numButtons = 8
 maxWidth = 107.58148678099
}
(for index) = 1
(for limit) = 12
(for step) = 1
i = 1
icon = nil
Also, would it be possible to add an offset for positioning? For instance, I still want the notifications to appear at the top of my screen, but I need to budge it down because I have a databroker display across the top.

Cheers.
Report comment to moderator  
Reply With Quote
Unread 08-01-12, 09:16 AM  
Haleth
This Space For Rent
 
Haleth's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1173
File comments: 1146
Uploads: 17
New version is here! Check the changelog.
Report comment to moderator  
Reply With Quote
Unread 07-24-12, 05:49 PM  
Haleth
This Space For Rent
 
Haleth's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1173
File comments: 1146
Uploads: 17
It's now possible to donate using either PayPal or Pledgie.

Absolutely not required, I won't bother you with a donation popup every time you click 'Download' either, but any amount would be very appreciated. Goes towards WoW/university costs.

This addon is very new, but I plan on maintaining it! Also helps for my other addons.
Report comment to moderator  
Reply With Quote
Unread 07-24-12, 10:07 AM  
Haleth
This Space For Rent
 
Haleth's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1173
File comments: 1146
Uploads: 17
Working on ingame options, you can see the progress on my GitHub. Supports Aurora/FreeUI styling too.
Report comment to moderator  
Reply With Quote
Unread 07-24-12, 09:54 AM  
Haleth
This Space For Rent
 
Haleth's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1173
File comments: 1146
Uploads: 17
Yes, it is sort of.
Report comment to moderator  
Reply With Quote
Unread 07-24-12, 09:26 AM  
devilArt
A Wyrmkin Dreamwalker
AddOn Author - Click to view AddOns

Forum posts: 51
File comments: 203
Uploads: 2
is this like Growl in the mac system
really love the idea
Report comment to moderator  
Reply With Quote
Unread 07-24-12, 06:37 AM  
Haleth
This Space For Rent
 
Haleth's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1173
File comments: 1146
Uploads: 17
I'll probably add something like this. I might make a small ingame configuration too.
Report comment to moderator  
Reply With Quote
Unread 07-24-12, 05:15 AM  
Ekaterina
A Theradrim Guardian
AddOn Author - Click to view AddOns

Forum posts: 65
File comments: 50
Uploads: 1
I like it, I'm using Notification with Event Notifier. One annoyance for me is that I had to go in and change the position.

I'd suggest adding an option to change the default position of the Notification.

Ekat.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: