void CGUIDialogFavourites::OnPopupMenu(int item)
{
  if (item < 0 || item >= m_favourites->Size())
    return;

  // highlight the item
  (*m_favourites)[item]->Select(true);

  CContextButtons choices;
  if (m_favourites->Size() > 1)
  {
    choices.Add(1, 13332);
    choices.Add(2, 13333);
  }
  choices.Add(3, 15015);
  choices.Add(4, 118);
  
  int button = CGUIDialogContextMenu::ShowAndGetChoice(choices);

  // unhighlight the item
  (*m_favourites)[item]->Select(false);

  if (button == 1)
    OnMoveItem(item, -1);
  else if (button == 2)
    OnMoveItem(item, 1);
  else if (button == 3)
    OnDelete(item);
  else if (button == 4)
    OnRename(item);
}
bool CGUIDialogFavourites::OnMessage(CGUIMessage &message)
{
  if (message.GetMessage() == GUI_MSG_CLICKED)
  {
    if (message.GetSenderId() == FAVOURITES_LIST)
    {
      int item = GetSelectedItem();
      int action = message.GetParam1();
      if (action == ACTION_SELECT_ITEM || action == ACTION_MOUSE_LEFT_CLICK)
        OnClick(item);
      else if (action == ACTION_MOVE_ITEM_UP)
        OnMoveItem(item, -1);
      else if (action == ACTION_MOVE_ITEM_DOWN)
        OnMoveItem(item, 1);
      else if (action == ACTION_CONTEXT_MENU || action == ACTION_MOUSE_RIGHT_CLICK)
        OnPopupMenu(item);
      else if (action == ACTION_DELETE_ITEM)
        OnDelete(item);
      else
        return false;
      return true;
    }
  }
  else if (message.GetMessage() == GUI_MSG_WINDOW_DEINIT)
  {
    CGUIDialog::OnMessage(message);
    // clear our favourites
    CGUIMessage message(GUI_MSG_LABEL_RESET, GetID(), FAVOURITES_LIST);
    OnMessage(message);
    m_favourites->Clear();
    return true;
  }
  return CGUIDialog::OnMessage(message);
}
void KEditDialogImpl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
    CPoint cPoint;

    switch(nChar)
    {
    case VK_DELETE:
        OnDelete();
        return;
    case VK_LEFT:
        cPoint.x = m_nowPoint.x - 1;
        cPoint.y = m_nowPoint.y;
        break;
    case VK_RIGHT:
        cPoint.x = m_nowPoint.x + 1;
        cPoint.y = m_nowPoint.y;
        break;
    case VK_UP:
        cPoint.x = m_nowPoint.x;
        cPoint.y = m_nowPoint.y - 1;
        break;
    case VK_DOWN:
        cPoint.x = m_nowPoint.x;
        cPoint.y = m_nowPoint.y + 1;
        break;
    default:
        return;
    }

    OnMouseMove(MK_LBUTTON, cPoint);
}
//--------------------------------------------------------------------------------------
//!
//--------------------------------------------------------------------------------------
void tWorkProfilesDialog::CreateActions()
{
    m_pEditAct = new tAction( tr( "Edit" ) );
    Connect( m_pEditAct, SIGNAL( triggered() ), this, SLOT( OnEdit() ) );
    m_ActionList << m_pEditAct;

    m_pDeleteAct = new tAction( tr( "Delete" ) );
    m_pDeleteAct->setEnabled(false);
    Connect( m_pDeleteAct, SIGNAL( triggered() ), this, SLOT( OnDelete() ) );
    m_ActionList << m_pDeleteAct;

    m_pSettingsAct = new tAction( tr( "Settings" )  + "..." );
    Connect( m_pSettingsAct, SIGNAL( triggered() ), this, SLOT( OnSettings() ) );
    m_ActionList << m_pSettingsAct;

    m_pDeleteAllAct = new tAction( tr( "Delete all" ), this );
    Connect( m_pDeleteAllAct, SIGNAL( triggered() ), this, SLOT( DeleteAllProfiles() ) );
    m_ActionList << m_pDeleteAllAct;

    if ( HasTitleCloseButton() == false )
    {
        m_pCloseAct = new tAction( tr( "Close" ), this );
        Connect( m_pCloseAct, SIGNAL( triggered() ), this, SLOT( accept() ) );
        m_ActionList << m_pCloseAct;
    }
}
bool CGUIWindowEventLog::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
{
  if (itemNumber < 0 && itemNumber >= m_vecItems->Size())
    return false;

  CFileItemPtr item = m_vecItems->Get(itemNumber);
  if (item == nullptr)
    return false;

  switch (button)
  {
  case CONTEXT_BUTTON_INFO:
    return OnSelect(item);

  case CONTEXT_BUTTON_DELETE:
    return OnDelete(item);

  case CONTEXT_BUTTON_ACTIVATE:
    return OnExecute(item);

  default:
    break;
  }

  return CGUIMediaWindow::OnContextButton(itemNumber, button);
}
Exemple #6
0
int __stdcall ModuleEntry (
		int nFunctionID,
		void *pParams
		)
{
	switch ( nFunctionID ) {

	case FID_INITIALIZE:
		return OnInitialize ((StartupInfo*)pParams);

	case FID_FINALIZE:
		return OnFinalize ();

	case FID_QUERYARCHIVE:
		return OnQueryArchive ((QueryArchiveStruct*)pParams);

	case FID_STARTOPERATION:
		return OnStartOperation ((OperationStruct*)pParams);

	case FID_ENDOPERATION:
		return OnEndOperation ((OperationStruct*)pParams);

	case FID_GETARCHIVEMODULEINFO:
		return OnGetArchiveModuleInfo ((ArchiveModuleInfo*)pParams);

	case FID_GETARCHIVEITEM:
		return OnGetArchiveItem((GetArchiveItemStruct*)pParams);

	case FID_FREEARCHIVEITEM:
		return OnFreeArchiveItem((FreeArchiveItemStruct*)pParams);

	case FID_EXTRACT:
		return OnExtract ((ExtractStruct*)pParams);

	case FID_TEST:
		return OnTest ((TestStruct*)pParams);

	case FID_GETDEFAULTCOMMAND:
		return OnGetDefaultCommand ((GetDefaultCommandStruct*)pParams);
	
	case FID_DELETE:
		return OnDelete ((DeleteStruct*)pParams);

	case FID_ADD:
		return OnAdd ((AddStruct*)pParams);

	case FID_CREATEARCHIVE:
	case FID_OPENARCHIVE:
		return OnOpenCreateArchive ((OpenCreateArchiveStruct*)pParams);

	case FID_CONFIGUREFORMAT:
		return OnConfigureFormat((ConfigureFormatStruct*)pParams);

	case FID_CLOSEARCHIVE:
		return OnCloseArchive((CloseArchiveStruct*)pParams);
	}

	return NAERROR_NOTIMPLEMENTED;
}
void GuiContainer::Delete(GuiAtom *atom)
{
    if( atom != NULL ) {
        Lock();
        OnDelete(atom);
        GetRootContainer()->ReleaseAtom(atom);
        Unlock();
    }
}
Exemple #8
0
// 删除
void CListPage::OnClickedButton2()
{
	int index = m_list.GetSelectionMark();
	if (index == LB_ERR)
		return;
	m_list.DeleteItem(index);
	OnDelete(index);
	index = index > 0 ? index - 1 : index;
	m_list.SetSelectionMark(index);
	m_list.SetItemState(index, LVNI_FOCUSED | LVNI_SELECTED, LVNI_FOCUSED | LVNI_SELECTED);
}
Exemple #9
0
void XxWindow::HandleEvent (const XEvent &WinEvent)
{
    switch (WinEvent.type) {
    case ClientMessage:
        if (WinEvent.xclient.format == 32) {
            const long *l = WinEvent.xclient.data.l;
            if (*l == (long)GetWmDeleteWindow ()) OnDelete ();
        };
        break;
    case Expose:
        OnExpose
            ( WinEvent.xexpose.x
            , WinEvent.xexpose.y
            , WinEvent.xexpose.width
            , WinEvent.xexpose.height
            );
        break;
    case ButtonPress:
        OnButtonPress
            ( WinEvent.xbutton.button
            , WinEvent.xbutton.x
            , WinEvent.xbutton.y
            );
        break;
    case ButtonRelease:
        OnButtonRelease
            ( WinEvent.xbutton.button
            , WinEvent.xbutton.x
            , WinEvent.xbutton.y
            );
        break;
    case EnterNotify:
        OnEnterWindow
            ( WinEvent.xcrossing.x
            , WinEvent.xcrossing.y
            );
        break;
    case LeaveNotify:
        OnLeaveWindow
            ( WinEvent.xcrossing.x
            , WinEvent.xcrossing.y
            );
        break;
    case ResizeRequest:
        OnResize
            ( WinEvent.xresizerequest.width
            , WinEvent.xresizerequest.height
            );
        break;
    default:
        break;
    };
};
Exemple #10
0
int __stdcall PluginEntry (
		int nFunctionID,
		void *pParams
		)
{
	switch ( nFunctionID ) {

	case FID_INITIALIZE:
		return OnInitialize ((StartupInfo*)pParams);

	case FID_FINALIZE:
		return OnFinalize ();

	case FID_QUERYARCHIVE:
		return OnQueryArchive ((QueryArchiveStruct*)pParams);

	case FID_OPENARCHIVE:
		return OnOpenArchive ((OpenArchiveStruct*)pParams);

	case FID_CLOSEARCHIVE:
		return OnCloseArchive ((CloseArchiveStruct*)pParams);

	case FID_FINALIZEARCHIVE:
		return OnFinalizeArchive ((AceArchive*)pParams);

	case FID_GETARCHIVEPLUGININFO:
		return OnGetArchivePluginInfo ((ArchivePluginInfo*)pParams);

	case FID_GETARCHIVEITEM:
		return OnGetArchiveItem ((GetArchiveItemStruct*)pParams);

	case FID_GETARCHIVEFORMAT:
		return OnGetArchiveFormat ((GetArchiveFormatStruct*)pParams);

	case FID_EXTRACT:
		return OnExtract ((ExtractStruct*)pParams);

	case FID_GETDEFAULTCOMMAND:
		return OnGetDefaultCommand ((GetDefaultCommandStruct*)pParams);

	case FID_ADD:
		return OnAdd ((AddStruct*)pParams);

	case FID_DELETE:
		return OnDelete ((DeleteStruct*)pParams);

	case FID_CREATEARCHIVE:
		return OnCreateArchive ((CreateArchiveStruct*)pParams);
	}

	return NAERROR_NOTIMPLEMENTED;
}
CSelectIconDlg::CSelectIconDlg(IDatabase* database,int CurrentId,QWidget* parent, Qt::WFlags fl):QDialog(parent,fl){
	setupUi(this);
	db=database;
	Id=CurrentId;
	CtxMenu=new QMenu(this);
	ReplaceAction=CtxMenu->addAction(getIcon("swap"),tr("Replace..."));
	DeleteAction=CtxMenu->addAction(getIcon("delete"),tr("Delete"));
	QPushButton* Button_AddIcon = ButtonBox->addButton(tr("Add Custom Icon"), QDialogButtonBox::ActionRole);
	Button_PickIcon = ButtonBox->addButton(tr("Pick"), QDialogButtonBox::AcceptRole);
	connect(Button_AddIcon, SIGNAL(clicked()), this, SLOT(OnAddIcon()));
	connect(Button_PickIcon, SIGNAL(clicked()), this, SLOT(OnPickIcon()));
	connect(ButtonBox, SIGNAL(rejected()), this, SLOT(OnCancel()));
	connect(DeleteAction,SIGNAL(triggered()),this,SLOT(OnDelete()));
	connect(ReplaceAction,SIGNAL(triggered()),this,SLOT(OnReplace()));
	connect(List,SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),this,SLOT(OnSelectionChanged(QListWidgetItem*)));
}
CNetworkVehicle::~CNetworkVehicle()
{
	// Remove the driver if we have one
	if(m_pDriver)
		m_pDriver->RemoveFromVehicle();

	// Remove all passengers if we have any
	for(BYTE i = 0; i < MAX_VEHICLE_PASSENGERS; i++)
	{
		if(m_pPassengers[i])
			m_pPassengers[i]->RemoveFromVehicle();
	}

	// Tell the streamer to delete us
	OnDelete();
}
Exemple #13
0
void CPlayListDlg::OnListKeyDown(NMLVKEYDOWN* pnm)
{
	HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST);

	switch (pnm->wVKey) {
	case VK_DELETE:
		OnDelete();
		return;
	case VK_TAB:
		SetFocus(m_pParent->GetHandle());
		return;
	case 'A':
		if (GetAsyncKeyState(VK_CONTROL) & 0x8000) 
			ListView_SetItemState(hwndLV, -1, LVIS_SELECTED, LVIS_SELECTED);
		return;
	}
}
Exemple #14
0
// unfortunately, under GTK we won't get the original wxKeyEvent
// to reset m_metaDown
void frmMain::OnTreeKeyDown(wxTreeEvent& event)
{
    switch (event.GetKeyCode())
    {
	case WXK_F1:
	    OnHelp(event);
	    break;
	case WXK_F5:
	    Refresh(currentObject);
	    break;
	case WXK_DELETE:
	    OnDelete(event);
	    break;
	default:
	    event.Skip();
	    break;
    }
}
void CGUIDialogFavourites::OnPopupMenu(int item)
{
  if (item < 0 || item >= m_favourites->Size())
    return;

  CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU);
  if (pMenu)
  {
    // highlight the item
    (*m_favourites)[item]->Select(true);

    // initialize the positioning
    float posX = 0;
    float posY = 0;
    const CGUIControl *pList = GetControl(FAVOURITES_LIST);
    if (pList)
    {
      posX = pList->GetXPosition() + pList->GetWidth() / 2;
      posY = pList->GetYPosition() + pList->GetHeight() / 2;
    }
    pMenu->Initialize();

    int btn_MoveUp = m_favourites->Size() > 1 ? pMenu->AddButton(13332) : 0;
    int btn_MoveDown = m_favourites->Size() > 1 ? pMenu->AddButton(13333) : 0;
    int btn_Remove = pMenu->AddButton(15015);
    int btn_Rename = pMenu->AddButton(118);

    pMenu->SetPosition(GetPosX() + posX - pMenu->GetWidth() / 2, GetPosY() + posY - pMenu->GetHeight() / 2);
    pMenu->DoModal(GetID());
    int button = pMenu->GetButton();

    // unhighlight the item
    (*m_favourites)[item]->Select(false);

    if (button == btn_MoveUp)
      OnMoveItem(item, -1);
    else if (button == btn_MoveDown)
      OnMoveItem(item, 1);
    else if (button == btn_Remove)
      OnDelete(item);
    else if (button == btn_Rename)
      OnRename(item);
  }
}
Exemple #16
0
void CGUIDialogFavourites::OnPopupMenu(int item)
{
  if (item < 0 || item >= m_favourites->Size())
    return;

  CGUIDialogContextMenu *pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU);
  if (pMenu)
  {
    // highlight the item
    (*m_favourites)[item]->Select(true);

    // initialize the positioning
    CPoint pos;
    const CGUIControl *pList = GetControl(FAVOURITES_LIST);
    if (pList)
      pos = pList->GetRenderPosition() + CPoint(pList->GetWidth() * 0.5f, pList->GetHeight() * 0.5f);
    pMenu->Initialize();

    int btn_MoveUp = m_favourites->Size() > 1 ? pMenu->AddButton(13332) : 0;
    int btn_MoveDown = m_favourites->Size() > 1 ? pMenu->AddButton(13333) : 0;
    int btn_Remove = pMenu->AddButton(15015);
    int btn_Rename = pMenu->AddButton(118);

    pMenu->OffsetPosition(pos.x, pos.y);
    pMenu->DoModal(GetID());
    int button = pMenu->GetButton();

    // unhighlight the item
    (*m_favourites)[item]->Select(false);

    if (button == btn_MoveUp)
      OnMoveItem(item, -1);
    else if (button == btn_MoveDown)
      OnMoveItem(item, 1);
    else if (button == btn_Remove)
      OnDelete(item);
    else if (button == btn_Rename)
      OnRename(item);
  }
}
Exemple #17
0
void OnCommand( HWND hWnd, WPARAM wParam )
{
	switch( LOWORD(wParam) )
	{
	case 1001:
		if( HIWORD(wParam)==CBN_SELCHANGE )
		{
			HWND hSimple = GetDlgItem( hWnd, 1001 );
			HWND hDropDown = GetDlgItem( hWnd, 1002 );
			HWND hDropList = GetDlgItem( hWnd, 1003 );
			LRESULT nSel = SendMessage( hSimple,
								CB_GETCURSEL, 0, 0 );
			SendMessage(hDropDown,CB_SETCURSEL,nSel,0);
			SendMessage(hDropList,CB_SETCURSEL,nSel,0);
		}else if( HIWORD(wParam)==CBN_EDITCHANGE )
		{
			MessageBox(hWnd,"键盘输入内容有变化","Infor",
						MB_OK );
		}
		break;
	case ID_DATA:
		OnData( hWnd );//获取选择项的附加数据
		break;
	case ID_TEXT:
		OnText( hWnd );//获取选择项文本内容
		break;
	case ID_FIND:
		OnFind( hWnd );//匹配选项
		break;
	case ID_DELETE:
		OnDelete( hWnd );//删除选择项
		break;
	case ID_CLEAR:
		OnClear( hWnd );//清空选项
		break;
	case ID_ADD:
		OnAdd( hWnd );//添加选项
		break;
	}
}
Exemple #18
0
BOOL CALLBACK SetupDlgFunc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {

	switch (uMsg) {
	case WM_INITDIALOG:
		return InitDialog(hWnd);

	case WM_NOTIFY:
		OnNotify(hWnd, wParam, lParam);
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam))	{
		case IDOK:
			OnOK(hWnd);
			EndDialog(hWnd, IDOK);
			break;

		case IDCANCEL:
			EndDialog(hWnd, IDCANCEL);
			break;
		
		case IDC_ADD:		// アイテムの追加
			OnEdit(hWnd, TRUE);
			break;

		case IDC_MODIFY:	// アイテムの変更
			OnEdit(hWnd, FALSE);
			break;
		
		case IDC_DELETE:	// アイテムの削除
			OnDelete(hWnd);
			break;
		
		case IDC_OPENFILE:	// ファイルの参照
			OnOpenFile(hWnd);
			break;
		}
	}
	return FALSE;
}
HRESULT WpdObjectManagement::DispatchWpdMessage(
    _In_     REFPROPERTYKEY         Command,
    _In_     IPortableDeviceValues* pParams,
    _In_     IPortableDeviceValues* pResults)
{

    HRESULT hr = S_OK;

    if (hr == S_OK)
    {
        if (Command.fmtid != WPD_CATEGORY_OBJECT_MANAGEMENT)
        {
            hr = E_INVALIDARG;
            CHECK_HR(hr, "This object does not support this command category %ws",CComBSTR(Command.fmtid));
        }
    }

    if (hr == S_OK)
    {
        if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_ONLY.pid)
        {
            hr = OnCreateObjectWithPropertiesOnly(pParams, pResults);
            CHECK_HR(hr, "Failed to create object");
        }
        else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_DELETE_OBJECTS.pid)
        {
            hr = OnDelete(pParams, pResults);
            CHECK_HR(hr, "Failed to delete object");
        }
        else
        {
            hr = E_NOTIMPL;
            CHECK_HR(hr, "This object does not support this command id %d", Command.pid);
        }
    }

    return hr;
}
Exemple #20
0
	LookFeelPanel::LookFeelPanel()
	{
		mLayout = new MGUI_Layout(AllLookFeel::Instance()->GetPanel());

		mComboBox_WidgetType = new MGUI_ComboBox(AllLookFeel::Instance()->GetComboBox(), mLayout);
		mComboBox_WidgetType->SetRect(0, 0, 200, 24);
		mComboBox_WidgetType->SetAlign(MGUI_Align::HStretch);

		for (int i = 0; i < MGUI_WidgetType::Max; ++i)
		{
			mComboBox_WidgetType->Append(MGUI_WidgetType::TypeString[i].c_wstr());
		}

		mListBox_LookFeel = new MGUI_ListBox(AllLookFeel::Instance()->GetListBox(), mLayout);
		mListBox_LookFeel->SetAlign(MGUI_Align::HStretch);
		mListBox_LookFeel->SetRect(0, 24, 0, 24 + 256);
		
		MGUI_Button * bnCreate = new MGUI_Button(AllLookFeel::Instance()->GetButton(), mLayout);
		bnCreate->SetAlign(MGUI_Align::HStretch);
		bnCreate->SetRect(MGUI_Rect(true, 0, 24 + 256 + 5, 0, 30));
		bnCreate->SetCaption(L"Create");

		MGUI_Button * bnDelete = new MGUI_Button(AllLookFeel::Instance()->GetButton(), mLayout);
		bnDelete->SetAlign(MGUI_Align::HStretch);
		bnDelete->SetRect(MGUI_Rect(true, 0, 24 + 256 + 5 + 30 + 5, 0, 30));
		bnDelete->SetCaption(L"Delete");

		MGUI_Button * bnRename = new MGUI_Button(AllLookFeel::Instance()->GetButton(), mLayout);
		bnRename->SetAlign(MGUI_Align::HStretch);
		bnRename->SetRect(MGUI_Rect(true, 0, 24 + 256 + 5 + 30 + 5 + 30 + 5, 0, 30));
		bnRename->SetCaption(L"Rename");

		mComboBox_WidgetType->eventSelectChanged += OnWidgetTypeChanged(this, &LookFeelPanel::OnWidgetTypeChanged_);
		mListBox_LookFeel->eventSelectChanged += OnLookFeelChanged(this, &LookFeelPanel::OnLookFeelChanged_);

		bnCreate->eventMouseClick += OnCreate(this, &LookFeelPanel::OnCreate_);
		bnDelete->eventMouseClick += OnDelete(this, &LookFeelPanel::OnDelete_);
	}
