soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SCaption.cpp
Go to the documentation of this file.
1/**
2 * Copyright (C) 2014-2050 SOUI团队
3 * All rights reserved.
4 *
5 * @file SCaption.cpp
6 * @brief 标签控件
7 * @version v1.0
8 * @author soui
9 * @date 2014-05-28
10 *
11 * Describe 此类完成标题栏控件
12 */
13#include "souistd.h"
14#include "control/SCaption.h"
15
16SNSBEGIN
17
19 : m_bIsMaxDown(FALSE)
20{
21 m_bDrawFocusRect = FALSE;
22}
23
25{
26}
27
28void SCaption::OnLButtonUp(UINT nFlags, CPoint point)
29{
30 m_bIsMaxDown = FALSE;
31}
32
33void SCaption::OnMouseMove(UINT nFlags, CPoint point)
34{
35 HWND hHost = GetContainer()->GetHostHwnd();
36 if (WS_MAXIMIZE == (GetWindowLong(hHost, GWL_STYLE) & WS_MAXIMIZE) && m_bIsMaxDown && IsSupportMaxMove())
37 {
38 ::SendMessage(hHost, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, 0);
39
40 m_bIsMaxDown = FALSE;
41
42 return;
43 }
44}
45void SCaption::OnLButtonDown(UINT nFlags, CPoint point)
46{
47 if (IsFocusable())
48 SetFocus();
49 HWND hHost = GetContainer()->GetHostHwnd();
50 if (WS_MAXIMIZE == (GetWindowLong(hHost, GWL_STYLE) & WS_MAXIMIZE))
51 {
52 m_bIsMaxDown = TRUE;
53 return;
54 }
55 ::SendMessage(hHost, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, 0);
56 ::SendMessage(hHost, WM_LBUTTONUP, nFlags, MAKELPARAM(point.x, point.y));
57}
58
59void SCaption::OnLButtonDblClk(UINT nFlags, CPoint point)
60{
61 HWND hHost = GetContainer()->GetHostHwnd();
62
63 if ((GetWindowLong(hHost, GWL_STYLE) & WS_THICKFRAME) && GetWindowLong(hHost, GWL_STYLE) & WS_MAXIMIZEBOX)
64 {
65 if (WS_MAXIMIZE == (GetWindowLong(hHost, GWL_STYLE) & WS_MAXIMIZE))
66 ::SendMessage(hHost, WM_SYSCOMMAND, SC_RESTORE | HTCAPTION, 0);
67 else
68 ::SendMessage(hHost, WM_SYSCOMMAND, SC_MAXIMIZE | HTCAPTION, 0);
69 }
70}
71
72SNSEND
标题栏控件
void OnLButtonUp(UINT nFlags, CPoint point)
处理左键释放事件
Definition SCaption.cpp:28
void OnMouseMove(UINT nFlags, CPoint point)
处理鼠标移动事件
Definition SCaption.cpp:33
void OnLButtonDblClk(UINT nFlags, CPoint point)
处理左键双击事件
Definition SCaption.cpp:59
virtual ~SCaption(void)
析构函数
Definition SCaption.cpp:24
void OnLButtonDown(UINT nFlags, CPoint point)
处理左键按下事件
Definition SCaption.cpp:45
SCaption(void)
构造函数
Definition SCaption.cpp:18
ISwndContainer * GetContainer() OVERRIDE
Retrieves the container associated with this window.
Definition Swnd.cpp:679
BOOL m_bDrawFocusRect
Definition SWnd.h:2610
void SetFocus() OVERRIDE
Sets the focus to the window.
Definition Swnd.cpp:2620
BOOL IsFocusable() SCONST OVERRIDE
Checks if the window is focusable.
Definition Swnd.cpp:1996
HWND GetHostHwnd() PURE
Retrieves the handle to the host window.