コード例 #1
0
ファイル: Mutex.cpp プロジェクト: AshuDassanRepo/bcit-courses
BOOL Mutex_OnCreate (HWND hwnd, LPCREATESTRUCT lpCreateStruct)
{
	 CreateWindow ("listbox", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
   						12, 50, 200, 180, hwnd, HMENU(ID_LISTBOX1),
                     hInstance, NULL);

    CreateWindow ("listbox", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
   						215, 50, 200, 180, hwnd, HMENU(ID_LISTBOX2),
                     hInstance, NULL);

    hMutex = CreateMutex (NULL, FALSE, NULL);
    CritSects = FALSE;
    return TRUE;
}
コード例 #2
0
ファイル: app.cpp プロジェクト: mitchdowd/native
			MenuBar(Component* component) : Menu(new MenuAdapter(::CreateMenu())), _component(component)
			{
				if (component != App::getInstance())
					throw UserInterfaceException("Only the App component can currently have a MenuBar.");

				::SetMenu(HWND(component->getAdapter()->getHandle()), HMENU(getAdapter()->getHandle()));
			}
コード例 #3
0
LRESULT example_window::on_message(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)
{

	switch (msg)
	{
	case WM_CREATE:
	{
		RECT rc;
		GetClientRect(wnd, &rc);

		/** Create a static window, with text "Example" */
		wnd_static = CreateWindowEx(0, WC_STATIC, _T("Example panel"),
			WS_CHILD | WS_VISIBLE, 0, 0, rc.right, rc.bottom,
			wnd, HMENU(0), core_api::get_my_instance(), NULL);
	}
		break;
	case WM_SIZE:
		/** Apparently, the static control sucks */
		RedrawWindow(wnd_static, 0, 0, RDW_INVALIDATE | RDW_ERASE);
		/** Reposition our child window */
		SetWindowPos(wnd_static, 0, 0, 0, LOWORD(lp), HIWORD(lp), SWP_NOZORDER);
		break;
	case WM_DESTROY:
		/** DefWindowProc will destroy our child window. Set our window handle to NULL now. */
		wnd_static = NULL;
		break;
	}
	return DefWindowProc(wnd, msg, wp, lp);
}
コード例 #4
0
ファイル: twl_menu.cpp プロジェクト: Digman/scite-for-php
void Menu::add_menu(Menu& menu)
{
 char *name = ((Popup&)menu).name();
 AppendMenu(HMENU(m_handle),MF_STRING | MF_POPUP,(int)menu.m_handle,name);
 m_menu_handler->add_handler(menu.m_menu_handler);
 m_accel_list->splice(m_accel_list->end(),*menu.m_accel_list); 
}
コード例 #5
0
ファイル: MetroWindow.cpp プロジェクト: codepongo/iBurnMgr
LRESULT MetroWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled)
{
	HICON hIcon = LoadIcon(_Module.m_hInst, MAKEINTRESOURCE(IDI_ICON_IBURN));
	SetIcon(hIcon,FALSE);
	ModifyStyle(WS_CAPTION, 0, SWP_FRAMECHANGED);
	::SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_DRAWFRAME);
	::SetWindowLongPtr(m_hWnd, GWL_EXSTYLE, ::GetWindowLongPtr(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
	SetLayeredWindowAttributes(m_hWnd, 0, 255, LWA_ALPHA/*LWA_COLORKEY*/);
	ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);
	ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD);
	ChangeWindowMessageFilter(0x0049, MSGFLT_ADD);
	HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
	LOGFONT logFont = { 0 };
	GetObject(hFont, sizeof(logFont), &logFont);
	DeleteObject(hFont);
	hFont = NULL;
    logFont.lfHeight = 19;
	logFont.lfWeight = FW_NORMAL;
	wcscpy_s(logFont.lfFaceName, L"Segoe UI");
	hFont = CreateFontIndirect(&logFont);

	InitCommonControls();
	//HWND hCob;
	//HWND hEdit;
	DWORD dwCobExStyle = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_NOPARENTNOTIFY;
	DWORD dwCobStyle = WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS;
	DWORD dwEditExSt = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE;
	DWORD dwEditSt = WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL;

	DWORD dwpgExSt = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_NOPARENTNOTIFY;
	DWORD dwpgSt = WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_VISIBLE;

	//hCob = CreateWindowEx(dwCobExStyle, WC_COMBOBOX, L"Driver", dwCobStyle, 120, 60, 560, 24, m_hWnd, HMENU(IDC_COMBOX_DEVICE), _Module.m_hInst, NULL);
	RECT cbRect = { 120, 60, 680, 78 };
	RECT ceRect = {120,96,561,122};
	m_combox.Create(m_hWnd, cbRect, nullptr, dwCobStyle, dwCobExStyle, IDC_COMBOX_DEVICE, nullptr);
	//hEdit = CreateWindowEx(dwEditExSt, WC_EDIT, L"", dwEditSt, 120, 95, 441, 27, m_hWnd, HMENU(IDC_EDIT_IMAGE), _Module.m_hInst, NULL);
	m_edit.Create(m_hWnd, ceRect, nullptr, dwEditSt, dwEditExSt, IDC_EDIT_IMAGE, nullptr);
	RECT rect = {320,290,680,310};
	m_proge.Create(m_hWnd, rect, L"Progress Times", dwpgSt, dwpgExSt, HMENU(IDC_PROCESS_TIME), NULL);
	m_combox.SendMessage(WM_SETFONT, (WPARAM)hFont, lParam);
	m_edit.SendMessage( WM_SETFONT, (WPARAM)hFont, lParam);
	UINT usbnub = DiscoverRemoveableDrives();
	if (usbnub > 0)
	{
		for (UINT i = 0; i < usbnub; i++){
			m_combox.SendMessage(CB_ADDSTRING, 0, (LPARAM) (g_DriveList[i].sizeInfo));
		}
	}
	Initialize();
	//
	HANDLE hThread = CreateThread(NULL, 0, InspectionEnvironmentThread, m_hWnd, 0, &iseThreadID);
	CloseHandle(hThread);

	return S_OK;
}
コード例 #6
0
ファイル: menuadapter.cpp プロジェクト: mitchdowd/native
		void MenuAdapter::update(Menu& menu)
		{
			MENUITEMINFO info = { 0 };

			if (menu.getAdapter())
			{
				// Set the new menu item information.
				info.cbSize     = sizeof(info);
				info.fMask      = MIIM_STRING | MIIM_STATE | MIIM_SUBMENU | MIIM_ID | MIIM_FTYPE;
				info.fState     = MFS_ENABLED;
				info.fType      = MFT_STRING;
				info.wID        = UINT(menu.getId());
				info.hSubMenu   = HMENU(menu.getAdapter()->getHandle());
				info.dwTypeData = LPWSTR(menu.getText().toArray());

				if (::SetMenuItemInfo(HMENU(getHandle()), UINT(menu.getId()), FALSE, &info) == 0)
					throw UserInterfaceException("SetMenuItemInfo() failed");
			}
		}
