-
Notifications
You must be signed in to change notification settings - Fork 0
/
Common.h
59 lines (52 loc) · 2.26 KB
/
Common.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
#pragma once
#include <Windows.h>
//-------------------------------------------------------------------------------------------------------------------
//This file declares functions and definitions that are specific to this application and are directly dependent to it
//-------------------------------------------------------------------------------------------------------------------
struct CUSTOM_FRAME { // Defines the sizes for the custom window frame
int caption_height;
int left_border;
int right_border;
int bottom_border;
HBRUSH caption_bk_brush;
COLORREF caption_text_color; //TODO(fran): color information should be sent straight to paint caption since each window could have slightly different caption colors depending on its state
HFONT caption_font;
int logo_icon;
};
/// <summary>
/// Struct object that everyone can use to define and know about the frame for any window, since it MUST the same for everyone
/// </summary>
extern CUSTOM_FRAME FRAME; //defined in Main.cpp
/// <summary>
/// Contains all the windows needed for the program
/// </summary>
struct _KNOWN_WINDOWS {//TODO(fran): look for a better solution
HWND veil;
HWND mgr;
HWND settings;
};
extern _KNOWN_WINDOWS KNOWN_WINDOWS; //defined in Main.cpp
/// <summary>
/// Use instead of GetClientRect. Can and probably will return left and top values that are non zero since now we draw our own custom frame and the whole window rect is ours
/// </summary>
BOOL GetMyClientRect(HWND hwnd, const CUSTOM_FRAME& frame, RECT* rc);
/// <summary>
/// Creates the application wide font in the desired height
/// </summary>
/// <param name="height">Must be a negative value, eg 10 -> -10</param>
/// <returns>The new font or NULL if failed</returns>
HFONT CreateMyFont(LONG height);
/// <summary>
/// Paints the title area of a window (its caption area)
/// </summary>
/// <param name="hWnd"></param>
/// <returns></returns>
LRESULT PaintCaption(HWND hWnd, CUSTOM_FRAME frame);
/// <summary>
/// Hit test the window frame for resizing and moving.
/// </summary>
/// <param name="hWnd"></param>
/// <param name="wParam"></param>
/// <param name="lParam"></param>
/// <returns></returns>
LRESULT HitTestNCA(HWND hWnd, WPARAM wParam, LPARAM lParam,CUSTOM_FRAME frame);