예제 #1
0
파일: zrcolafrm.cpp 프로젝트: Amebis/ZRCola
wxZRColaFrame::~wxZRColaFrame()
{
    // Unregister global hotkey(s).
    UnregisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE);
    UnregisterHotKey(wxZRColaHKID_INVOKE_COMPOSE);

#if defined(__WXMSW__)
    if (m_tfSource) {
        m_tfSource->UnadviseSink(m_dwCookie);
        m_tfSource->Release();
    }
#endif

    if (m_chrReq)
        delete m_chrReq;

    if (m_chrSelect)
        delete m_chrSelect;

    if (m_settings)
        delete m_settings;

    if (m_taskBarIcon) {
        m_taskBarIcon->Disconnect(wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEventHandler(wxZRColaFrame::OnTaskbarIconClick), NULL, this);
        delete m_taskBarIcon;
    }
}
예제 #2
0
wxNotificationIconEvtHandler::wxNotificationIconEvtHandler(wxTaskBarIcon *icon)
                            : m_icon(icon)
{
    m_icon->Connect
            (
              wxEVT_TASKBAR_BALLOON_TIMEOUT,
              wxTaskBarIconEventHandler(wxNotificationIconEvtHandler::OnTimeout),
              NULL,
              this
            );

    m_icon->Connect
            (
              wxEVT_TASKBAR_BALLOON_CLICK,
              wxTaskBarIconEventHandler(wxNotificationIconEvtHandler::OnClick),
              NULL,
              this
            );
}
예제 #3
0
파일: taskbar.cpp 프로젝트: gitrider/wxsj2
wxTaskBarIcon::wxTaskBarIcon(const wxTaskBarIconType& nType)
    : m_nType(nType), m_pEventHandlerRef(NULL), m_pMenu(NULL), 
        m_theLastMenu((WXHMENU)GetApplicationDockTileMenu()), m_iconAdded(false) 
{
    //Register the events that will return the dock menu
    EventTypeSpec tbEventList[] = { { kEventClassCommand, kEventProcessCommand },
                                    { kEventClassApplication, kEventAppGetDockTileMenu } };
    
#ifdef __WXDEBUG__
    OSStatus err =
#endif
    InstallApplicationEventHandler(
            GetwxDockEventHandlerUPP(),
            GetEventTypeCount(tbEventList), tbEventList, 
            this, (&(EventHandlerRef&)m_pEventHandlerRef));
            
    wxASSERT(err == noErr);
    
    Connect(wxEVT_TASKBAR_RIGHT_DOWN, wxTaskBarIconEventHandler(wxTaskBarIcon::OnRightDown));
}
예제 #4
0
MainFrame::TaskBarIcon::TaskBarIcon(MainFrame *Main): Main(Main), CurrentEvent(NULL) {
	Connect(wxEVT_TASKBAR_LEFT_DCLICK, wxTaskBarIconEventHandler(MainFrame::TaskBarIcon::IconDClick));
	Connect(TASKBAR_RESTORE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::TaskBarIcon::RestoreClicked));
	Connect(TASKBAR_NEW, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::TaskBarIcon::NewClicked));
	Connect(TASKBAR_QUIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::TaskBarIcon::QuitClicked));
}
예제 #5
0
파일: zrcolafrm.cpp 프로젝트: Amebis/ZRCola
wxZRColaFrame::wxZRColaFrame() :
    m_hWndSource(NULL),
    m_chrSelect(NULL),
    m_settings(NULL),
    m_chrReq(NULL),
    wxZRColaFrameBase(NULL)
{
    {
        // wxFrameBuilder 3.5 does not support wxAUI_TB_HORIZONTAL flag. Add it manually.
        wxAuiPaneInfo &paneInfo = m_mgr.GetPane(m_toolbarCompose);
        paneInfo.LeftDockable(false);
        paneInfo.RightDockable(false);
        m_toolbarCompose->SetWindowStyleFlag(m_toolbarCompose->GetWindowStyleFlag() | wxAUI_TB_HORIZONTAL);
    }

    // Load main window icons.
#ifdef __WINDOWS__
    wxIcon icon_small(wxT("00_zrcola.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
    wxIconBundle icons;
    icons.AddIcon(icon_small);
    icons.AddIcon(wxIcon(wxT("00_zrcola.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON  ), ::GetSystemMetrics(SM_CYICON  )));
    SetIcons(icons);
#else
    wxIcon icon_small(wxICON(00_zrcola.ico));
    SetIcon(icon_small);
#endif

    m_taskBarIcon = new wxTaskBarIcon();
    if (m_taskBarIcon->IsOk()) {
        m_taskBarIcon->SetIcon(icon_small, _("ZRCola"));
        m_taskBarIcon->Connect(wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEventHandler(wxZRColaFrame::OnTaskbarIconClick), NULL, this);
    } else {
        // Taskbar icon creation failed. Not the end of the world. No taskbar icon then.
        delete m_taskBarIcon;
    }

    m_settings = new wxZRColaSettings(this);
    wxPersistentRegisterAndRestore<wxZRColaSettings>(m_settings);

    m_chrSelect = new wxZRColaCharSelect(this);
    wxPersistentRegisterAndRestore<wxZRColaCharSelect>(m_chrSelect);

    m_chrReq = new wxZRColaCharRequest(this);
    wxPersistentRegisterAndRestore<wxZRColaCharRequest>(m_chrReq);

    // Set focus.
    m_panel->m_decomposed->SetFocus();

#if defined(__WXMSW__)
    // Register notification sink for language detection.
    m_ulRefCount = 1;
    m_tfSource = NULL;
    ITfInputProcessorProfiles *pProfiles;
    HRESULT hr = CoCreateInstance(CLSID_TF_InputProcessorProfiles, NULL, CLSCTX_INPROC_SERVER, IID_ITfInputProcessorProfiles, (LPVOID*)&pProfiles);
    if(SUCCEEDED(hr)) {
        hr = pProfiles->QueryInterface(IID_ITfSource, (LPVOID*)&m_tfSource);
        if(SUCCEEDED(hr)) {
            hr = m_tfSource->AdviseSink(IID_ITfLanguageProfileNotifySink, (ITfLanguageProfileNotifySink*)this, &m_dwCookie);
            if (FAILED(hr) || m_dwCookie == -1) {
                m_tfSource->Release();
                m_tfSource = NULL;
            }
        }

        pProfiles->Release();
    }
#endif

    // Register frame specific hotkey(s).
    {
        wxAcceleratorEntry entries[1];
        entries[0].Set(wxACCEL_NORMAL, WXK_F4, wxID_FOCUS_CHARACTER_CATALOG);
        SetAcceleratorTable(wxAcceleratorTable(_countof(entries), entries));
    }

    // Restore persistent state of wxAuiManager manually, since m_mgr is not on the heap.
    wxPersistentAuiManager(&m_mgr).Restore();

    // Register global hotkey(s).
    if (!RegisterHotKey(wxZRColaHKID_INVOKE_COMPOSE, wxMOD_WIN, VK_F5))
        wxMessageBox(_("ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
    if (!RegisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE, wxMOD_WIN, VK_F6))
        wxMessageBox(_("ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
}
예제 #6
0
SigUIFrame::SigUIFrame(wxFrame *frame)
    : GUIFrame(frame), val_bytecode(true), watcher(0)
{
    #ifdef _WIN32
    SetIcon(wxIcon(wxT("aaaa")));
    #endif

    icon = new wxTaskBarIcon();
    icon->Connect(wxEVT_TASKBAR_BALLOON_TIMEOUT, wxTaskBarIconEventHandler(SigUIFrame::OnBalloon), NULL, this);
    icon->Connect(wxEVT_TASKBAR_BALLOON_CLICK, wxTaskBarIconEventHandler(SigUIFrame::OnBalloon), NULL, this);

    this->Connect(wxEVT_FSWATCHER, wxFileSystemWatcherEventHandler(SigUIFrame::OnChange));

    this->Connect(wxEVT_END_PROCESS, wxProcessEventHandler(SigUIFrame::OnTerminateInstall));

    this->SetStatusBar(statusBar);
    statusBar->SetStatusText(REPO_VERSION, 1);

//    m_sig_files->SetDropTarget(new DropFiles(m_sig_files));
//    m_urls->SetDropTarget(new DropURLs(m_urls));


    editor = new ConfigEditor(GetConfigFile());
    editor->RegisterText("HTTPProxyServer", &val_proxy_server, m_proxy_server, "hostname or IP address");
    editor->RegisterInt("HTTPProxyPort", &val_proxy_port, m_proxy_port);
    editor->RegisterText("HTTPProxyUsername", &val_proxy_username, m_proxy_user);
    editor->RegisterText("HTTPProxyPassword", &val_proxy_password, m_proxy_password);
    editor->RegisterText("DatabaseMirror", &val_mirror, m_mirror, "db.COUNTRYCODE.clamav.net");
    editor->RegisterStatic("DatabaseMirror", "db.local.win.clamav.net");
    editor->RegisterBool("Bytecode", &val_bytecode, m_bytecode);
    editor->RegisterList("DatabaseCustomURL", m_urls);

    HostnameValidator mirrorValidator(&val_mirror);
    m_mirror->SetValidator(mirrorValidator);

    HostnameValidator proxyValidator(&val_proxy_server);
    m_proxy_server->SetValidator(proxyValidator);

    editor->Load();
    if (!val_proxy_port)
        val_proxy_port = 8080;//default

    TransferDataToWindow();

    if (!val_proxy_server.empty()) {
	m_proxy->SetValue(true);
	if (!val_proxy_username.empty() && !val_proxy_password.empty())
	    m_proxyauth->SetValue(true);
    }

    // update enabled status
    wxCommandEvent event;
    m_proxyOnCheckBox(event);

    if (!m_urls->IsEmpty())
	m_custom_remove->Enable();

	m_proxy->SetFocus();

    // keyboard shortcuts
    wxAcceleratorEntry entries[1];
    entries[0].Set(wxACCEL_CTRL, (int)'S', wxID_SAVE);

    wxAcceleratorTable accel(sizeof(entries)/sizeof(entries[0]), entries);
    this->SetAcceleratorTable(accel);

    //prevent window from being resizing below minimum
    this->GetSizer()->SetSizeHints(this);
    show_db(true);
}