-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWarningView.cpp
98 lines (79 loc) · 2.38 KB
/
WarningView.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*******************************************************
* ImageShow©
*
* This is hopefully going to be a realy nice image
* viewer. Not like there are a 100 of them out there
* or anything.
*
* @author YNOP (ynop@acm.org)
* @version beta
* @date Sept 18 1999
*******************************************************/
#include <InterfaceKit.h>
#include <stdio.h>
#include "Globals.h"
#include "WarningView.h"
#include "BugOutDef.h"
extern BugOut db;
/*******************************************************
* Setup the main view. Add in all the niffty components
* we have made and get things rolling
*******************************************************/
WarningView::WarningView(BRect frame,uint32 mode):BView(frame, "", mode, B_WILL_DRAW|B_PULSE_NEEDED){
SetViewColor(B_TRANSPARENT_32_BIT); // go tran so we have control over drawing
count = -1;
db.SendMessage("Warning View Init OK");
warn = false;
}
/*******************************************************
*
*******************************************************/
WarningView::~WarningView(){
}
/*******************************************************
*
*******************************************************/
void WarningView::AllAttached(){
//SetViewColor(Parent()->ViewColor());
}
/*******************************************************
*
*******************************************************/
void WarningView::Pulse(){
if(count==0){
warn = false;
count = -1;
Invalidate();
}else if(count > 0){
count--;
}
}
/*******************************************************
*
*******************************************************/
void WarningView::Draw(BRect){
SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
FillRect(Bounds());
if(warn){
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));//set so string alias right
SetHighColor (150,0,0);
MovePenTo(0,9);
DrawString("No Translator Found");
}else{
// Dont do anything ... just chill out
}
}
/*******************************************************
*
*******************************************************/
void WarningView::MessageReceived(BMessage *msg){
switch(msg->what){
case NULL_IMAGE:
count = 12; // this is how long we display the warning
warn = true;
Invalidate();
break;
default:
BView::MessageReceived(msg);
}
}