コード例 #7
0
ファイル: menuadapter.cpp プロジェクト: mitchdowd/native
		void MenuAdapter::insert(size_t index, Menu& menu)
		{
			MENUITEMINFO info = { 0 };

			IMenuAdapter* adapter = menu.getAdapter();

			if (!adapter)
				throw UserInterfaceException("Cannot insert menu without an adapter.");

			// Fill out the regular menu item information.
			info.cbSize     = sizeof(info);
			info.fMask      = MIIM_STRING | MIIM_STATE | MIIM_SUBMENU | MIIM_ID;
			info.fState     = MFS_ENABLED;
			info.wID        = UINT(menu.getId());
			info.hSubMenu   = HMENU(adapter->getHandle());
			info.dwTypeData = LPWSTR(menu.getText().toArray());

			// Insert the menu item into the Menu.
			if (::InsertMenuItem(HMENU(_handle), UINT(index), TRUE, &info) == 0)
				throw UserInterfaceException("InsertMenuItem() failed");
		}
コード例 #8
0
ファイル: menuadapter.cpp プロジェクト: mitchdowd/native
		void MenuAdapter::insertSeparator(size_t index)
		{
			MENUITEMINFO info = { 0 };

			// Fill out the regular menu item information.
			info.cbSize = sizeof(info);
			info.fMask  = MIIM_TYPE;
			info.fType  = MFT_SEPARATOR;

			// Insert the separator into the menu.
			if (::InsertMenuItem(HMENU(_handle), UINT(index), TRUE, &info) == 0)
				throw UserInterfaceException("InsertMenuItem() failed");
		}
