コード例 #1
0
/*!
 * Called when user clicks Find from Edit menu, or presses Ctrl-F
 */
void PasswordSafeSearch::Activate(void)
{
  if (!m_toolbar)
    CreateSearchBar();
  else {
    if ( m_toolbar->IsShownOnScreen() ) {
        m_toolbar->FindControl(ID_FIND_EDITBOX)->SetFocus();
    }
    else if (m_toolbar->Show(true)) {
      wxSize srchCtrlSize(m_parentFrame->GetSize().GetWidth()/5, wxDefaultSize.GetHeight());
      m_toolbar->FindControl(ID_FIND_EDITBOX)->SetSize(srchCtrlSize);
      m_parentFrame->GetSizer()->Layout();
    }
    else {
      const wxPoint pt = m_toolbar->GetPosition();
      const wxSize sz = m_toolbar->GetSize();
      wxMessageBox(wxString() << _("Could not re-display searchbar at ") << pt << _(" of size ") << sz
                              << _(" because ") << (m_toolbar->IsShownOnScreen()? _("it's already visible"): _(" of an error")));
    }
  }

  wxCHECK_RET(m_toolbar, wxT("Could not create or retrieve search bar"));

  m_toolbar->FindControl(ID_FIND_EDITBOX)->SetFocus();
  ClearToolbarStatusArea();
}
コード例 #2
0
ファイル: toolbar.c プロジェクト: RPG-7/reactos
BOOL
CreateToolBar(HWND hwnd)
{
    INT NumButtons = sizeof(Buttons) / sizeof(Buttons[0]);
    HIMAGELIST hImageList;

    LoadStringW(hInst, IDS_INSTALL, szInstallBtn, sizeof(szInstallBtn) / sizeof(WCHAR));
    LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, sizeof(szUninstallBtn) / sizeof(WCHAR));
    LoadStringW(hInst, IDS_MODIFY, szModifyBtn, sizeof(szModifyBtn) / sizeof(WCHAR));

    hToolBar = CreateWindowExW(0,
                               TOOLBARCLASSNAMEW,
                               NULL,
                               WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_LIST,
                               0, 0, 0, 0,
                               hwnd,
                               0,
                               hInst,
                               NULL);

    if (!hToolBar)
    {
        /* TODO: Show error message */
        return FALSE;
    }

    SendMessageW(hToolBar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_HIDECLIPPEDBUTTONS);
    SendMessageW(hToolBar, TB_BUTTONSTRUCTSIZE, sizeof(Buttons[0]), 0);

    hImageList = InitImageList();

    if (!hImageList)
    {
        /* TODO: Show error message */
        return FALSE;
    }

    ImageList_Destroy((HIMAGELIST)SendMessageW(hToolBar,
                                               TB_SETIMAGELIST,
                                               0,
                                               (LPARAM)hImageList));

    SendMessageW(hToolBar, TB_ADDBUTTONS, NumButtons, (LPARAM)Buttons);

    CreateSearchBar();

    return TRUE;
}
コード例 #3
0
/**
 * Recreates the search bar with the last state 
 * regarding its visibility on the UI.
 */
