summaryrefslogtreecommitdiff
path: root/Editor/GUI/EditorWindows.h
blob: a78e1639f476cb4bf6e0bdb8a556b0aa76083dd4 (plain)
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
#ifndef EDITOR_WINDOW_H
#define EDITOR_WINDOW_H

#include <windows.h>
#include "Runtime/Math/Rect.h"

void RegisterWindowClasses();

// 一个containner window中有多个viewport
class ContainnerWindow
{
public:
    enum ShowMode {
        kShowNormalWindow = 0,	// normal window with max/min/close buttons
        kShowPopupMenu = 1,		// popup menu - no title bar
        kShowUtility = 2,			// tool window - floats in the app, and hides when the app deactivates
        kShowNoShadow = 3,		// no shadow/decorations
        kShowMainWindow = 4,		// main Unity window. On Mac does not have close button; on Windows has menu bar etc.
        kShowAuxWindow = 5,		// Popup windows like the color picker, gradient editor, etc. Drawn with black background on Mac
    };

    ContainnerWindow(); 
    ~ContainnerWindow();

    static LRESULT CALLBACK ContainerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

    void Init(Rectf size, int showMode, const Vector2f& minSize, const Vector2f& maxSize);

private:
	HWND m_Window;
	POINT m_Size;
    ShowMode m_ShowMode; // 窗口类型
    bool  m_IsClosing;
    bool  m_InMenuLoop;
    bool  m_CloseFromScriptDontShutdown;
    Rectf m_InternalRect;
    POINT m_MinSize;
    POINT m_MaxSize;

};


// 窗口内的单个子窗口,是事件相应、绘制、布局的单元
class GUIView
{
public:
    static LRESULT CALLBACK GUIViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

    void DoPaint();

private:
	HWND m_View;

};

#endif