コード例 #9
0
ファイル: twl_menu.cpp プロジェクト: Digman/scite-for-php
void ContextMenu::release()
{
// save the popup handle
 Popup pop(m_handle);
// create a top-level menu and add the popup to it...
 Menu::create();
 add_menu(pop);
// restore the popup handle and add it to the form
 m_handle = (Handle)pop;
 m_main_form->set_popup_menu(HMENU(m_handle));
 m_menu_handler->set_form(m_main_form);
 m_main_form->add_handler(m_menu_handler);
}
コード例 #10
0
ファイル: menuitem.cpp プロジェクト: stephengold/gold-tiles
void MenuItem::CheckRadio(bool checkedFlag) {
#ifdef _QT
    mpAction->setChecked(checkedFlag);
#elif defined(_WINDOWS)
    UINT flags = MF_BYCOMMAND;
    if (checkedFlag) {
        flags |= MF_CHECKED;
    } else {
        flags |= MF_UNCHECKED;
    }
    Win::CheckMenuRadioItem(HMENU(mrMenu), mFirstItemId, mLastItemId, mItemId, flags);
#endif  // defined(_WINDOWS)
}
コード例 #11
0
ファイル: menuitem.cpp プロジェクト: stephengold/gold-tiles
void MenuItem::Enable(bool enabledFlag) {
#ifdef _QT
    mpAction->setEnabled(enabledFlag);
#elif defined(_WINDOWS)
    UINT flags = MF_BYCOMMAND;
    if (enabledFlag) {
        flags |= MF_ENABLED;
    } else {
        flags |= MF_GRAYED;
    }
    Win::EnableMenuItem(HMENU(mrMenu), mItemId, flags);
#endif  // defined(_WINDOWS)
}
コード例 #12
0
void playlist_view::create_header(bool visible)
{
	if (wnd_header) { DestroyWindow(wnd_header); wnd_header = 0; }
	if (cfg_header)
	{
		wnd_header = CreateWindowEx(0, WC_HEADER, _T("Playlist display column titles"),
			WS_CHILD | (visible ? WS_VISIBLE : 0) | HDS_HOTTRACK | HDS_DRAGDROP | HDS_HORZ | (/*nohscroll ? 0 : */HDS_FULLDRAG) | (cfg_header_hottrack ? HDS_BUTTONS : 0),
			0, 0, 0, 0, wnd_playlist, HMENU(5001), core_api::get_my_instance(), NULL);

		on_header_font_change();
		rebuild_header();
	}
	if (visible) RedrawWindow(wnd_playlist, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
}
コード例 #13
0
ファイル: Button.cpp プロジェクト: kinpa200296/SP_labs
Button::Button(UINT_PTR subClassId, HINSTANCE hInst, HWND parent, int x, int y, int width, int height, int id,
               LPCWSTR text, DWORD additionalStyles) : Control(subClassId, hInst, parent, x, y, width, height, text,
                           WC_BUTTON, NULL, WS_CHILD | WS_VISIBLE | BS_CENTER | BS_VCENTER | BS_PUSHBUTTON | BS_TEXT | additionalStyles,
                           HMENU(id))
{
    DrawButtonDC = CreateCompatibleDC(nullptr);
    ClearButtonDC = CreateCompatibleDC(nullptr);
    HBITMAP bitmap = HBITMAP(LoadImage(Instance, MAKEINTRESOURCE(IDB_DRAW), IMAGE_BITMAP,
                                       PIC_SIZE, PIC_SIZE, LR_DEFAULTCOLOR));
    SelectObject(DrawButtonDC, bitmap);
    bitmap = HBITMAP(LoadImage(Instance, MAKEINTRESOURCE(IDB_CLEAR), IMAGE_BITMAP,
                               PIC_SIZE, PIC_SIZE, LR_DEFAULTCOLOR));
    SelectObject(ClearButtonDC, bitmap);
}
コード例 #14
0
ファイル: menuadapter.cpp プロジェクト: mitchdowd/native
		void MenuAdapter::insert(size_t index, Action& action)
		{
			MENUITEMINFO info = { 0 };

			// Fill out the regular menu item information.
			info.cbSize     = sizeof(info);
			info.fMask      = MIIM_STRING | MIIM_STATE | MIIM_ID;
			info.fState     = MFS_ENABLED;
			info.wID        = UINT(action.getId());
			info.dwTypeData = LPWSTR(action.getText().toArray());

			// Insert the menu item into the menu.
			if (::InsertMenuItem(HMENU(_handle), UINT(index), TRUE, &info) == 0)
				throw UserInterfaceException("InsertMenuItem() failed");
		}
コード例 #15
0
ファイル: twl_menu.cpp プロジェクト: Digman/scite-for-php
void Menu::release()
{
 if (!m_form) return;
 m_form->set_menu(HMENU(m_handle));
 m_form->add_handler(m_menu_handler);
 if (m_accel_list->size()) {
	 ACCEL *accels = new ACCEL[m_accel_list->size()];
	 AccelList::iterator ali;
	 int i = 0;
	 for(ali = m_accel_list->begin(); ali != m_accel_list->end(); ++ali)
		 accels[i++] = *ali;
	 HACCEL hAccel = CreateAcceleratorTable(accels,i);
	 m_form->add_accelerator(hAccel);
 }
}
コード例 #16
0
ファイル: twl_menu.cpp プロジェクト: Digman/scite-for-php
void Menu::add_menu(Item& item)
{
 // if (item.id == -1) item.id = last_id++;
  item.id = last_id++; //*new
  AppendMenu(HMENU(m_handle),MF_STRING,item.id,item.caption);
  m_menu_handler->add(item);
  char buff[120];
  strcpy(buff,item.caption);
  strtok(buff,"\t");
  char *astr = strtok(NULL,"");
  if (astr) {
    ACCEL accl; 
    char *ckey, *vkey;
	ckey = strtok(astr,"-");
	vkey = strtok(NULL," ");
	if (vkey==NULL) { vkey = ckey; ckey = NULL; }
	else strupr(ckey);
	strupr(vkey);
	int key;
	accl.fVirt = FVIRTKEY;
	if (*vkey=='F' && *(vkey+1) != '\0') {
      int fkey_id = atoi(vkey+1);
	  key = VK_F1 + fkey_id - 1;
    } else
	if (EQ(vkey,"UP"))     key = VK_UP; else
	if (EQ(vkey,"DOWN"))   key = VK_DOWN; else
	if (EQ(vkey,"RIGHT"))  key = VK_RIGHT; else
	if (EQ(vkey,"LEFT"))   key = VK_LEFT; else
	if (EQ(vkey,"DELETE")) key = VK_DELETE;
	else {
      //accl.fVirt = 0;
	  key = (int)vkey[0];
    }
    accl.key = (WORD)key;
	if (ckey != NULL) {
      if (EQ(ckey,"CTRL")) accl.fVirt |= FCONTROL; else
      if (EQ(ckey,"ALT")) accl.fVirt |= FALT; else
      if (EQ(ckey,"SHIFT")) accl.fVirt |= FSHIFT;
    }
    accl.cmd = (WORD)item.id;
	//if (accl.fVirt & FVIRTKEY)  // for now...
	m_accel_list->push_back(accl);
  }

}
コード例 #17
0
ファイル: TrayNotifyIcon.cpp プロジェクト: uvbs/SupportCenter
void CTrayNotifyIcon::SetDefaultMenuItem(UINT uItem, BOOL fByPos)
{
    m_nDefaultMenuItem = uItem;
    m_bDefaultMenuItemByPos = fByPos;

    //Also update in the live menu if it is present
    if (m_Menu.operator HMENU())
    {
#ifdef _AFX
        CMenu* pSubMenu = m_Menu.GetSubMenu(0);
        ATLASSERT(pSubMenu); //Your menu resource has been designed incorrectly

        pSubMenu->SetDefaultItem(m_nDefaultMenuItem, m_bDefaultMenuItemByPos);
#else
        CMenuHandle subMenu = m_Menu.GetSubMenu(0);
        ATLASSERT(subMenu.IsMenu()); //Your menu resource has been designed incorrectly

        subMenu.SetMenuDefaultItem(m_nDefaultMenuItem, m_bDefaultMenuItemByPos);
#endif
    }
}
コード例 #18
0
ファイル: npplugin.cpp プロジェクト: pagxir/libflashcross
int NPPlugin::NPGeckoWindowNew(void)
{
	HWND hPlugin;
	ULONG style = WS_CHILD|WS_MAXIMIZE|WS_VISIBLE;

	if (m_parent == NULL) {
	   	m_parent = CreateWindow(NPGeckoWindow, "plugin",
			   	WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN, 
				CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL,
			   	__g_hinstance, this);
	   	ShowWindow(m_parent, SW_MINIMIZE);
		style |= WS_VISIBLE;
	}
	assert (m_parent != NULL);

   	m_embed = CreateWindow(NPEmbedWindow,
		   	NPEmbedWindow, style, 8, 8, 480, 400,
		   	m_parent, HMENU(0x1982), __g_hinstance, NULL);

	SetWindowLong(m_parent, 0, (ULONG)this);
	return 0;
}
コード例 #19
0
ファイル: PEAnalyzerUI.cpp プロジェクト: fcharlie/PEAnalyzer
/*
*  Message Action Function
*/
LRESULT MetroWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandle)
{
    auto hr = Initialize();
    if (hr != S_OK) {
        ::MessageBoxW(nullptr, L"Initialize() failed", L"Fatal error", MB_OK | MB_ICONSTOP);
        std::terminate();
        return S_FALSE;
    }
    HICON hIcon = LoadIconW(GetModuleHandleW(nullptr), MAKEINTRESOURCEW(IDI_PEANALYZER));
    SetIcon(hIcon, TRUE);
    ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);
    ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD);
    ChangeWindowMessageFilter(0x0049, MSGFLT_ADD);
    ::DragAcceptFiles(m_hWnd, TRUE);
    DWORD dwEditEx = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | \
                     WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE;
    DWORD dwEdit = WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_VISIBLE | \
                   WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL;
    HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
    LOGFONT logFont = { 0 };
    GetObject(hFont, sizeof(logFont), &logFont);
    DeleteObject(hFont);
    hFont = NULL;
    logFont.lfHeight = 19;
    logFont.lfWeight = FW_NORMAL;
    wcscpy_s(logFont.lfFaceName, L"Segoe UI");
    hFont = CreateFontIndirect(&logFont);

    HWND hEdit = CreateWindowExW(dwEditEx, WC_EDITW,
                                 L"",
                                 dwEdit, 80, 40, 360, 27,
                                 m_hWnd,
                                 HMENU(IDC_IMAGE_URI_EDIT),
                                 HINST_THISCOMPONENT,
                                 NULL);
    //::SetWindowFont(hEdit, hFont, TRUE);
    ::SendMessage(hEdit, WM_SETFONT, (WPARAM)hFont, TRUE);
    return S_OK;
}
コード例 #20
0
ファイル: MDITabs.cpp プロジェクト: FlyingJester/sphere
void CMDITabs::OnContextMenu(CWnd* pWnd, CPoint point) 
{
  TCHITTESTINFO hit;
  hit.pt = point;
  ScreenToClient(&hit.pt);
  int i = HitTest(&hit);
  if (i >= 0) 
  {
    TCITEM item;
    item.mask = TCIF_PARAM;
    GetItem(i, &item);
    HWND hWnd = HWND(item.lParam);
    SetCurSel(i);
    //::BringWindowToTop(hWnd);
    HMENU menu = HMENU(::SendMessage(::GetTopWindow(hWnd), WM_GETTABSYSMENU, 0, 0));
    if (menu == 0) menu = ::GetSystemMenu(hWnd, FALSE);
    if (menu) {
      UINT cmd = ::TrackPopupMenu(menu, TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_VCENTERALIGN, point.x, point.y, 0, m_hWnd, NULL);
      ::SendMessage(hWnd, WM_SYSCOMMAND, cmd, 0);
    }
  }
}
コード例 #21
0
ファイル: window.cpp プロジェクト: ValentinL/circles
bool cWindow::Create(
     HWND parent,				
     LPCWSTR text,				
     DWORD exstyle,DWORD style,	
     int x,int y,int w,int h,	
     UINT id
     )
   {
	 _hInstance=GetModuleHandle(0);
     
     WNDCLASSEX wndc;
     wndc.lpszClassName=L"MyWnd";
     wndc.cbSize=sizeof(WNDCLASSEX);
     wndc.lpfnWndProc=WNDPROC(_WndProc);
     wndc.cbClsExtra=0;
     wndc.cbWndExtra=0;
	 wndc.hbrBackground=HBRUSH(BLACK_PEN);
     wndc.hInstance=_hInstance;
     wndc.hCursor=LoadCursor(0,IDC_CROSS);
     wndc.style=CS_HREDRAW|CS_VREDRAW;
     wndc.hIcon=0;
     wndc.hIconSm=0;
     wndc.lpszMenuName=0;
     RegisterClassEx(&wndc);


	 //CreateWindow
     _hwnd=CreateWindowEx(exstyle,wndc.lpszClassName,text,
       style|WS_CLIPCHILDREN,
       x,y,w,h,parent,HMENU(id),
       _hInstance,
       this
       );

	changeSize();
    if(!_hwnd) return false;
    return true;
   }