Exemple #21
0
void OnCommand(HWND hWnd,WPARAM wParam){
	switch(LOWORD(wParam)){
	case 1001:
		if(HIWORD(wParam) == CBN_SELCHANGE){
			HWND hSimple = GetDlgItem(hWnd,1001);
			HWND hDropDown = GetDlgItem(hWnd,1002);
			HWND hDropList = GetDlgItem(hWnd,1003);
			LRESULT nRet = SendMessage(hSimple,CB_GETCURSEL,0,0);
			SendMessage(hDropDown,CB_SETCURSEL,nRet,0);
			SendMessage(hDropList,CB_SETCURSEL,nRet,0);
		}
		else if(HIWORD(wParam) == CBN_EDITCHANGE ){
			MessageBox(hWnd,"Keyboard Input changes","Info",MB_OK);
		}
		break;
	case ID_DATA:
		OnData(hWnd);
		break;
	case ID_DIR:
		OnDir(hWnd);
		break;
	case ID_TEXT:
		OnText(hWnd);
		break;
	case ID_FIND:
		OnFind(hWnd);
		break;
	case ID_ADD:
		OnAdd(hWnd);
		break;
	case ID_CLEAN:
		OnClean(hWnd);
		break;
	case ID_DELETE:
		OnDelete(hWnd);
		break;
	}
}
Exemple #22
0
int KUiTaskNote_System::WndProc(unsigned int uMsg, unsigned int uParam, int nParam)
{
	int nResult = 0;
	switch (uMsg)
	{
	case WND_N_LIST_ITEM_SEL:
		if (uParam == (unsigned int)(KWndWindow*)&m_RecordList)
			m_BtnDelete.Enable(nParam >= 0);
		nResult = 1;
		break;
	case WND_N_BUTTON_CLICK:
		if (uParam == (unsigned int)(KWndWindow*)&m_BtnDelete)
		{
			OnDelete(m_RecordList.GetMessageListBox()->GetCurSel());
			nResult = 1;
		}
		break;
	default:
		nResult = KWndPage::WndProc(uMsg, uParam, nParam);
		break;
	}
	return nResult;
}
Exemple #23
0
// unfortunately, under GTK we won't get the original wxKeyEvent
// to reset m_metaDown
void frmMain::OnTreeKeyDown(wxTreeEvent &event)
{
	int keyCode = event.GetKeyCode();
	switch (keyCode)
	{
		case WXK_F1:
			OnHelp(event);
			break;
		case WXK_F5:
			Refresh(currentObject);
			break;
		case WXK_DELETE:
			OnDelete(event);
			break;
			// Is tempting to write all cases(this handler) in tree control itself
		case WXK_LEFT:
		case WXK_RIGHT:
			browser->NavigateTree(keyCode);
			break;
		default:
			event.Skip();
			break;
	}
}
CObject::~CObject()
{
	// Tell the streamer to delete us
	OnDelete();
}
Exemple #25
0
/**************************************************************************
IContextMenu::InvokeCommand
	Carries out the command associated with a shortcut menu item.

Parameters
	pici	Pointer to a CMINVOKECOMMANDINFO or CMINVOKECOMMANDINFOEX
			structure containing information about the command.
			For further details, see the Remarks section. 

Return Value
	Returns NOERROR if successful, or an OLE-defined error value otherwise.
**************************************************************************/
STDMETHODIMP CContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
{
	if(HIWORD(lpcmi->lpVerb))
	{
		//the command is being sent via a verb
		return NOERROR;
	}
	
	if(LOWORD(lpcmi->lpVerb) > IDM_LAST)
		return m_pContextMenu->InvokeCommand(lpcmi);
		//return ResultFromScode(E_INVALIDARG);

	switch(LOWORD(lpcmi->lpVerb))
	{
	case IDM_EXPLORE:
	case IDM_OPEN:
		OnOpenFolder(lpcmi);
		break;
		
	case IDM_RENAME:
		break;
	
	case IDM_EXECUTE:
		OnExecute();
		break;
	
	case IDM_CREATE_FOLDER:
		OnCreateNewFolder();
		break;
	
	case IDM_DELETE_FOLDER:
		OnDelete();
		break;

	case IDM_PROPERTIES:
		OnShowProperties();
		break;

	case IDM_ADDEXTFOLDER:
		OnCreateExtensionFolder();
		break;

	case IDM_HIDEEXTENSION:
		OnHideExtension();
		break;

	case IDM_SHOWONLYEXTENSION:
		OnShowOnlyExtension();
		break;

	case IDM_OPENCONTAININGFOLDER1:
		OnOpenContainingFolder();
		break;

	case IDM_CLEARSEARCH:
		OnClearSearch();
		break;

//	default:
//		return m_pContextMenu->InvokeCommand(lpcmi);
	}
	
	return NOERROR;
}
qtDLGNanomite::qtDLGNanomite(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags),
	m_IsRestart(false)
{
	setupUi(this);

	setAcceptDrops(true);

	QApplication::setStyle(new QPlastiqueStyle);
	QFontDatabase::addApplicationFont(":/Fonts/Fonts/consola.ttf");
	this->setStyleSheet(clsHelperClass::LoadStyleSheet());

	qRegisterMetaType<DWORD>("DWORD");
	qRegisterMetaType<quint64>("quint64");
	qRegisterMetaType<BPStruct>("BPStruct");
	qRegisterMetaType<HANDLE>("HANDLE");

	clsAPIImport::LoadFunctions();

	coreBPManager	= new clsBreakpointManager;
	coreDebugger	= new clsDebugger(coreBPManager);
	coreDisAs		= new clsDisassembler;
	PEManager		= new clsPEManager;
	dlgDetInfo		= new qtDLGDetailInfo(this,Qt::Window);
	dlgDbgStr		= new qtDLGDebugStrings(this,Qt::Window);
	dlgBPManager	= new qtDLGBreakPointManager(this,Qt::Window);
	dlgTraceWindow	= new qtDLGTrace(this,Qt::Window);
	dlgPatchManager = new qtDLGPatchManager(this,Qt::Window);
	dlgBookmark		= new qtDLGBookmark(this, Qt::Window);
	qtNanomiteDisAsColor = new qtNanomiteDisAsColorSettings;	

	qtDLGMyWindow = this;
	lExceptionCount = 0;

	LoadWidgets();

	settings->CheckIfFirstRun();
	settings->LoadDebuggerSettings(coreDebugger);
	settings->LoadDisassemblerColor(qtNanomiteDisAsColor);
	settings->LoadRecentDebuggedFiles(m_recentDebuggedFiles);
	
	LoadRecentFileMenu(true);

	DisAsGUI = new qtDLGDisassembler(this);
	this->setCentralWidget(DisAsGUI);

	// Callbacks from Debugger Thread to GUI
	connect(coreDebugger,SIGNAL(OnThread(DWORD,DWORD,quint64,bool,DWORD,bool)),
		dlgDetInfo,SLOT(OnThread(DWORD,DWORD,quint64,bool,DWORD,bool)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(OnPID(DWORD,QString,DWORD,quint64,bool)),
		dlgDetInfo,SLOT(OnPID(DWORD,QString,DWORD,quint64,bool)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(OnException(QString,QString,quint64,quint64,DWORD,DWORD)),
		dlgDetInfo,SLOT(OnException(QString,QString,quint64,quint64,DWORD,DWORD)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(OnDbgString(QString,DWORD)),
		dlgDbgStr,SLOT(OnDbgString(QString,DWORD)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(OnDll(QString,DWORD,quint64,bool)),
		dlgDetInfo,SLOT(OnDll(QString,DWORD,quint64,bool)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(OnLog(QString)),
		logView,SLOT(OnLog(QString)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(AskForException(DWORD)),this,SLOT(AskForException(DWORD)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(OnDebuggerBreak()),this,SLOT(OnDebuggerBreak()),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(OnDebuggerTerminated()),this,SLOT(OnDebuggerTerminated()),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(OnNewPID(QString,int)),dlgBPManager,SLOT(UpdateCompleter(QString,int)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(OnNewPID(QString,int)),dlgBookmark,SLOT(UpdateBookmarks(QString,int)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(UpdateOffsetsPatches(HANDLE,int)),dlgPatchManager,SLOT(UpdateOffsetPatch(HANDLE,int)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(UpdateOffsetsPatches(HANDLE,int)),dlgBookmark,SLOT(BookmarkUpdateOffsets(HANDLE,int)),Qt::QueuedConnection);

	connect(coreBPManager,SIGNAL(OnBreakpointAdded(BPStruct,int)),dlgBPManager,SLOT(OnUpdate(BPStruct,int)),Qt::QueuedConnection);
	connect(coreBPManager,SIGNAL(OnBreakpointDeleted(quint64)),dlgBPManager,SLOT(OnDelete(quint64)),Qt::QueuedConnection);

	// Callbacks from Debugger to PEManager
	connect(coreDebugger,SIGNAL(OnNewPID(QString,int)),PEManager,SLOT(InsertPIDForFile(QString,int)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(DeletePEManagerObject(QString,int)),PEManager,SLOT(CloseFile(QString,int)),Qt::QueuedConnection);
	connect(coreDebugger,SIGNAL(CleanPEManager()),PEManager,SLOT(CleanPEManager()),Qt::QueuedConnection);

	// Actions for the MainMenu and Toolbar
	connect(actionFile_OpenNew, SIGNAL(triggered()), this, SLOT(action_FileOpenNewFile()));
	connect(actionFile_AttachTo, SIGNAL(triggered()), this, SLOT(action_FileAttachTo()));
	connect(actionFile_Detach, SIGNAL(triggered()), this, SLOT(action_FileDetach()));
	connect(actionFile_Exit, SIGNAL(triggered()), this, SLOT(action_FileTerminateGUI()));
	connect(actionFile_Load, SIGNAL(triggered()), this, SLOT(action_FileLoad()));
	connect(actionFile_Save, SIGNAL(triggered()), this, SLOT(action_FileSave()));
	connect(actionDebug_Start, SIGNAL(triggered()), this, SLOT(action_DebugStart()));
	connect(actionDebug_Stop, SIGNAL(triggered()), this, SLOT(action_DebugStop()));
	connect(actionDebug_Restart, SIGNAL(triggered()), this, SLOT(action_DebugRestart()));
	connect(actionDebug_Suspend, SIGNAL(triggered()), this, SLOT(action_DebugSuspend()));
	connect(actionDebug_Step_In, SIGNAL(triggered()), this, SLOT(action_DebugStepIn()));
	connect(actionDebug_Step_Out, SIGNAL(triggered()), this, SLOT(action_DebugStepOut()));
	connect(actionDebug_Step_Over, SIGNAL(triggered()), this, SLOT(action_DebugStepOver()));
	connect(actionOptions_About, SIGNAL(triggered()), this, SLOT(action_OptionsAbout()));
	connect(actionOptions_Options, SIGNAL(triggered()), this, SLOT(action_OptionsOptions()));
	connect(actionOptions_Update, SIGNAL(triggered()), this, SLOT(action_OptionsUpdate()));
	connect(actionWindow_Detail_Information, SIGNAL(triggered()), this, SLOT(action_WindowDetailInformation()));
	connect(actionWindow_Breakpoint_Manager, SIGNAL(triggered()), this, SLOT(action_WindowBreakpointManager()));
	connect(actionWindow_Show_Patches, SIGNAL(triggered()), this, SLOT(action_WindowPatches()));
	connect(actionWindow_Show_Memory, SIGNAL(triggered()), this, SLOT(action_WindowShowMemory()));
	connect(actionWindow_Show_Heap, SIGNAL(triggered()), this, SLOT(action_WindowShowHeap()));
	connect(actionWindow_Show_Strings, SIGNAL(triggered()), this, SLOT(action_WindowShowStrings()));
	connect(actionWindow_Show_Debug_Output, SIGNAL(triggered()), this, SLOT(action_WindowShowDebugOutput()));
	connect(actionWindow_Show_Handles, SIGNAL(triggered()), this, SLOT(action_WindowShowHandles()));
	connect(actionWindow_Show_Windows, SIGNAL(triggered()), this, SLOT(action_WindowShowWindows()));
	connect(actionWindow_Show_Functions, SIGNAL(triggered()), this, SLOT(action_WindowShowFunctions()));
	connect(actionWindow_Show_Privileges, SIGNAL(triggered()), this, SLOT(action_WindowShowPrivileges()));
	connect(actionWindow_Show_Bookmarks, SIGNAL(triggered()), this, SLOT(action_WindowShowBookmarks()));
	connect(action_Debug_Run_to_UserCode,SIGNAL(triggered()), this, SLOT(action_DebugRunToUserCode()));
	connect(actionDebug_Trace_Start, SIGNAL(triggered()), this, SLOT(action_DebugTraceStart()));
	connect(actionDebug_Trace_Stop, SIGNAL(triggered()), this, SLOT(action_DebugTraceStop()));
	connect(actionDebug_Trace_Show, SIGNAL(triggered()), this, SLOT(action_DebugTraceShow()));
	connect(actionWindow_Show_PEEditor, SIGNAL(triggered()), this, SLOT(action_WindowShowPEEditor()));

	// Callbacks to display disassembly
	connect(dlgTraceWindow,SIGNAL(OnDisplayDisassembly(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64)));
	connect(cpuRegView,SIGNAL(OnDisplayDisassembly(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64)));
	connect(dlgDetInfo,SIGNAL(ShowInDisassembler(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64)));
	connect(coreDisAs,SIGNAL(DisAsFinished(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64)),Qt::QueuedConnection);
	connect(dlgBPManager,SIGNAL(OnDisplayDisassembly(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64)));
	connect(dlgBookmark,SIGNAL(ShowInDisassembler(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64)));

	// Callbacks from PatchManager to GUI
	connect(dlgPatchManager,SIGNAL(OnReloadDebugger()),this,SLOT(OnDebuggerBreak()));

	// Callbacks from Disassembler GUI to GUI
	connect(DisAsGUI,SIGNAL(OnDebuggerBreak()),this,SLOT(OnDebuggerBreak()));

	// Callbacks to StateBar
	connect(dlgTraceWindow,SIGNAL(OnUpdateStatusBar(int,quint64)),this,SLOT(UpdateStateBar(int,quint64)));

	actionDebug_Trace_Stop->setDisabled(true);

	ParseCommandLineArgs();
}
HRESULT WpdObjectManagement::DispatchWpdMessage(
    const PROPERTYKEY&      Command,
    IPortableDeviceValues*  pParams,
    IPortableDeviceValues*  pResults)
{

    HRESULT hr = S_OK;

    if (hr == S_OK)
    {
        if (Command.fmtid != WPD_CATEGORY_OBJECT_MANAGEMENT)
        {
            hr = E_INVALIDARG;
            CHECK_HR(hr, "This object does not support this command category %ws",CComBSTR(Command.fmtid));
        }
    }

    if (hr == S_OK)
    {
        if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_DELETE_OBJECTS.pid)
        {
            hr = OnDelete(pParams, pResults);
            CHECK_HR(hr, "Failed to delete object");
        }
        else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_ONLY.pid)
        {
            hr = OnCreateObjectWithPropertiesOnly(pParams, pResults);
            CHECK_HR(hr, "Failed to create object");
        }
        else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_AND_DATA.pid)
        {
            hr = OnCreateObjectWithPropertiesAndData(pParams, pResults);
            CHECK_HR(hr, "Failed to create object");
        }
        else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_WRITE_OBJECT_DATA.pid)
        {
            hr = OnWriteObjectData(pParams, pResults);
            CHECK_HR(hr, "Failed to write object data");
        }
        else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_COMMIT_OBJECT.pid)
        {
            hr = OnCommit(pParams, pResults);
            CHECK_HR(hr, "Failed to commit object");
        }
        else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_REVERT_OBJECT.pid)
        {
            hr = OnRevert(pParams, pResults);
            CHECK_HR(hr, "Failed to revert object");
        }
        else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_MOVE_OBJECTS.pid)
        {
            hr = OnMove(pParams, pResults);
            CHECK_HR(hr, "Failed to Move objects");
        }
        else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_COPY_OBJECTS.pid)
        {
            hr = OnCopy(pParams, pResults);
            CHECK_HR(hr, "Failed to Copy objects");
        }
        else if (Command.pid == WPD_COMMAND_OBJECT_MANAGEMENT_UPDATE_OBJECT_WITH_PROPERTIES_AND_DATA.pid)
        {
            hr = OnUpdateObjectWithPropertiesAndData(pParams, pResults);
            CHECK_HR(hr, "Failed to update object");
        }
        else
        {
            hr = E_NOTIMPL;
            CHECK_HR(hr, "This object does not support this command id %d", Command.pid);
        }
    }

    return hr;
}
CPickup::~CPickup()
{
	// Tell the streamer to delete us
	OnDelete();
}
Exemple #29
0
/*-------------------------------------------
  dialog procedure
---------------------------------------------*/
INT_PTR CALLBACK DlgProcTimer(HWND hDlg, UINT message,
	WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{
		case WM_INITDIALOG:
			OnInit(hDlg);
			return TRUE;
		case WM_COMMAND:
		{
			int id, code;
			id = LOWORD(wParam); code = HIWORD(wParam);
			switch(id)
			{
				case IDC_TIMERNAME:
					if(code == CBN_SELCHANGE)
						OnName(hDlg);
					else if(code == CBN_DROPDOWN)
						OnNameDropDown(hDlg);
					break;
				case IDC_TIMERADD:
					OnAdd(hDlg);
					break;
				case IDC_TIMERDEL:
					OnDelete(hDlg);
					break;
				case IDC_TIMERSANSHO:
					OnBrowse(hDlg);
					break;
				case IDC_TIMERTEST:
					OnTest(hDlg);
					break;
				case IDC_SHOWTIME:
					OnShowTime(hDlg);
					break;
				case IDC_SHOWWHOLE:
				case IDC_SHOWADD:
				case IDC_SHOWUSTR:
					OnUserStr(hDlg);
					break;
				case IDOK:
					OnOK(hDlg);
					break;
				case IDCANCEL:
					OnCancel(hDlg);
					break;
				case IDC_TIMERHELP:
					OnHelp(hDlg);
					break;
			}
			return TRUE;
		}
		// playing sound ended
		case MM_MCINOTIFY:
		case MM_WOM_DONE:
			if(message == MM_MCINOTIFY)
				OnMCINotify(hDlg, wParam, (LONG)lParam);
			else
				StopFile();
			m_bPlaying = FALSE;
			SendDlgItemMessage(hDlg, IDC_TIMERTEST,
				BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_hIconPlay);
			return TRUE;
		case WM_DESTROY:
			OnDestroy(hDlg);
			break;
	}
	return FALSE;
}
Exemple #30
0
HRESULT WpdObjectResources::DispatchWpdMessage(
    const PROPERTYKEY&     Command,
    IPortableDeviceValues* pParams,
    IPortableDeviceValues* pResults)
{

    HRESULT hr = S_OK;

    if (hr == S_OK)
    {
        if (Command.fmtid != WPD_CATEGORY_OBJECT_RESOURCES)
        {
            hr = E_INVALIDARG;
            CHECK_HR(hr, "This object does not support this command category %ws",CComBSTR(Command.fmtid));
        }
    }

    if (hr == S_OK)
    {
        if (IsEqualPropertyKey(Command, WPD_COMMAND_OBJECT_RESOURCES_GET_SUPPORTED))
        {
            hr = OnGetSupportedResources(pParams, pResults);
            CHECK_HR(hr, "Failed to get supported resources");
        }
        else if(IsEqualPropertyKey(Command, WPD_COMMAND_OBJECT_RESOURCES_GET_ATTRIBUTES))
        {
            hr = OnGetAttributes(pParams, pResults);
            if(FAILED(hr))
            {
                CHECK_HR(hr, "Failed to get resource attributes");
            }
        }
        else if(IsEqualPropertyKey(Command, WPD_COMMAND_OBJECT_RESOURCES_OPEN))
        {
            hr = OnOpen(pParams, pResults);
            CHECK_HR(hr, "Failed to open resource");
        }
        else if(IsEqualPropertyKey(Command, WPD_COMMAND_OBJECT_RESOURCES_READ))
        {
            hr = OnRead(pParams, pResults);
            CHECK_HR(hr, "Failed to read resource data");
        }
        else if(IsEqualPropertyKey(Command, WPD_COMMAND_OBJECT_RESOURCES_WRITE))
        {
            hr = OnWrite(pParams, pResults);
            CHECK_HR(hr, "Failed to write resource data");
        }
        else if(IsEqualPropertyKey(Command, WPD_COMMAND_OBJECT_RESOURCES_CLOSE))
        {
            hr = OnClose(pParams, pResults);
            CHECK_HR(hr, "Failed to close resource");
        }
        else if(IsEqualPropertyKey(Command, WPD_COMMAND_OBJECT_RESOURCES_DELETE))
        {
            hr = OnDelete(pParams, pResults);
            CHECK_HR(hr, "Failed to delete resources");
        }
        else if(IsEqualPropertyKey(Command, WPD_COMMAND_OBJECT_RESOURCES_CREATE_RESOURCE))
        {
            hr = OnCreate(pParams, pResults);
            CHECK_HR(hr, "Failed to create resource");
        }
        else if(IsEqualPropertyKey(Command, WPD_COMMAND_OBJECT_RESOURCES_REVERT))
        {
            hr = OnRevert(pParams, pResults);
            CHECK_HR(hr, "Failed to revert resource operation");
        }
        else if(IsEqualPropertyKey(Command, WPD_COMMAND_OBJECT_RESOURCES_SEEK))
        {
            hr = OnSeek(pParams, pResults);
            CHECK_HR(hr, "Failed resource seek operation");
        }
        else
        {
            hr = E_NOTIMPL;
            CHECK_HR(hr, "This object does not support this command id %d", Command.pid);
        }
    }
    return hr;
}