-
Notifications
You must be signed in to change notification settings - Fork 31
/
ProfilePicker.ahk
30 lines (27 loc) · 1003 Bytes
/
ProfilePicker.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
; =================================================================== PROFILE PICKER ==========================================================
; A tool for plugins that allows users to pick a profile (eg for a profile switcher plugin). Cannot alter profile tree
class _ProfilePicker extends _ProfileTreeBase {
__New(){
base.__New()
; Initialize resizing system to min size of gui
Gui, % this.hwnd ":Show", % "Hide"
Gui, % this.hwnd ":+Minsize" 120 "x" 110
}
_CurrentCallback := 0
TV_Event(){
if (A_GuiEvent == "DoubleClick"){
this._CurrentCallback.Call(this.LvHandleToProfileId[A_EventInfo])
Gui, % this.hwnd ":Hide"
this._CurrentCallback := 0
}
}
PickProfile(callback, currentprofile){
this._CurrentCallback := callback
CoordMode, Mouse, Screen
MouseGetPos, x, y
this.BuildProfileTree()
this.SelectProfileByID(currentprofile)
Gui, % this.hwnd ":Show", % "x" x - 110 " y" y - 5 " w200 h200", Profile Picker
UCR.MoveWindowToCenterOfGui(this.hwnd)
}
}