コード例 #22
0
ファイル: Button.cpp プロジェクト: kinpa200296/SP_labs
	Button::Button(UINT_PTR subClassId, HINSTANCE hInst, HWND parent, int x, int y, int width, int height, int id,
		LPCWSTR text, DWORD additionalStyles) : Control(subClassId, hInst, parent, x, y, width, height, text,
		WC_BUTTON, NULL, WS_CHILD | WS_VISIBLE | BS_CENTER | BS_VCENTER | BS_PUSHBUTTON | BS_TEXT | additionalStyles,
		HMENU(id))
	{
	}
コード例 #23
0
ファイル: menuadapter.cpp プロジェクト: mitchdowd/native
		void MenuAdapter::remove(Action& action)
		{
			::RemoveMenu(HMENU(_handle), (UINT) uptrint_t(action.getId()), MF_BYCOMMAND);
		}
コード例 #24
0
ファイル: menuadapter.cpp プロジェクト: mitchdowd/native
		void MenuAdapter::remove(Menu& menu)
		{
			::RemoveMenu(HMENU(_handle), UINT(menu.getId()), MF_BYCOMMAND);
		}
コード例 #25
0
void t_list_view::create_inline_edit(const pfc::list_base_const_t<t_size> & indices, unsigned column)
{
	t_size indices_count = indices.get_count();
	if (!indices_count) return;
	if (!(column < m_columns.get_count()) || m_selecting)
	{
		//console::print("internal error - edit column index out of range");
		return;
	}

	{
		t_size item_count = m_items.get_count();
		for (t_size j = 0; j < indices_count; j++)
		{
			if (indices[j] >= item_count) return;
		}
	}

	t_size indices_spread = indices[indices_count-1] - indices[0] +1;
	t_size indices_total_height = get_item_position_bottom(indices[indices_count-1]) - get_item_position(indices[0]);

	t_size active_count = m_items.get_count();

	if (m_timer_inline_edit)
	{
		KillTimer(get_wnd(), EDIT_TIMER_ID);
		m_timer_inline_edit = false;
	}

	t_size median = indices[0] + indices_spread/2;//indices[(indices_count/2)];

	bool start_visible = is_visible(indices[0]);
	bool end_visible = is_visible(indices[indices_count-1]);

	if (!start_visible || !end_visible)
	{
		SCROLLINFO si;
		memset(&si, 0, sizeof(SCROLLINFO));
		si.cbSize = sizeof(si);
		si.fMask = SIF_POS|SIF_TRACKPOS|SIF_PAGE|SIF_RANGE;
		GetScrollInfo(get_wnd(), SB_VERT, &si);
		t_size target;
		if (indices_count > si.nPage)
		{
			target = median;
			scroll(false, get_item_position(target) + m_item_height/2 - ((si.nPage>1?si.nPage-1:0)/2));
		}
		else
		{
			target = get_item_position(indices[0]) > (t_size)m_scroll_position ? indices[indices_count-1] : indices[0];
			scroll(false, get_item_position(target) -(get_item_position(target) > (t_size)m_scroll_position ? (si.nPage>1?si.nPage-1:0) - m_item_height : 0));
		}
	}

	int x = 0;
	{
		
		{
			x = get_total_indentation();
		}
		
		{
			unsigned n, count = m_columns.get_count();
			for (n=0; n<count && n<column; n++)
			{
				x += m_columns[n].m_display_size;
			}
		}
	}

	RECT rc_playlist, rc_items;
	GetClientRect(get_wnd(), &rc_playlist);
	get_items_rect(&rc_items);

	int font_height = uGetFontHeight(m_font);
	int header_height = rc_items.top;//get_header_height();

	int y = (get_item_position(indices[0])-m_scroll_position) + header_height;
	if (y < header_height) y= header_height;
	int cx = m_columns[column].m_display_size;
	//if (column == 0)
	//	cx -= min(x,cx);
	int cy = min (indices_total_height, t_size(rc_items.bottom-rc_items.top));

	if (!m_autosize && ( (x - m_horizontal_scroll_position < 0) || x + cx - m_horizontal_scroll_position > rc_items.right))
	{
		/*SCROLLINFO si;
		memset(&si, 0, sizeof(SCROLLINFO));
		si.cbSize = sizeof(si);
		si.fMask = SIF_POS|SIF_TRACKPOS|SIF_PAGE|SIF_RANGE;
		GetScrollInfo(get_wnd(), SB_HORZ, &si);*/
		if (x - m_horizontal_scroll_position < 0)
		{
			scroll(false, x, true);
		}
		else if (x + cx - m_horizontal_scroll_position > rc_items.right)
		{
			const int x_right = x + cx - rc_items.right;
			scroll(false, cx > rc_items.right ? x : x_right, true);
		}
	}

	x -= m_horizontal_scroll_position;

	/*int horizontal_offset = 0;
	if (x-horizontal_offset + cx > rc_playlist.right)
		scroll(scroll_horizontally, scroll_position_delta, x-horizontal_offset + (cx>rc_playlist.right?0:cx-rc_playlist.right));
	else if (x-horizontal_offset < 0)
		scroll(scroll_horizontally, scroll_position_delta, x-horizontal_offset);

	x-=horizontal_offset;*/

	if (m_wnd_inline_edit)
	{
		save_inline_edit();

		//NEW
		m_inline_edit_prevent_kill = true;
		DestroyWindow(m_wnd_inline_edit);
		m_wnd_inline_edit=0;
		m_inline_edit_autocomplete.release();
		m_inline_edit_prevent_kill = false;
		//END NEW
	}

	//m_inline_edit_field.set_string(pfc::empty_string_t<char>());
	//m_inline_edit_items.remove_all();
	//m_inline_edit_items.set_count(indices_count);
	//pfc::list_t<bool> mask;

	pfc::string8 text;
	t_size flags = 0;
	mmh::comptr_t<IUnknown> pAutoCompleteEntries;
	if (!notify_create_inline_edit(indices, column, text, flags, pAutoCompleteEntries))
	{
		m_inline_edit_save = false;
		exit_inline_edit();
		return;
	}

	if (!m_wnd_inline_edit)
	{
		m_inline_edit_save = true;
		m_wnd_inline_edit = CreateWindowEx(0, WC_EDIT, pfc::stringcvt::string_os_from_utf8(text).get_ptr(), WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE|ES_LEFT|
			ES_AUTOHSCROLL|ES_MULTILINE|ES_AUTOVSCROLL|WS_BORDER|WS_CLIPCHILDREN|((flags & inline_edit_uppercase) ? ES_UPPERCASE : 0), x, 
			y,
			cx, cy, get_wnd(), HMENU(667),
			core_api::get_my_instance(), 0);

		m_proc_original_inline_edit = (WNDPROC)GetWindowLongPtr(m_wnd_inline_edit,GWLP_WNDPROC);

		if (/*flags & inline_edit_autocomplete && */pAutoCompleteEntries.is_valid())
		{
			if (SUCCEEDED(m_inline_edit_autocomplete.instantiate(CLSID_AutoComplete)))
			{
				if (pAutoCompleteEntries.is_valid())
					m_inline_edit_autocomplete->Init(m_wnd_inline_edit, pAutoCompleteEntries, NULL, NULL);

				mmh::comptr_t<IAutoComplete2> pA2 = m_inline_edit_autocomplete;
				mmh::comptr_t<IAutoCompleteDropDown> pAutoCompleteDropDown = m_inline_edit_autocomplete;
				if (pA2.is_valid())
				{
					pA2->SetOptions(ACO_AUTOSUGGEST|ACO_UPDOWNKEYDROPSLIST);
				}
			}
		}

		SetWindowLongPtr(m_wnd_inline_edit,GWL_USERDATA,(LPARAM)(this));
		m_proc_inline_edit = (WNDPROC)SetWindowLongPtr(m_wnd_inline_edit,GWL_WNDPROC,(LPARAM)(g_on_inline_edit_message));

		SetWindowPos(m_wnd_inline_edit,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);

		SendMessage(m_wnd_inline_edit, WM_SETFONT, (WPARAM)m_font.get(), MAKELONG(TRUE,0));
	}
#if 0
	else
	{
		if (m_inline_edit_autocomplete.is_valid())
			m_inline_edit_autocomplete->Enable(FALSE);
		SetWindowLongPtr(m_wnd_inline_edit, GWL_STYLE, (GetWindowLongPtr (m_wnd_inline_edit, GWL_STYLE) & ~ES_UPPERCASE) | ((flags & inline_edit_uppercase)  ? ES_UPPERCASE  : 0));
		SendMessage(m_wnd_inline_edit, WM_SETTEXT, 0, (LPARAM)_T(""));
		SetWindowPos(m_wnd_inline_edit, NULL, x, y,	cx, cy, SWP_NOZORDER);
		uSendMessageText(m_wnd_inline_edit, WM_SETTEXT, 0, text);

		if (m_inline_edit_autocomplete.is_valid())
		{
			if (pAutoCompleteEntries.is_valid())
			{
				m_inline_edit_autocomplete->Init(m_wnd_inline_edit, pAutoCompleteEntries, NULL, NULL);
				m_inline_edit_autocomplete->Enable(TRUE);
			}
		}
	}
#endif


	RECT rc;
	rc.left = x+2;
	rc.top = y + (cy-font_height)/2;
	rc.right = x+(cx>0?cx-2:0);
	rc.bottom = rc.top + font_height;
	MapWindowPoints(get_wnd(), m_wnd_inline_edit, (LPPOINT)&rc, 2);

	SendMessage(m_wnd_inline_edit, EM_SETRECT, NULL, (LPARAM)&rc);

	SendMessage(m_wnd_inline_edit, EM_SETSEL, 0, -1);
	SetFocus(m_wnd_inline_edit);

	m_inline_edit_indices.remove_all();
	m_inline_edit_indices.add_items(indices);
	m_inline_edit_column = column;
}
コード例 #26
0
void Game_2048::Show(HWND h) {
	const int TILE = 50;
	const int CELL = 65;
	const int PADDING = 27;
	for (int i = ID; i < curID; i++) {
		DestroyWindow(GetDlgItem(h, i));
	}
	curID = ID;
	TCHAR buf[5];
	for (int i = 0; i < field_size; i++) {
		for (int j = 0; j < field_size; j++) {
			if (field[i][j]) {
				_itow_s(field[i][j], buf, 10);
				CreateWindow(L"BUTTON", buf, WS_CHILD | WS_VISIBLE, ((i * CELL) + PADDING), ((j * CELL) + PADDING), TILE, TILE, h, HMENU(curID++), nullptr, nullptr);
			}
		}
	}
}
コード例 #27
0
ファイル: menuadapter.cpp プロジェクト: mitchdowd/native
		MenuAdapter::~MenuAdapter()
		{
			::DestroyMenu(HMENU(_handle));
		}
