void ChatPanel::OnChanOpts(wxCommandEvent& /*unused*/) { CreatePopup(); if ((m_chan_opts_button == NULL) || (m_popup_menu == 0)) return; m_chan_opts_button->PopupMenu(m_popup_menu->GetMenu()); }
void ChatPanel::OnMouseDown( wxMouseEvent& event ) { wxLogDebugFunc( _T( "" ) ); wxTextCoord row; wxTextCoord col; wxTextCtrlHitTestResult ht = m_chatlog_text->HitTest( event.GetPosition(), &col, &row); if ( ht != wxTE_HT_UNKNOWN ) { long pos = m_chatlog_text->XYToPosition( col, row ); m_url_at_pos = FindUrl( pos ); } CreatePopup(); if ( m_popup_menu != 0 ) PopupMenu( m_popup_menu->GetMenu() ); else event.Skip(); }
PEDITOR CreateEditor( POBJECT po ) { PEDITOR pe; pe = (PEDITOR)Allocate( sizeof( EDITOR ) ); MemSet( pe, 0, sizeof( EDITOR ) ); pe->TView = CreateTransform(); pe->hVideo = OpenDisplaySizedAt( 0, -1, -1, -1, -1 ); //InitVideo( "World Editor" ); SetRedrawHandler( pe->hVideo, (void (CPROC*)(uintptr_t,PRENDERER))EditResizeCallback, (uintptr_t)pe ); SetMouseHandler( pe->hVideo, EditMouseCallback, (uintptr_t)pe ); BindEventToKey( pe->hVideo, KEY_PGUP, 0, PageUpKey, (uintptr_t)pe ); BindEventToKey( pe->hVideo, KEY_PGDN, 0, PageDownKey, (uintptr_t)pe ); // SetCloseHandler( pe->hVideo, EditCloseCallback, (uintptr_t)pe ); // menu for this instance.... #ifdef __WINDOWS__ pe->hMenu = CreatePopup(); //CreatePopupMenu(); AppendPopupItem( pe->hMenu, MF_STRING, MNU_ADDPREDEF+0, "Add Square" ); AppendPopupItem( pe->hMenu, MF_STRING, MNU_ADDPREDEF+1, "Add Triangle" ); AppendPopupItem( pe->hMenu, MF_STRING, MNU_ADDLINE, "Add Line" ); #else pe->hMenu = NULL; #endif SetPoint( vToScreen, VectorConst_Z ); // facing into screen... Invert( vToScreen ); // facing out of screen... pe->pCurrent = po; pe->pCurrentFacet = NULL; //po->objinfo.FacetPool.pFacets + 0; pe->pCurrentLine = NULL; //po->objinfo.LinePool.pLines + 0; ClearTransform( pe->TView ); Translate( pe->TView, 0, 0, (RCOORD)-100.0 ); pe->bLocked = FALSE; EditResizeCallback( (uintptr_t)pe); UpdateDisplay( pe->hVideo ); return pe; }
void ChatPanel::CreateControls() { // Creating sizers m_main_sizer = new wxBoxSizer(wxHORIZONTAL); m_chat_sizer = new wxBoxSizer(wxVERTICAL); m_say_sizer = new wxBoxSizer(wxHORIZONTAL); if (m_show_nick_list) { m_splitter = new wxSplitterWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxSP_3D); m_splitter->SetSashGravity(0.9); m_nick_panel = new wxPanel(m_splitter, -1); m_chat_panel = new wxPanel(m_splitter, -1); m_nick_sizer = new wxBoxSizer(wxVERTICAL); m_usercount_label = new wxStaticText(m_nick_panel, wxID_ANY, wxEmptyString); m_showPlayerOnlyCheck = new wxCheckBox(m_nick_panel, SHOW_PLAYERS_ONLY_CHECK, _("Hide bots")); wxBoxSizer* nickListHeaderSizer = new wxBoxSizer(wxVERTICAL); nickListHeaderSizer->Add(m_usercount_label, 0, wxEXPAND); nickListHeaderSizer->Add(m_showPlayerOnlyCheck, 0, wxEXPAND); UpdateUserCountLabel(); CreatePopup(); //ensures m_popup_menu is constructed //SL_GENERIC::UserMenu<ChatPanelMenu>* usermenu = m_popup_menu->GetUserMenu(); m_nicklist = new NickDataViewCtrl(_T("NickDataViewCtrl_ChatPanel"), m_nick_panel, true, m_popup_menu); // m_nick_filter = new wxComboBox( m_nick_panel, -1, _("Show all"), wxDefaultPosition, wxSize(80,CONTROL_HEIGHT), 0, 0, wxCB_READONLY ); // m_nick_filter->Disable(); m_nick_filter = new wxTextCtrl(m_nick_panel, FILTER_USERS); m_nick_sizer->Add(m_nicklist, 1, wxEXPAND); m_nick_sizer->Add(nickListHeaderSizer, 0, wxEXPAND); m_nick_sizer->Add(m_nick_filter, 0, wxEXPAND); // m_nick_sizer->Add( m_nick_filter, 0, wxEXPAND | wxTOP, 2 ); m_nick_panel->SetSizer(m_nick_sizer); m_nicklist->UserFilterShowPlayersOnly(m_ShowPlayersOnlyFlag); m_showPlayerOnlyCheck->SetValue(m_ShowPlayersOnlyFlag); } else { m_chat_panel = this; m_nick_sizer = 0; m_nicklist = 0; m_splitter = 0; m_nick_filter = 0; } // Creating ui elements m_chatlog_text = new wxTextCtrl(m_chat_panel, CHAT_LOG, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_AUTO_URL); m_chan_opts_button = NULL; if (m_type == CPT_Channel) { m_chatlog_text->SetToolTip(_("right click for options (like autojoin)")); } wxBitmap ico; if (m_type == CPT_User && (m_user != NULL)) { ico = IconsCollection::Instance()->GetUserBattleStateBmp(m_user->GetStatus()); } else { ico = IconsCollection::Instance()->BMP_CHANNEL_OPTIONS; } m_chan_opts_button = new wxBitmapButton(m_chat_panel, CHAT_CHAN_OPTS, ico, wxDefaultPosition, wxSize(CONTROL_HEIGHT, CONTROL_HEIGHT)); m_say_text = new wxTextCtrlHist( textcompletiondatabase, m_chat_panel, CHAT_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB); m_say_button = new wxButton(m_chat_panel, CHAT_SEND, _("Send"), wxDefaultPosition, wxSize(80, CONTROL_HEIGHT)); // Adding elements to sizers if (m_chan_opts_button != NULL) m_say_sizer->Add(m_chan_opts_button); m_say_sizer->Add(m_say_text, 1, wxEXPAND); m_say_sizer->Add(m_say_button); m_chat_sizer->Add(m_chatlog_text, 1, wxEXPAND); m_chat_sizer->Add(m_say_sizer, 0, wxEXPAND | wxTOP, 2); if (m_show_nick_list) { m_chat_panel->SetSizer(m_chat_sizer); m_splitter->SplitVertically(m_chat_panel, m_nick_panel, 100); m_splitter->SetMinimumPaneSize(MINIMUM_PANE_SIZE); m_main_sizer->Add(m_splitter, 1, wxEXPAND | wxALL, 2); } else { m_main_sizer->Add(m_chat_sizer, 4, wxEXPAND | wxALL, 2); } // Assign sizer to panel SetSizer(m_main_sizer); if (m_show_nick_list) { wxSize s = m_splitter->GetSize(); m_splitter->SetSashPosition(s.GetWidth() - MINIMUM_PANE_SIZE, true); } m_chatlog_text->ShowPosition(m_chatlog_text->GetLastPosition()); m_chatlog_text->SetBackgroundColour(sett().GetChatColorBackground()); m_say_text->SetBackgroundColour(sett().GetChatColorBackground()); m_say_text->SetForegroundColour(sett().GetChatColorNormal()); // Fill up TextCompletionDatabase textcompletiondatabase.Insert_Mapping(_T("DLDK"), _T("Der Lockruf des Kaos")); textcompletiondatabase.Insert_Mapping(_T("lol"), _T("Laughing out loud")); textcompletiondatabase.Insert_Mapping(_T("wb"), _T("Welcome back")); textcompletiondatabase.Insert_Mapping(_T("hf"), _T("Have Fun!")); textcompletiondatabase.Insert_Mapping(_T("glhf"), _T("Good luck, have Fun!")); textcompletiondatabase.Insert_Mapping(_T("kaot"), _T("Have Fun!")); textcompletiondatabase.Insert_Mapping(_T("kaot_H"), _T("Der Kaot aus der HĂślle.")); }
/* Tê funkcjê wo³a DispatchMessage( ) */ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { int xSize, ySize; LPCTSTR names[2] = {L"Nazwa:", L"Adres:"}; LPCTSTR btnLabels[2] = {L"Akceptuj", L"Anuluj"}; switch(message) { case WM_COMMAND: if(HIWORD(wParam) == BN_CLICKED) { switch(LOWORD(wParam)) { case ID_ACCEPT: CreatePopup(hwnd); break; case ID_CANCEL: PostQuitMessage(0); break; } } break; case WM_SIZE: xSize = LOWORD(lParam); ySize = (HIWORD(lParam) - 20) / 2; MoveWindow(children[0], 0, 0, xSize, ySize, 1); MoveWindow(children[1], 0, ySize, xSize, ySize, 1); for(int i = 24, j = 0; i < 53; i += i + 2, ++j) { MoveWindow(editBoxes[j], 70, i, xSize - 80, 20, 1); } MoveWindow(combobox, 90, 24, xSize - 100, 1000, 1); MoveWindow(buttons[0], 0, ySize * 2, 60, 20, 1); MoveWindow(buttons[1], xSize - 60, ySize * 2, 60, 20, 1); break; case WM_CREATE: children[0] = CreateWindowEx(0, L"BUTTON", L"Uczelnia", WS_CHILD | WS_VISIBLE | BS_GROUPBOX, 0, 0, 0, 0, hwnd, NULL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); for(int i = 25, j = 0; i < 53; i += i + 2, ++j) { CreateWindowEx(0, L"STATIC", names[j], WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, i, 50, 20, children[0], NULL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); editBoxes[j] = CreateWindowEx(0, L"EDIT", L"", WS_CHILD | WS_VISIBLE | WS_BORDER, 70, i - 1, 0, 0, children[0], NULL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); } children[1] = CreateWindowEx(0, L"BUTTON", L"Rodzaj studiow", WS_CHILD | WS_VISIBLE | BS_GROUPBOX, 0, 0, 0, 0, hwnd, NULL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); CreateWindowEx(0, L"STATIC", L"Cykl nauki:", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 25, 80, 20, children[1], NULL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); combobox = CreateWindowEx(0, L"COMBOBOX", L"", WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, 90, 24, 0, 0, children[1], NULL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); SendMessage(combobox, CB_ADDSTRING, 0, (LPARAM)L"3-letnie"); SendMessage(combobox, CB_ADDSTRING, 0, (LPARAM)L"5-letnie"); SendMessage(combobox, CB_SETCURSEL, 0, 0); checkBoxes[0] = CreateWindowEx(0, L"BUTTON", L"dzienne", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 90, 52, 80, 20, children[1], NULL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); checkBoxes[1] = CreateWindowEx(0, L"BUTTON", L"uzupe³niaj¹ce", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 170, 52, 160, 20, children[1], NULL, ((LPCREATESTRUCT)lParam)->hInstance, NULL); for(int i = 0; i < 2; ++i) { buttons[i] = CreateWindowEx(0, L"BUTTON", btnLabels[i], WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 0, 0, 0, 0, hwnd, (HMENU)(i + 100), ((LPCREATESTRUCT)lParam)->hInstance, NULL); } break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, message, wParam, lParam); } return 0; }
void ChatPanel::CreateControls( ) { wxLogDebugFunc( _T( "" ) ); // Creating sizers m_main_sizer = new wxBoxSizer( wxHORIZONTAL ); m_chat_sizer = new wxBoxSizer( wxVERTICAL ); m_say_sizer = new wxBoxSizer( wxHORIZONTAL ); if ( m_show_nick_list ) { m_splitter = new wxSplitterWindow( this, -1, wxDefaultPosition, wxDefaultSize, wxSP_3D ); m_splitter->SetSashGravity( 0.9 ); m_nick_panel = new wxPanel( m_splitter, -1 ); m_chat_panel = new wxPanel( m_splitter, -1 ); m_nick_sizer = new wxBoxSizer( wxVERTICAL ); unsigned int numusers = 0; if ( m_type == CPT_Channel ) numusers = GetChannel()->GetNumUsers(); else if ( m_type == CPT_Server && m_server ) numusers = m_server->GetNumUsers(); m_usercount_label = new wxStaticText( m_nick_panel, wxID_ANY, wxString::Format( _("%d users"), numusers ) ); CreatePopup();//ensures m_popup_menu is constructed //SL_GENERIC::UserMenu<ChatPanelMenu>* usermenu = m_popup_menu->GetUserMenu(); assert ( m_popup_menu->GetUserMenu() ); m_nicklist = new NickListCtrl( m_nick_panel, true, m_popup_menu->GetUserMenu() ); // m_nick_filter = new wxComboBox( m_nick_panel, -1, _("Show all"), wxDefaultPosition, wxSize(80,CONTROL_HEIGHT), 0, 0, wxCB_READONLY ); // m_nick_filter->Disable(); m_nick_sizer->Add( m_usercount_label, 0 ); m_nick_sizer->Add( m_nicklist, 1, wxEXPAND ); // m_nick_sizer->Add( m_nick_filter, 0, wxEXPAND | wxTOP, 2 ); m_nick_panel->SetSizer( m_nick_sizer ); } else { m_chat_panel = this; m_nick_sizer = 0; m_nicklist = 0; m_nick_filter = 0; m_splitter = 0; } // Creating ui elements m_chatlog_text = new wxTextCtrl( m_chat_panel, CHAT_LOG, _T( "" ), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_AUTO_URL ); if ( m_type == CPT_Channel ) { m_chatlog_text->SetToolTip( TE(_("right click for options (like autojoin)" ) ) ); m_chan_opts_button = new wxBitmapButton(m_chat_panel, CHAT_CHAN_OPTS, icons().GetBitmap(icons().ICON_CHANNEL_OPTIONS), wxDefaultPosition , wxSize( CONTROL_HEIGHT, CONTROL_HEIGHT ) ); } else if ( m_type == CPT_User ) { if ( m_user ) { m_chan_opts_button = new wxBitmapButton(m_chat_panel, CHAT_CHAN_OPTS, icons().GetBitmap(icons().GetUserBattleStateIcon(m_user->GetStatus()) ), wxDefaultPosition , wxSize( CONTROL_HEIGHT, CONTROL_HEIGHT ) ); } } else { m_chan_opts_button = 0; } m_say_text = new wxTextCtrlHist( textcompletiondatabase, m_chat_panel, CHAT_TEXT, _T( "" ), wxDefaultPosition, wxSize( 100, CONTROL_HEIGHT ), wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB ); m_say_button = new wxButton( m_chat_panel, CHAT_SEND, _( "Send" ), wxDefaultPosition, wxSize( 80, CONTROL_HEIGHT ) ); // Adding elements to sizers if ( m_type == CPT_Channel ) m_say_sizer->Add( m_chan_opts_button ); if ( m_type == CPT_User ) m_say_sizer->Add( m_chan_opts_button ); m_say_sizer->Add( m_say_text, 1, wxEXPAND ); m_say_sizer->Add( m_say_button ); m_chat_sizer->Add( m_chatlog_text, 1, wxEXPAND ); m_chat_sizer->Add( m_say_sizer, 0, wxEXPAND | wxTOP, 2 ); if ( m_show_nick_list ) { m_chat_panel->SetSizer( m_chat_sizer ); m_splitter->SplitVertically( m_chat_panel, m_nick_panel, 100 ); m_splitter->SetMinimumPaneSize( 30 ); m_main_sizer->Add( m_splitter, 1, wxEXPAND | wxALL, 2 ); } else { m_main_sizer->Add( m_chat_sizer, 4, wxEXPAND | wxALL, 2 ); } // Assign sizer to panel SetSizer( m_main_sizer ); if ( m_show_nick_list ) { wxSize s = m_splitter->GetSize(); m_splitter->SetSashPosition( s.GetWidth() - 238, true ); } m_chatlog_text->SetBackgroundColour( sett().GetChatColorBackground() ); m_chatlog_text->SetFont( sett().GetChatFont() ); m_say_text->SetBackgroundColour( sett().GetChatColorBackground() ); m_say_text->SetFont( sett().GetChatFont() ); m_say_text->SetForegroundColour(sett().GetChatColorNormal()); // Fill up TextCompletionDatabase textcompletiondatabase.Insert_Mapping( _T("DLDK"), _T("Der Lockruf des Kaos") ); textcompletiondatabase.Insert_Mapping( _T("lol"), _T("Laughing out loud") ); textcompletiondatabase.Insert_Mapping( _T("wb"), _T("Welcome back") ); textcompletiondatabase.Insert_Mapping( _T("hf"), _T("Have Fun!") ); textcompletiondatabase.Insert_Mapping( _T("glhf"), _T("Good luck, have Fun!") ); textcompletiondatabase.Insert_Mapping( _T("kaot"), _T("Have Fun!") ); textcompletiondatabase.Insert_Mapping( _T("kaot_H"), _T("Der Kaot aus der HĂślle.") ); }
int main(int argc, char **argv) { int i; programName = argv[0]; /* The -listen option is used to make us a daemon process which listens for incoming connections from servers, rather than actively connecting to a given server. The -tunnel and -via options are useful to create connections tunneled via SSH port forwarding. We must test for the -listen option before invoking any Xt functions - this is because we use forking, and Xt doesn't seem to cope with forking very well. For -listen option, when a successful incoming connection has been accepted, listenForIncomingConnections() returns, setting the listenSpecified flag. */ for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-listen") == 0) { listenForIncomingConnections(&argc, argv, i); break; } if (strcmp(argv[i], "-tunnel") == 0 || strcmp(argv[i], "-via") == 0) { if (!createTunnel(&argc, argv, i)) exit(1); break; } } /* Call the main Xt initialisation function. It parses command-line options, generating appropriate resource specs, and makes a connection to the X display. */ toplevel = XtVaAppInitialize(&appContext, "Vncviewer", cmdLineOptions, numCmdLineOptions, &argc, argv, fallback_resources, XtNborderWidth, 0, NULL); dpy = XtDisplay(toplevel); /* Interpret resource specs and process any remaining command-line arguments (i.e. the VNC server name). If the server name isn't specified on the command line, getArgsAndResources() will pop up a dialog box and wait for one to be entered. */ GetArgsAndResources(argc, argv); /* Unless we accepted an incoming connection, make a TCP connection to the given VNC server */ if (!listenSpecified) { if (!ConnectToRFBServer(vncServerHost, vncServerPort)) exit(1); } /* Initialise the VNC connection, including reading the password */ if (!InitialiseRFBConnection()) exit(1); /* Create the "popup" widget - this won't actually appear on the screen until some user-defined event causes the "ShowPopup" action to be invoked */ CreatePopup(); /* Find the best pixel format and X visual/colormap to use */ SetVisualAndCmap(); /* Create the "desktop" widget, and perform initialisation which needs doing before the widgets are realized */ ToplevelInitBeforeRealization(); DesktopInitBeforeRealization(); /* "Realize" all the widgets, i.e. actually create and map their X windows */ XtRealizeWidget(toplevel); /* Perform initialisation that needs doing after realization, now that the X windows exist */ InitialiseSelection(); ToplevelInitAfterRealization(); DesktopInitAfterRealization(); /* Spawn daemon thread to listen to vmgl libs */ if (appData.glStubPort == 7000) appData.glStubPort += (vncServerPort-5900); daemonStart(desktopWin, (unsigned short) appData.glStubPort, NULL); /* Tell the VNC server which pixel format and encodings we want to use */ SetFormatAndEncodings(); /* Now enter the main loop, processing VNC messages. X events will automatically be processed whenever the VNC connection is idle. */ while (1) { if (!HandleRFBServerMessage()) break; } Cleanup(); return 0; }