-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIPListView.cpp
100 lines (84 loc) · 2.7 KB
/
IPListView.cpp
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*******************************************************
* PortSpy©
*
* @author TheAbstractCompany, YNOP([email protected])
* @vertion beta
* @date October 19 1999
*******************************************************/
#include <AppKit.h>
#include <InterfaceKit.h>
#include <stdlib.h>
#include "Globals.h"
#include "IPListView.h"
#include "IPItem.h"
/*******************************************************
*
*******************************************************/
IPListView::IPListView(BRect frame):BListView(frame, "", B_SINGLE_SELECTION_LIST,B_FOLLOW_ALL_SIDES){
SetViewColor(216,216,216,0);
}
/*******************************************************
*
*******************************************************/
IPListView::~IPListView(){
}
/*******************************************************
*
*******************************************************/
void IPListView::MouseDown(BPoint p){
int i;
IPItem *tmpIPItem;
BMessage *currentMsg = Window()->CurrentMessage();
char *ad;
BString tmpS;
if (currentMsg->what == B_MOUSE_DOWN) {
uint32 buttons = 0;
currentMsg->FindInt32("buttons", (int32 *)&buttons);
uint32 modifiers = 0;
currentMsg->FindInt32("modifiers", (int32 *)&modifiers);
if(buttons & B_PRIMARY_MOUSE_BUTTON){ //Foce select on single click
i = IndexOf(p);
if(i >= 0){
Select(i);
}
}
if (buttons & B_SECONDARY_MOUSE_BUTTON) {
i = IndexOf(p);
if(i >= 0){
Select(i);
//Popup a menu with stuff about the IP
BPopUpMenu *menu = new BPopUpMenu("IPMenu");
tmpIPItem = (IPItem*)ItemAt(i);
tmpIPItem->MakeMenu(menu);
BMenuItem *selected = menu->Go(ConvertToScreen(p));
if(selected){
if(selected->Message()){
//Window()->PostMessage(selected->Message()->what);
switch(selected->Message()->what){
case TERM:
break;
case NETP:
tmpS = tmpIPItem->GetHostName();
tmpS.Prepend("http://");
tmpS.Append("/");
ad = (char*)tmpS.String();
be_roster->Launch("application/x-vnd.Be-NPOS",1,&ad);
break;
case FTP:
break;
}
}
}
}
}
}
}
/*******************************************************
*
*******************************************************/
void IPListView::MessageReceived(BMessage *msg){
switch(msg->what){
default:
BListView::MessageReceived(msg);
}
}