コード例 #28
0
ファイル: Edit.cpp プロジェクト: kinpa200296/SP_labs
Edit::Edit(UINT_PTR subClassId, HINSTANCE hInst, HWND parent, int x, int y, int width, int height, int id,
           DWORD additionalStyles) : Control(subClassId, hInst, parent, x, y, width, height, L"", WC_EDIT, NULL,
                       WS_CHILD | WS_VISIBLE | WS_BORDER |	ES_AUTOHSCROLL | ES_LEFT | additionalStyles, HMENU(id))
{
}
コード例 #29
0
ファイル: TpresetAutoload.cpp プロジェクト: TheRyuu/ffdshow
void TpresetAutoloadDlgBase::TitemsWindow::showItems(void)
{
    THWNDs hwnds;
    getChildWindows(m_hwnd, hwnds);
    for (THWNDs::const_iterator h = hwnds.begin(); h != hwnds.end(); h++) {
        DestroyWindow(*h);
    }
    int y = 0;
    HFONT fnt = (HFONT)SendMessage(m_hwnd, WM_GETFONT, 0, 0);
    CRect pr;
    GetWindowRect(m_hwnd, &pr);
    int prdlgdx = 170; //TODO: compute
    int id = 0;
    int sbrWidth = GetSystemMetrics(SM_CXVSCROLL) + 4;
    for (Titems::const_iterator i = items.begin(); i != items.end(); i++, id++) {
        CRect r(CPoint(0, y), CSize(prdlgdx, 10));
        MapDialogRect(m_hwnd, &r);
        HWND hchb = CreateWindow(_l("BUTTON"), _(-IDD_PRESET_AUTOLOAD_ITEMS, i->name), WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | WS_TABSTOP, r.left, r.top, r.Width() - sbrWidth, r.Height(), m_hwnd, HMENU(1000 + 10 * id + 1), hi, 0);
        SendMessage(hchb, WM_SETFONT, WPARAM(fnt), TRUE);
        setCheck(1000 + 10 * id + 1, i->is);
        y += 11;
        if (i->isVal) {
            static const int dxbt1 = 10;
            int dxbt = (i->isList ? dxbt1 : 0) + (i->isHelp ? dxbt1 : 0);
            r = CRect(CPoint(0, y), CSize(prdlgdx - dxbt, 12));
            MapDialogRect(m_hwnd, &r);
            HWND hed = CreateWindowEx(WS_EX_CLIENTEDGE, _l("EDIT"), NULL, WS_CHILD | WS_VISIBLE | ES_LEFT | ES_AUTOHSCROLL | WS_TABSTOP, r.left, r.top, r.Width() - sbrWidth, r.Height(), m_hwnd, HMENU(1000 + 10 * id + 2), hi, 0);
            SendMessage(hed, WM_SETFONT, WPARAM(fnt), TRUE);
            SendMessage(hed, EM_SETLIMITTEXT, 255, 0);
            setWindowText(hed, i->val);
            if (i->hint && i->hint[0]) {
                addHint(1000 + 10 * id + 2, i->hint);
            }
            int btx = prdlgdx - dxbt;
            if (i->isList) {
                r = CRect(CPoint(btx, y), CSize(10, 12));
                MapDialogRect(m_hwnd, &r);
                btx += dxbt1;
                HWND hbt = CreateWindow(_l("BUTTON"), _l("6"), WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | WS_TABSTOP, r.left - sbrWidth, r.top, r.Width(), r.Height(), m_hwnd, HMENU(1000 + 10 * id + 3), hi, 0);
                SendMessage(hbt, WM_SETFONT, WPARAM(arrowsFont), TRUE);
            }
            if (i->isHelp) {
                r = CRect(CPoint(btx, y), CSize(10, 12));
                MapDialogRect(m_hwnd, &r);
                HWND hbt = CreateWindow(_l("BUTTON"), _l("?"), WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | WS_TABSTOP, r.left - sbrWidth, r.top, r.Width(), r.Height(), m_hwnd, HMENU(1000 + 10 * id + 4), hi, 0);
                SendMessage(hbt, WM_SETFONT, WPARAM(fnt), TRUE);
            }
            y += 14;
        }
    }
    SCROLLINFO si;
    si.cbSize = sizeof(si);
    si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
    si.nMin = 0;
    CRect r(0, 0, 0, y);
    MapDialogRect(m_hwnd, &r);
    si.nMax = r.Height();
    si.nPage = pr.Height();
    si.nPos = 0;
    SetScrollInfo(m_hwnd, SB_VERT, &si, TRUE);
}
コード例 #30
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){
    switch (message)    {
	case WM_CREATE: {
		database->reserve(50);
		initInterface();
		genb = CreateWindowA("BUTTON", loadStringFromFile("tech\\button").c_str(), WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_FLAT, 355, 260, 150, 75, hWnd, HMENU(ID_BUTTON_GEN), NULL, NULL); SendMessage(genb, WM_SETFONT, (WPARAM)hFont, (LPARAM)MAKELONG(TRUE, 0));
		right = CreateWindowW(L"BUTTON", L"←", WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_FLAT, 325, 260, 30, 75, hWnd, HMENU(ID_BUTTON_RIGHT), NULL, NULL); SendMessage(right, WM_SETFONT, (WPARAM)hFont, (LPARAM)MAKELONG(TRUE, 0));
		left = CreateWindowW(L"BUTTON", L"→", WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_FLAT, 505, 260, 30, 75, hWnd, HMENU(ID_BUTTON_LEFT), NULL, NULL); SendMessage(left, WM_SETFONT, (WPARAM)hFont, (LPARAM)MAKELONG(TRUE, 0));
	}
    case WM_COMMAND: {
			if ((HIWORD(wParam)==0)&&(LOWORD(wParam)==ID_BUTTON_GEN)) {
				database->push_back(hero());
				current_hero = database->size()-1;
				hdc = GetDC(hWnd);
				ResultOnScreen(hdc,hFont);
				ReleaseDC(hWnd, hdc);
			}
			if ((HIWORD(wParam) == 0) && (LOWORD(wParam) == ID_BUTTON_LEFT)) {
				if (current_hero >= 0 && current_hero < database->size()-1) {
					current_hero++;
					hdc = GetDC(hWnd);
					ResultOnScreen(hdc, hFont);
					ReleaseDC(hWnd, hdc);
				}
			}
			if ((HIWORD(wParam) == 0) && (LOWORD(wParam) == ID_BUTTON_RIGHT)) {
				if (current_hero > 0 && current_hero <= database->size()) {
					current_hero--;
					hdc = GetDC(hWnd);
					ResultOnScreen(hdc, hFont);
					ReleaseDC(hWnd, hdc);
				}
			}
			SetFocus(hWnd);
			InvalidateRect(hWnd, NULL, TRUE);
        }
        break;
	case WM_PAINT: {
			hdc = BeginPaint(hWnd, &ps);
			InterfaceOnScreen(hFont, hdc);
			ResultOnScreen(hdc, hFont);
			EndPaint(hWnd, &ps);
		}
        break;
	case WM_KEYDOWN:  if (wParam == VK_ESCAPE) { DestroyWindow(hWnd); } break;
	case WM_DESTROY: PostQuitMessage(0); break;
	default: { return DefWindowProc(hWnd, message, wParam, lParam); }  }
    return 0;
}