Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1044)

Side by Side Diff: xfa/fwl/core/cfwl_sysbtn.cpp

Issue 2506253004: Split fwl/core class pt I. (Closed)
Patch Set: Rebase to master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/core/cfwl_sysbtn.h"
8
9 #include "xfa/fwl/core/cfwl_themepart.h"
10
11 CFWL_SysBtn::CFWL_SysBtn() {
12 m_rtBtn.Set(0, 0, 0, 0);
13 m_dwState = 0;
14 }
15
16 bool CFWL_SysBtn::IsDisabled() const {
17 return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled);
18 }
19
20 void CFWL_SysBtn::SetNormal() {
21 m_dwState &= 0xFFF0;
22 }
23
24 void CFWL_SysBtn::SetPressed() {
25 SetNormal();
26 m_dwState |= FWL_SYSBUTTONSTATE_Pressed;
27 }
28
29 void CFWL_SysBtn::SetHover() {
30 SetNormal();
31 m_dwState |= FWL_SYSBUTTONSTATE_Hover;
32 }
33
34 void CFWL_SysBtn::SetDisabled(bool bDisabled) {
35 bDisabled ? m_dwState |= FWL_SYSBUTTONSTATE_Disabled
36 : m_dwState &= ~FWL_SYSBUTTONSTATE_Disabled;
37 }
38
39 uint32_t CFWL_SysBtn::GetPartState() const {
40 if (IsDisabled())
41 return CFWL_PartState_Disabled;
42 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed)
43 return CFWL_PartState_Pressed;
44 if (m_dwState & FWL_SYSBUTTONSTATE_Hover)
45 return CFWL_PartState_Hovered;
46 return CFWL_PartState_Normal;
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698