void PasswordSafeSearch::ReCreateSearchBar(void)
{
  if (m_toolbar != nullptr) {
    // remember last status of search bar
    bool show = m_toolbar->IsShown();

    // destroy the existing search bar
    wxDELETE(m_toolbar);

    // here a new search bar is going to be created
    // right after creation it appears on the UI
    CreateSearchBar();

    // if the previous searc bar was hidden then
    // hide also the new one
    if (show == false)
      HideSearchToolbar();
  }
}
コード例 #4
0
ファイル: gui.cpp プロジェクト: VonChenPlus/reactos
    BOOL CreateLayout()
    {
        bool b = TRUE;

        m_ClientPanel = new CUiPanel();
        m_ClientPanel->m_VerticalAlignment = UiAlign_Stretch;
        m_ClientPanel->m_HorizontalAlignment = UiAlign_Stretch;

        // Top level
        b = b && CreateStatusBar();
        b = b && CreateToolbar();
        b = b && CreateSearchBar();
        b = b && CreateVSplitter();

        // Inside V Splitter
        b = b && CreateHSplitter();
        b = b && CreateTreeView();

        // Inside H Splitter
        b = b && CreateListView();
        b = b && CreateRichEdit();

        if (b)
        {
            RECT rTop;
            RECT rBottom;

            /* Size status bar */
            m_StatusBar->SendMessage(WM_SIZE, 0, 0);

            /* Size tool bar */
            m_Toolbar->AutoSize();

            ::GetWindowRect(m_Toolbar->m_hWnd, &rTop);
            ::GetWindowRect(m_StatusBar->m_hWnd, &rBottom);

            m_VSplitter->m_Margin.top = rTop.bottom - rTop.top;
            m_VSplitter->m_Margin.bottom = rBottom.bottom-rBottom.top;
        }

        return b;
    }
