OLD | NEW |
| (Empty) |
1 // Copyright 2016 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #include "xfa/fwl/cfwl_sysbtn.h" | |
8 | |
9 #include "xfa/fwl/cfwl_themepart.h" | |
10 | |
11 CFWL_SysBtn::CFWL_SysBtn() { | |
12 m_rtBtn.Set(0, 0, 0, 0); | |
13 m_dwState = 0; | |
14 } | |
15 | |
16 CFWL_SysBtn::~CFWL_SysBtn() {} | |
17 | |
18 bool CFWL_SysBtn::IsDisabled() const { | |
19 return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); | |
20 } | |
21 | |
22 void CFWL_SysBtn::SetNormal() { | |
23 m_dwState &= 0xFFF0; | |
24 } | |
25 | |
26 void CFWL_SysBtn::SetPressed() { | |
27 SetNormal(); | |
28 m_dwState |= FWL_SYSBUTTONSTATE_Pressed; | |
29 } | |
30 | |
31 void CFWL_SysBtn::SetHover() { | |
32 SetNormal(); | |
33 m_dwState |= FWL_SYSBUTTONSTATE_Hover; | |
34 } | |
35 | |
36 void CFWL_SysBtn::SetDisabled(bool bDisabled) { | |
37 bDisabled ? m_dwState |= FWL_SYSBUTTONSTATE_Disabled | |
38 : m_dwState &= ~FWL_SYSBUTTONSTATE_Disabled; | |
39 } | |
40 | |
41 uint32_t CFWL_SysBtn::GetPartState() const { | |
42 if (IsDisabled()) | |
43 return CFWL_PartState_Disabled; | |
44 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) | |
45 return CFWL_PartState_Pressed; | |
46 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) | |
47 return CFWL_PartState_Hovered; | |
48 return CFWL_PartState_Normal; | |
49 } | |
OLD | NEW |