- Timestamp:
- Oct 18, 2008, 5:50:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/CheckBox.ab
r642 r644 1 #require <Classes/ActiveBasic/Windows/UI/ Control.ab>1 #require <Classes/ActiveBasic/Windows/UI/ButtonBase.ab> 2 2 3 3 Namespace ActiveBasic 4 4 Namespace Windows 5 5 Namespace UI 6 7 Enum CheckState 8 Unchecked = BST_UNCHECKED 9 Checked = BST_CHECKED 10 Indeterminate = BST_INDETERMINATE 11 End Enum 6 12 7 13 /*! … … 36 42 37 43 /*! 44 @brief チェック状態の取得 45 */ 46 Const Function State() As CheckState 47 Dim ret = SendMessage(BM_GETCHECK) 48 /* 49 If ret = BST_UNCHECKED Or ret = BST_CHECKED Or ret = BST_INDETERMINATE Then 50 State = ret As CheckState 51 */ 52 If ret = BST_CHECKED Then 53 State = CheckState.Checked 54 ElseIf ret = BST_INDETERMINATE Then 55 State = CheckState.Indeterminate 56 Else 57 State = CheckState.Unchecked 58 End If 59 End Function 60 61 /*! 62 @brief チェック状態の設定 63 */ 64 Sub State(state As CheckState) 65 SendMessage(BM_SETCHECK, state As WPARAM, 0) 66 End Sub 67 68 /*! 38 69 @brief クリック時に自動で状態変化するかどうかの取得。 39 70 @retval true 自動変化する … … 41 72 */ 42 73 Function AutoCheck() As Boolean 43 AutoCheck = ((Style And BS_AUTOCHECKBOX) = BS_AUTOCHECKBOX)74 AutoCheck = autoCheck(Style) 44 75 End Function 45 76 … … 55 86 End If 56 87 End Sub 88 89 /*! 90 @brief 3状態目を使用するどうかの設定。 91 @param[in] useThreeState 3状態目を使用するならTrue、そうでないならFalse。 92 */ 93 Sub ThreeState(useThreeState As Boolean) 94 Dim oldStyle = This.Style 95 Dim style = oldStyle And (Not 7) 96 Dim buttonType = oldStyle And 7 97 If useThreeState = threeState(buttonType) Then 98 Exit Sub 99 End If 100 If useThreeState Then 101 If buttonType = BS_AUTOCHECKBOX Then 102 style Or= BS_AUTO3STATE 103 Else 104 style Or= BS_3STATE 105 End If 106 Else 107 If buttonType = BS_AUTO3STATE Then 108 style Or= BS_AUTOCHECKBOX 109 Else 110 style Or= BS_CHECKBOX 111 End If 112 End If 113 Style = style 114 End Sub 115 116 /*! 117 @brief 3状態目を使用しているかどうかの取得。 118 */ 119 Function ThreeState() As Boolean 120 ThreeState = threeState(Style) 121 End Function 122 Private 123 Static Function threeState(style As DWord) As Boolean 124 style And= 7 125 Return style = BS_3STATE Or style = BS_AUTO3STATE 126 End Function 127 128 Static Function autoCheck(style As DWord) As Boolean 129 style And= 7 130 Return (style = BS_AUTOCHECKBOX Or style = BS_AUTO3STATE) 131 End Function 57 132 End Class 58 133
Note:
See TracChangeset
for help on using the changeset viewer.