-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDeskNoteView.h
107 lines (83 loc) · 2.53 KB
/
DeskNoteView.h
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* Original copyright 2000 by Colin Stewart (http://www.owlfish.com/).
* All rights reserved.
* Distributed under the terms of the BSD (3-clause) License.
*
* Authors:
* Janus2, 2015
* Humdinger, 2021
*
*/
#ifndef _DESKNOTEVIEW_H
#define _DESKNOTEVIEW_H
#include <Application.h>
#include <InterfaceKit.h>
#include <String.h>
#include "ColorMenuItem.h"
#include "DeskNoteApp.h"
#include "DeskNoteTextView.h"
#define DN_LAUNCH 'dnLN'
#define DN_COLOR 'dnCL'
#define FONT_FAMILY 'fntf'
#define FONT_STYLE 'ftst'
const rgb_color palette[] = {
{ 255, 221, 191, 255 }, // lightest red
{ 255, 187, 128, 255 }, // light red
{ 216, 158, 108, 255 }, // red
{ 179, 83, 0, 255 }, // dark red
{ 255, 244, 191, 255 }, // lightest yellow
{ 255, 233, 128, 255 }, // light yellow
{ 215, 178, 0, 255 }, // yellow
{ 179, 148, 0, 255 }, // dark yellow
{ 216, 255, 180, 255 }, // lightest green
{ 177, 255, 169, 255 }, // light green
{ 72, 187, 61, 255 }, // green
{ 47, 122, 40, 255 }, // dark green
{ 213, 234, 255, 255 }, // lightest blue
{ 170, 213, 255, 255 }, // light blue
{ 67, 131, 196, 255 }, // blue
{ 36, 71, 106, 255 }, // dark blue
{ 244, 244, 244, 255 }, // off white
{ 188, 188, 188, 255 }, // light grey
{ 96, 96, 96, 255 }, // dark grey
{ 11, 11, 11, 255 }, // off black
};
class DeskNoteTextView;
class DeskNoteView : public BView {
public:
DeskNoteView(BRect rect);
DeskNoteView(BMessage* data);
~DeskNoteView();
virtual status_t Archive(BMessage* data, bool deep = true) const;
virtual void Draw(BRect rect);
virtual void MessageReceived(BMessage* msg);
virtual void FrameResized(float width, float height);
virtual void MouseDown(BPoint point);
virtual void SaveNote(BMessage* msg);
virtual void RestoreNote(BMessage* msg);
static BArchivable* Instantiate(BMessage* data);
static int32 ResizeViewMethod(void* data);
static const char defaultText[];
static const char aboutText[];
void SetFontStyle(const char* fontFamily,
const char *fontStyle);
private:
void _BuildColorMenu(BMenu* menu);
void _BuildStyleMenu(BMenu* menu);
void _SetColors();
void _ShowContextMenu(BPoint where);
bool WeAreAReplicant;
DeskNoteTextView* textView;
BRect ourSize;
BMenu* colorMenu;
BMenu* styleMenu;
BMenu* fFontMenu;
BMenuItem* fCurrentFont;
BMessage* orginalSettings;
BPopUpMenu* popupMenu;
rgb_color background;
rgb_color foreground;
rgb_color widgetcolour;
BDragger* dragger;
};
#endif // _DESKNOTEVIEW_H