-
-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathTaskBar.js
More file actions
78 lines (64 loc) · 2.27 KB
/
TaskBar.js
File metadata and controls
78 lines (64 loc) · 2.27 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Project Name : Visual Python
* Description : GUI-based Python code generator
* File Name : TaskBar.js
* Author : Black Logic
* Note : Render and load task bar
* License : GNU GPLv3 with Visual Python special exception
* Date : 2021. 09. 13
* Change Date :
*/
//============================================================================
// [CLASS] TaskBar
//============================================================================
define([
'../com/com_String',
'../com/component/Component',
'./TaskItem'
], function(com_String, Component, TaskItem) {
'use strict';
//========================================================================
// Declare class
//========================================================================
/**
* TaskBar
*/
class TaskBar extends Component{
_init() {
this._taskList = [];
}
_bindEvent() {
let that = this;
// Mousewheel horizontal scrolling event
$(this.wrapSelector()).on('mousewheel', function(evt) {
evt = window.event || evt;
var delta = Math.max(-1, Math.min(1, (evt.wheelDelta || -evt.detail)));
this.scrollLeft -= (delta * 30); // scroll speed : 30
evt.preventDefault();
});
}
template() {
return '<div class="vp-menu-task-bar vp-scrollbar-horizontal"></div>';
}
render() {
super.render(true);
let taskList = this.state.taskList;
taskList && taskList.forEach(task => {
let taskItem = new TaskItem($(this.wrapSelector()), { task: task });
});
}
//====================================================================
// Handling task list
//====================================================================
get taskList() {
return this._taskList;
}
addTaskBlock(popup) {
// create TaskItem and add it
let taskItem = new TaskItem($(this.wrapSelector()), { popup: popup });
this.taskList.push(taskItem);
}
}
return TaskBar;
});
/* End of file */