Example #1
0
void CDialogPackage::CTabInfo::Initialize()
{
    m_Initialized = true;

    HWND item = GetDlgItem(m_Window, IDC_INSTALLTAB_NAME_TEXT);
    Edit_SetCueBannerText(item, L"...");

    item = GetDlgItem(m_Window, IDC_INSTALLTAB_AUTHOR_TEXT);
    Edit_SetCueBannerText(item, L"...");

    item = GetDlgItem(m_Window, IDC_INSTALLTAB_VERSION_TEXT);
    Edit_SetCueBannerText(item, L"...");

    item = GetDlgItem(m_Window, IDC_PACKAGEINFO_COMPONENTS_LIST);

    DWORD extendedFlags = LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT;

    if (GetOSPlatform() >= OSPLATFORM_VISTA)
    {
        extendedFlags |= LVS_EX_DOUBLEBUFFER;
        SetWindowTheme(item, L"explorer", NULL);
    }

    ListView_EnableGroupView(item, TRUE);
    ListView_SetExtendedListViewStyleEx(item, 0, extendedFlags);

    // Add columns
    LVCOLUMN lvc;
    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    lvc.fmt = LVCFMT_LEFT;
    lvc.iSubItem = 0;
    lvc.cx = 252;
    lvc.pszText = L"Name";
    ListView_InsertColumn(item, 0, &lvc);

    // Add groups
    LVGROUP lvg;
    lvg.cbSize = sizeof(LVGROUP);
    lvg.mask = LVGF_HEADER | LVGF_GROUPID | LVGF_STATE;
    lvg.state = (GetOSPlatform() >= OSPLATFORM_VISTA) ? LVGS_COLLAPSIBLE : LVGS_NORMAL;
    lvg.iGroupId = 0;
    lvg.pszHeader = L"Skin";
    ListView_InsertGroup(item, -1, &lvg);
    lvg.iGroupId = 1;
    lvg.pszHeader = L"Layouts";
    ListView_InsertGroup(item, -1, &lvg);
    lvg.iGroupId = 2;
    lvg.pszHeader = L"Plugins";
    ListView_InsertGroup(item, -1, &lvg);
}
VOID PhCreateSearchControl(
    _In_ HWND Parent,
    _In_ HWND WindowHandle,
    _In_opt_ PWSTR BannerText
    )
{
    PEDIT_CONTEXT context;

    context = (PEDIT_CONTEXT)PhAllocate(sizeof(EDIT_CONTEXT));
    memset(context, 0, sizeof(EDIT_CONTEXT));

    context->WindowHandle = WindowHandle;

    //PhpSearchInitializeTheme(context);
    PhpSearchInitializeImages(context);

    // Set initial text
    if (BannerText)
        Edit_SetCueBannerText(context->WindowHandle, BannerText);

    // Subclass the Edit control window procedure.
    SetWindowSubclass(context->WindowHandle, PhpSearchWndSubclassProc, 0, (ULONG_PTR)context);

    // Initialize the theme parameters.
    SendMessage(context->WindowHandle, WM_THEMECHANGED, 0, 0);
}
Example #3
0
HWND CreateSearchControl(
    _In_ UINT CommandID
    )
{
    PEDIT_CONTEXT context;

    context = (PEDIT_CONTEXT)PhAllocate(sizeof(EDIT_CONTEXT));
    memset(context, 0, sizeof(EDIT_CONTEXT));

    context->CommandID = CommandID;

    // Create the SearchBox window.
    context->WindowHandle = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        WC_EDIT,
        NULL,
        WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ES_LEFT | ES_AUTOHSCROLL | WS_VISIBLE,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
        RebarHandle,
        NULL,
        NULL,
        NULL
        );

    // TODO: Why does the Edit control require WS_VISIBLE to be correctly initialized under some conditions?
    //  For now just call ShowWindow with SW_HIDE instead of removing the WS_VISIBLE style passed to CreateWindowEx.
    if (SearchBoxDisplayMode == SEARCHBOX_DISPLAY_MODE_HIDEINACTIVE)
    {
        ShowWindow(SearchboxHandle, SW_HIDE);
    }

    //NcAreaInitializeTheme(context);
    NcAreaInitializeImageList(context);

    // Set initial text
    Edit_SetCueBannerText(context->WindowHandle, L"Search Processes (Ctrl+K)");

    // Set our window context data.
    SetProp(context->WindowHandle, L"EditSubclassContext", (HANDLE)context);

    // Subclass the Edit control window procedure.
    SetWindowSubclass(context->WindowHandle, NcAreaWndSubclassProc, 0, (ULONG_PTR)context);

    // Initialize the theme parameters.
    SendMessage(context->WindowHandle, WM_THEMECHANGED, 0, 0);

    return context->WindowHandle;
}
Example #4
0
HWND
RebarCreateFindEdit(
	__in PREBAR_OBJECT Object	
	)
{
	HWND hWnd;
	HWND hWndRebar;

	hWndRebar = Object->hWndRebar;
	ASSERT(hWndRebar != NULL);

	hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", NULL, 
                          WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_CLIPSIBLINGS | ES_LEFT, 
						  0, 0, 0, 0, hWndRebar, (HMENU)REBAR_BAND_FIND, SdkInstance, NULL);
    ASSERT(hWnd != NULL);
	Edit_SetCueBannerText(hWnd, L"<Search>");
	return hWnd;
}
Example #5
0
HWND CreateSearchControl(
    _In_ UINT CommandID
    )
{
    PEDIT_CONTEXT context;

    context = (PEDIT_CONTEXT)PhAllocate(sizeof(EDIT_CONTEXT));
    memset(context, 0, sizeof(EDIT_CONTEXT));

    context->cxImgSize = 22; // GetSystemMetrics(SM_CXVSCROLL);
    context->CommandID = CommandID;

    // Create the SearchBox window.
    context->WindowHandle = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        WC_EDIT,
        NULL,
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ES_LEFT | ES_AUTOHSCROLL,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
        RebarHandle,
        NULL,
        NULL,
        NULL
        );

    NcAreaInitializeTheme(context);
    NcAreaInitializeImageList(context);

    // Set initial text
    Edit_SetCueBannerText(context->WindowHandle, L"Search Processes (Ctrl+K)");

    // Set our window context data.
    SetProp(context->WindowHandle, L"EditSubclassContext", (HANDLE)context);

    // Subclass the Edit control window procedure.
    SetWindowSubclass(context->WindowHandle, NcAreaWndSubclassProc, 0, (ULONG_PTR)context);

    // Initialize the theme parameters.
    SendMessage(context->WindowHandle, WM_THEMECHANGED, 0, 0);

    return context->WindowHandle;
}
Example #6
0
void CDialogPackage::CTabOptions::Initialize()
{
    m_Initialized = true;

    WCHAR buffer[MAX_PATH];
    SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, buffer);

    c_Dialog->m_TargetFile = buffer;
    c_Dialog->m_TargetFile += L'\\';
    int pos = (int)c_Dialog->m_TargetFile.length() + 1;
    c_Dialog->m_TargetFile += c_Dialog->m_Name;
    c_Dialog->m_TargetFile += L'_';
    c_Dialog->m_TargetFile += c_Dialog->m_Version;

    // Escape reserved chars
    for (int i = pos, isize = (int)c_Dialog->m_TargetFile.length(); i < isize; ++i)
    {
        if (wcschr(L"\\/:*?\"<>|", c_Dialog->m_TargetFile[i]))
        {
            c_Dialog->m_TargetFile[i] = L'_';
        }
    }

    c_Dialog->m_TargetFile += L".rmskin";

    HWND item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_FILE_EDIT);
    SetWindowText(item,c_Dialog->m_TargetFile.c_str());

    item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADTHEME_RADIO);
    if (c_Dialog->m_LayoutFolders.empty())
    {
        EnableWindow(item, FALSE);

        item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_DONOTHING_RADIO);
        Button_SetCheck(item, BST_CHECKED);
    }
    else
    {
        c_Dialog->m_LoadLayout = true;
        c_Dialog->m_Load = (*c_Dialog->m_LayoutFolders.cbegin()).first;

        Button_SetCheck(item, BST_CHECKED);

        item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADTHEME_COMBO);
        ShowWindow(item, SW_SHOWNORMAL);

        for (auto iter = c_Dialog->m_LayoutFolders.cbegin(); iter != c_Dialog->m_LayoutFolders.cend(); ++iter)
        {
            ComboBox_AddString(item, (*iter).first.c_str());
        }
        ComboBox_SetCurSel(item, 0);
    }

    item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_LOADSKIN_EDIT);
    Edit_SetCueBannerText(item, L"Select skin");

    item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_RAINMETERVERSION_EDIT);
    _snwprintf_s(buffer, _TRUNCATE, L"%s.%i", APPVERSION, revision_number);
    SetWindowText(item, buffer);
    c_Dialog->m_MinimumRainmeter = buffer;

    item = GetDlgItem(m_Window, IDC_PACKAGEOPTIONS_WINDOWSVERSION_COMBO);
    ComboBox_AddString(item, L"XP");
    ComboBox_AddString(item, L"Vista");
    ComboBox_AddString(item, L"7");
    ComboBox_SetCurSel(item, 0);
    c_Dialog->m_MinimumWindows = g_OsNameVersions[0].version;
}
Example #7
0
bool SetCueText(EditCtrl *w, const WCHAR *s) {
    CrashIf(!w->hwnd);
    return Edit_SetCueBannerText(w->hwnd, s) == TRUE;
}
Example #8
0
/*!
* \brief blah
*
* blah
*/
void DcxEdit::parseCommandRequest(TString &input) {
	const XSwitchFlags flags(input.gettok(3));
	const int numtok = input.numtok( );

	// xdid -r [NAME] [ID] [SWITCH]
	if (flags['r']) {
		this->m_tsText = "";
		SetWindowTextW(this->m_Hwnd, L"");
	}

	// xdid -a [NAME] [ID] [SWITCH] [TEXT]
	if (flags['a'] && numtok > 3) {
		this->m_tsText += input.gettok(4, -1);
		SetWindowTextW(this->m_Hwnd, this->m_tsText.to_wchr(this->m_bUseUTF8));
	}
	// xdid -c [NAME] [ID] [SWITCH]
	else if (flags['c'] && numtok > 2) {
		CopyToClipboard(this->m_Hwnd, this->m_tsText);
	}
	// xdid -d [NAME] [ID] [SWITCH] [N]
	else if (flags['d'] && numtok > 3) {
		if (this->isStyle(ES_MULTILINE)) {
			const int nLine = input.gettok( 4 ).to_int();
			this->m_tsText.deltok(nLine, "\r\n");
			SetWindowTextW(this->m_Hwnd, this->m_tsText.to_wchr(this->m_bUseUTF8));
		}
	}
	// xdid -i [NAME] [ID] [SWITCH] [N] [TEXT]
	else if (flags['i'] && numtok > 4) {
		if (this->isStyle(ES_MULTILINE)) {
			const int nLine = input.gettok( 4 ).to_int();
			this->m_tsText.instok(input.gettok(5, -1).to_chr(), nLine, "\r\n");
		}
		else
			this->m_tsText = input.gettok(5, -1);
		SetWindowTextW(this->m_Hwnd, this->m_tsText.to_wchr(this->m_bUseUTF8));
	}
	// xdid -j [NAME] [ID] [SWITCH] [0|1]
	else if (flags['j'] && numtok > 3) {
		const unsigned int i = input.gettok( 4 ).to_int();

		if (i > 0) {
			this->addStyle(ES_PASSWORD);
			TCHAR c = Edit_GetPasswordChar(this->m_Hwnd);
			// XP actually uses the unicode `Black Circle` char U+25CF (9679)
			// The problem is getting the char set to a unicode (2-byte) one, so far it always sets to CF (207)
			if (c == 0)
				c = '*'; //(Dcx::XPPlusModule.isUseable()() ? '•' : '*');

			Edit_SetPasswordChar(this->m_Hwnd, c);
			//SendMessage(this->m_Hwnd, CCM_SETUNICODEFORMAT, TRUE, NULL);
			//WCHAR c = (WCHAR)SendMessageW(this->m_Hwnd, EM_GETPASSWORDCHAR, NULL, NULL);
			//if (c == 0)
			//	c = (Dcx::XPPlusModule.isUseable() ? 9679 : L'*');
			//SendMessageW(this->m_Hwnd, EM_SETPASSWORDCHAR, (WPARAM)c, NULL);
		}
		else {
			this->removeStyle(ES_PASSWORD);
			Edit_SetPasswordChar(this->m_Hwnd, 0);
		}

		this->redrawWindow();
	}
   // xdid -l [NAME] [ID] [SWITCH] [ON|OFF]
   else if (flags['l'] && numtok > 3) {
      const BOOL enabled = (input.gettok(4).to_int() > 0 ? TRUE : FALSE);

      SendMessage(this->m_Hwnd, EM_SETREADONLY, enabled, NULL);
   }
	// xdid -o [NAME] [ID] [SWITCH] [N] [TEXT]
	else if (flags['o'] && numtok > 3) {
		if (this->isStyle(ES_MULTILINE)) {
			const int nLine = input.gettok( 4 ).to_int();
			this->m_tsText.puttok(input.gettok(5, -1).to_chr(), nLine, "\r\n");
		}
		else
			this->m_tsText = input.gettok(4, -1);
		SetWindowTextW(this->m_Hwnd, this->m_tsText.to_wchr(this->m_bUseUTF8));
	}
	// xdid -P [NAME] [ID]
	else if (flags['P'] && numtok > 1) {
		SendMessage(this->getHwnd(),WM_PASTE,NULL,NULL);
	}
	// xdid -q [NAME] [ID] [SWITCH] [SIZE]
	else if (flags['q'] && numtok > 3) {
		const int N = input.gettok( 4 ).to_int();

		if (N > -1)
			Edit_LimitText(this->m_Hwnd, N);
	}
	// Used to prevent invalid flag message.
	// xdid -r [NAME] [ID] [SWITCH]
	else if (flags['r']) {
	}
	// xdid -t [NAME] [ID] [SWITCH] [FILENAME]
	else if (flags['t'] && numtok > 3) {
		char *contents = readFile(input.gettok(4, -1).to_chr());

		if (contents != NULL) {
			this->m_tsText = contents;
			SetWindowTextW(this->m_Hwnd, this->m_tsText.to_wchr(this->m_bUseUTF8));
			delete [] contents;
		}
	}
	// xdid -u [NAME] [ID] [SWITCH] [FILENAME]
	else if (flags['u'] && numtok > 3) {
		FILE *file = fopen(input.gettok(4, -1).to_chr(), "wb");

		if (file != NULL) {
			fwrite(this->m_tsText.to_chr(), sizeof(char), this->m_tsText.len(), file);
			fflush(file);
			fclose(file);
		}
	}
	// xdid -S [NAME] [ID] [SWITCH] [START] [END]
	else if (flags['S'] && numtok > 3) {
		const int istart = input.gettok( 4 ).to_int();
		int iend;
		
		if (numtok > 4)
			iend = input.gettok( 5 ).to_int();
		else
			iend = istart;

		SendMessage(this->m_Hwnd, EM_SETSEL, istart, iend);
		SendMessage(this->m_Hwnd, EM_SCROLLCARET, NULL, NULL);
	}
	// xdid -E [NAME] [ID] [SWITCH] [CUE TEXT]
	else if (flags['E'] && numtok > 3) {
		this->m_tsCue = input.gettok(4, -1);
		Edit_SetCueBannerText(this->m_Hwnd,this->m_tsCue.to_wchr(this->m_bUseUTF8));
	}
	// xdid -y [NAME] [ID] [SWITCH] [0|1]
	else if (flags['y'] && numtok > 3) {
		const int state = input.gettok(4).to_int();

		this->m_bIgnoreRepeat = (state > 0 ? TRUE : FALSE);
	}
	else
		this->parseGlobalCommandRequest(input, flags);
}