/[RomCheater]/trunk/deps/WeifenLuo.WinFormsUI.Docking/DockSample/Customization/DockHelper.cs
ViewVC logotype

Annotation of /trunk/deps/WeifenLuo.WinFormsUI.Docking/DockSample/Customization/DockHelper.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 140 - (hide annotations) (download)
Fri May 11 11:29:29 2012 UTC (9 years, 4 months ago) by william
File size: 3762 byte(s)


1 william 140 using System;
2     using System.Drawing;
3     using System.Windows.Forms;
4     using WeifenLuo.WinFormsUI.Docking;
5    
6     namespace DockSample.Customization
7     {
8     internal class DockHelper
9     {
10     public static bool IsDockStateAutoHide(DockState dockState)
11     {
12     if (dockState == DockState.DockLeftAutoHide ||
13     dockState == DockState.DockRightAutoHide ||
14     dockState == DockState.DockTopAutoHide ||
15     dockState == DockState.DockBottomAutoHide)
16     return true;
17     else
18     return false;
19     }
20    
21     public static bool IsDockStateDocked(DockState dockState)
22     {
23     return (dockState == DockState.DockLeft ||
24     dockState == DockState.DockRight ||
25     dockState == DockState.DockTop ||
26     dockState == DockState.DockBottom);
27     }
28    
29     public static bool IsDockBottom(DockState dockState)
30     {
31     return (dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide) ? true : false;
32     }
33    
34     public static bool IsDockLeft(DockState dockState)
35     {
36     return (dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide) ? true : false;
37     }
38    
39     public static bool IsDockRight(DockState dockState)
40     {
41     return (dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide) ? true : false;
42     }
43    
44     public static bool IsDockTop(DockState dockState)
45     {
46     return (dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide ) ? true : false;
47     }
48    
49     public static bool IsDockStateValid(DockState dockState, DockAreas dockableAreas)
50     {
51     if (((dockableAreas & DockAreas.Float) == 0) &&
52     (dockState == DockState.Float))
53     return false;
54     else if (((dockableAreas & DockAreas.Document) == 0) &&
55     (dockState == DockState.Document))
56     return false;
57     else if (((dockableAreas & DockAreas.DockLeft) == 0) &&
58     (dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide))
59     return false;
60     else if (((dockableAreas & DockAreas.DockRight) == 0) &&
61     (dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide))
62     return false;
63     else if (((dockableAreas & DockAreas.DockTop) == 0) &&
64     (dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide))
65     return false;
66     else if (((dockableAreas & DockAreas.DockBottom) == 0) &&
67     (dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide))
68     return false;
69     else
70     return true;
71     }
72    
73     public static bool IsDockWindowState(DockState state)
74     {
75     if (state == DockState.DockTop || state == DockState.DockBottom || state == DockState.DockLeft ||
76     state == DockState.DockRight || state == DockState.Document)
77     return true;
78     else
79     return false;
80     }
81    
82     public static bool IsValidRestoreState(DockState state)
83     {
84     if (state == DockState.DockLeft || state == DockState.DockRight || state == DockState.DockTop ||
85     state == DockState.DockBottom || state == DockState.Document)
86     return true;
87     else
88     return false;
89     }
90    
91     public static DockState ToggleAutoHideState(DockState state)
92     {
93     if (state == DockState.DockLeft)
94     return DockState.DockLeftAutoHide;
95     else if (state == DockState.DockRight)
96     return DockState.DockRightAutoHide;
97     else if (state == DockState.DockTop)
98     return DockState.DockTopAutoHide;
99     else if (state == DockState.DockBottom)
100     return DockState.DockBottomAutoHide;
101     else if (state == DockState.DockLeftAutoHide)
102     return DockState.DockLeft;
103     else if (state == DockState.DockRightAutoHide)
104     return DockState.DockRight;
105     else if (state == DockState.DockTopAutoHide)
106     return DockState.DockTop;
107     else if (state == DockState.DockBottomAutoHide)
108     return DockState.DockBottom;
109     else
110     return state;
111     }
112     }
113     }

  ViewVC Help
Powered by ViewVC 1.1.22