コード例 #5
0
ファイル: HexEdit.c プロジェクト: rajeshpillai/HexEdit
LRESULT HexEdit_OnNotify(MAINWND *mainWnd, HWND hwnd, UINT idCtrl, NMHDR *hdr)
{
    HWND hwndHV = GetActiveHexView(hwnd);

    if(hdr->hwndFrom == mainWnd->hwndTabView)
    {
        TCITEM tci = { TCIF_PARAM };

        TabCtrl_GetItem(mainWnd->hwndTabView, TabCtrl_GetCurSel(mainWnd->hwndTabView), &tci);

        // has the user clicked a file-tab?
        if(hdr->code == TCN_SELCHANGE)
        {
            HexSetCurFile(hwnd, TabCtrl_GetCurSel(mainWnd->hwndTabView), TRUE);

            OnFileChange(mainWnd);
            return 0;
        }
        else if(hdr->code == TCN_CLOSING)
        {
            // prompt close if
            if(HexFileCloseNotify(hwnd, hwndHV) == IDCANCEL)
                return TRUE;

            return 0;
        }
        else if(hdr->code == TCN_CLOSE)
        {
            // ask user if they want to save changes
            if(HexFileCloseNotify(hwnd, hwndHV) == IDCANCEL)
                return 0;

            //SetCurFile(hwnd, TabCtrl_GetCurSel(mainWnd->hwndTabView));
            //DestroyWindow((HWND)tci.lParam);
            HexCloseFile(mainWnd, TabCtrl_GetCurSel(mainWnd->hwndTabView));
            return 0;
        }
    }

    // double-click in a statusbar pane?
    if(hdr->hwndFrom == mainWnd->hwndStatusBar && hdr->code == NM_DBLCLK)
    {
        NMMOUSE *nmmouse;

        // statusbar is the only window at present which sends double-clicks
        nmmouse = (NMMOUSE *)hdr;

        // toggle the Readonly/Insert/Overwrite mode
        if(nmmouse->dwItemSpec == 4)
        {
            ToggleEditorMode(hwndHV);
            UpdateStatusBarText(mainWnd->hwndStatusBar, hwndHV);
        }

        return 0;
    }

    if(hdr->code == TBN_DROPDOWN)
    {
        if(GetParent(hdr->hwndFrom) == mainWnd->hwndStatusBar)
        {
            StatusBar_DropDownTB(mainWnd, hwndHV, (NMTOOLBAR *)hdr);
        }

        if(hdr->hwndFrom == mainWnd->hwndToolbar)
        {
            HexPasteSpecialDlg2(hwnd);
        }

        return 0;
    }

    /*	if(hdr->code == DWN_ISDOCKABLE)
    	{
    		RECT rc1, rc2;

    		// Get main window "outer" rectangle
    		GetWindowRect(hwnd, &rc1);

    		// Get main window "inner" rectangle
    		GetClientRect(hwnd, &rc2);
    		MapWindowPoints(hwnd, 0, (POINT *)&rc2, 2);
    		InflateRect(&rc2, -2, -2);

    		return DockWnd_GetDockSide(hwnd, (NMDOCKWNDQUERY *)hdr, &rc1, &rc2);
    	}*/

    if(hdr->code == DWN_SAVESETTINGS)
    {
        NMDOCKWNDCREATE *nmdw = (NMDOCKWNDCREATE *)hdr;

        TRACEA("  DWN_SAVESETTINGS: %d\n", nmdw->uId);

        switch(nmdw->hdr.idFrom)
        {
        case DWID_TYPEVIEW:
        case DWID_ALLTYPES:
            SaveTypeView(nmdw->hwndClient, nmdw->hKey);
            break;
        }

        return 0;
    }

    if(hdr->code == DWN_UPDATE_CONTENT)
    {
        NMDOCKWND *nmdw = (NMDOCKWND *)hdr;

        HWND hwndHV = GetActiveHexView(hwnd);

        switch(nmdw->hdr.idFrom)
        {
        case DWID_HIGHLIGHT:
            UpdateHighlights(TRUE);
            break;
        }

        return 0;
    }

    if(hdr->code == DWN_CREATE_CONTENT)
    {
        NMDOCKWNDCREATE *nmdw = (NMDOCKWNDCREATE *)hdr;

        TRACEA("DWN_CREATE_CONTENT: %d\n", hdr->idFrom);

        switch(nmdw->hdr.idFrom)
        {
        case DWID_TOOLBAR:
            mainWnd->hwndToolbar = InitToolbar(hdr->hwndFrom);
            return (LONG)mainWnd->hwndToolbar;

        case DWID_SEARCHBAR:
            return (LONG)CreateSearchBar(hdr->hwndFrom);

        case DWID_ALLTYPES:
            //SendMessage(hwndTB, TB_SETSTATE, IDM_TOOLS_TYPEVIEW, DockWnd_IsOpen(g_hwndMain, DWID_TYPEVIEW) ? TBSTATE_CHECKED|TBSTATE_ENABLED : TBSTATE_ENABLED);
            return (LONG)CreateTypeView(hdr->hwndFrom, nmdw->hKey, TRUE);//TEXT("struct ALL"));

        case DWID_TYPEVIEW:
            //SendMessage(hwndTB, TB_SETSTATE, IDM_TOOLS_TYPEVIEW, DockWnd_IsOpen(g_hwndMain, DWID_TYPEVIEW) ? TBSTATE_CHECKED|TBSTATE_ENABLED : TBSTATE_ENABLED);
            return (LONG)CreateTypeView(hdr->hwndFrom, nmdw->hKey, 0);

        case DWID_HIGHLIGHT:
            return (LONG)CreateHighlightView(hdr->hwndFrom);

        case DWID_STRINGS:
            return (LONG)CreateStringsView(hdr->hwndFrom);
        }
    }
    else if(hdr->code == DWN_DOCKCHANGE)
    {
        NMDOCKWND *nmdw = (NMDOCKWND *)hdr;

        switch(nmdw->hdr.idFrom)
        {
        case DWID_TOOLBAR:
            SendMessage(DockWnd_GetContents(mainWnd->hwndMain, DWID_TOOLBAR),
                        TB_SETPARENT, (WPARAM)hdr->hwndFrom, 0);

            return 0;
        }
    }
    else if(hdr->code == DWN_CLOSING)
    {
        NMDOCKWND *nmdw = (NMDOCKWND *)hdr;

        switch(nmdw->hdr.idFrom)
        {
        case DWID_TYPEVIEW:
            break;
        }
        return 0;
    }

    return DefWindowProc(hwnd, WM_NOTIFY, idCtrl, (LONG)hdr);
}