diff options
Diffstat (limited to 'src/cppcheckplus/shortcut/MyShortcutPanel.java')
-rw-r--r-- | src/cppcheckplus/shortcut/MyShortcutPanel.java | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/src/cppcheckplus/shortcut/MyShortcutPanel.java b/src/cppcheckplus/shortcut/MyShortcutPanel.java new file mode 100644 index 0000000..5d97b08 --- /dev/null +++ b/src/cppcheckplus/shortcut/MyShortcutPanel.java | |||
@@ -0,0 +1,114 @@ | |||
1 | |||
2 | package cppcheckplus.shortcut; | ||
3 | |||
4 | import java.awt.BorderLayout; | ||
5 | import java.awt.Component; | ||
6 | import java.awt.Cursor; | ||
7 | import java.awt.Dimension; | ||
8 | import java.awt.Graphics; | ||
9 | import java.awt.Insets; | ||
10 | import javax.swing.JPanel; | ||
11 | import javax.swing.border.Border; | ||
12 | |||
13 | import cppcheckplus.control.MyContorlUtil; | ||
14 | import cppcheckplus.control.MyHeader; | ||
15 | import cppcheckplus.control.MyList; | ||
16 | import cppcheckplus.control.MyListSplitListener; | ||
17 | import cppcheckplus.outlookpanel.MyOutlookList; | ||
18 | import cppcheckplus.outlookpanel.MyOutlookPanelListItem; | ||
19 | |||
20 | public class MyShortcutPanel extends JPanel{ | ||
21 | private MyList list; | ||
22 | private JPanel split; | ||
23 | private MyHeader header; | ||
24 | private MyListSplitListener splitListener; | ||
25 | public MyTree mytree; | ||
26 | public MyShortcutPanel() | ||
27 | { | ||
28 | super(); | ||
29 | //list = new MyList(); | ||
30 | split = new JPanel(new BorderLayout()); | ||
31 | |||
32 | header = new MyHeader() { | ||
33 | |||
34 | public void setShrink(boolean shrinked) | ||
35 | { | ||
36 | super.setShrink(shrinked); | ||
37 | if (shrinked) | ||
38 | split.setCursor(Cursor.getDefaultCursor()); | ||
39 | else | ||
40 | split.setCursor(Cursor.getPredefinedCursor(10)); | ||
41 | } | ||
42 | }; | ||
43 | splitListener = new MyListSplitListener(header); | ||
44 | mytree = new MyTree(); | ||
45 | init(); | ||
46 | } | ||
47 | public void setData(MyShortcutItem[] items,MyShortcutItemClickListenter listenter) | ||
48 | { | ||
49 | //list.setListData(items); | ||
50 | list.setListenter(listenter); | ||
51 | } | ||
52 | private void init() | ||
53 | { | ||
54 | setLayout(new BorderLayout()); | ||
55 | JPanel rightInsetPane = new JPanel(); | ||
56 | rightInsetPane.setPreferredSize(new Dimension(2, 0)); | ||
57 | rightInsetPane.setBackground(MyContorlUtil.LIST_BACKGROUND); | ||
58 | add(rightInsetPane, "East"); | ||
59 | add(header, "North"); | ||
60 | |||
61 | split.setBorder(new Border() { | ||
62 | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) | ||
63 | { | ||
64 | g.setColor(MyContorlUtil.LIST_SPLIT_COLOR); | ||
65 | g.drawLine(x, y, x, y + height); | ||
66 | } | ||
67 | |||
68 | public Insets getBorderInsets(Component c) | ||
69 | { | ||
70 | return new Insets(0, 1, 0, 0); | ||
71 | } | ||
72 | |||
73 | public boolean isBorderOpaque() | ||
74 | { | ||
75 | return true; | ||
76 | } | ||
77 | |||
78 | }); | ||
79 | split.setOpaque(true); | ||
80 | split.setPreferredSize(new Dimension(4, 0)); | ||
81 | split.setBackground(MyContorlUtil.LIST_BACKGROUND); | ||
82 | split.setCursor(Cursor.getPredefinedCursor(10)); | ||
83 | split.addMouseListener(splitListener); | ||
84 | split.addMouseMotionListener(splitListener); | ||
85 | add(split, "West"); | ||
86 | add(mytree, "Center"); | ||
87 | //add(list, "Center"); | ||
88 | } | ||
89 | |||
90 | public MyList getList() | ||
91 | { | ||
92 | return list; | ||
93 | } | ||
94 | |||
95 | public void setTitle(String title) | ||
96 | { | ||
97 | header.setTitle(title); | ||
98 | } | ||
99 | |||
100 | public String getTitle() | ||
101 | { | ||
102 | return header.getTitle(); | ||
103 | } | ||
104 | |||
105 | public void setShrink(boolean shrinked) | ||
106 | { | ||
107 | header.setShrink(shrinked); | ||
108 | } | ||
109 | |||
110 | public boolean isShrinked() | ||
111 | { | ||
112 | return header.isShrinked(); | ||
113 | } | ||
114 | } | ||