Exemplo n.º 1
0
BOOL COXShortkeysOrganizer::AddAccelerator(ACCEL* pAccel, 
										   CMultiDocTemplate* pDocTemplate,
										   BOOL bIgnoreConflict/*=FALSE*/)
{
	ASSERT(pAccel!=NULL);
	return AddAccelerator(pAccel->fVirt,pAccel->key,pAccel->cmd,
		pDocTemplate,bIgnoreConflict);
}
Exemplo n.º 2
0
/***********************************
**
**  Adds a new keyboard accelerator.
**
**  Macro returns:
**
**     No macro return value.
**
**  Function returns:
**
**      TRUE: No parsing error.
**     FALSE: Parsing error.
**
***********************************/
BOOL CALLBACK AddAcceleratorMacroProc
( 
  HMACROENGINE hMacroEngine, 
  HGLOBAL hAppData, 
  HGLOBAL hMacroData, 
  MACRORETVAL __far * MacroRetValPtr 
)
{
  HLPMACRODATAPTR HelpMacroDataPtr;
  HWND  hDataWnd;
  
  WORD wKey, wShiftState;
  char szMacro[ MAX_MACRO_STRING ];
  
   
  /* Lock app. data. */
  HelpMacroDataPtr = ( HLPMACRODATAPTR ) GlobalLock( hAppData );
      
  /* Get data window's handle. */
  hDataWnd = HelpMacroDataPtr->hDataWnd;

  /* Unlock app. data. */
  GlobalUnlock( hAppData );
      
  /* Get the accelerator's key. */
  if( ! GetNextMacroArg( hDataWnd, hMacroEngine, &wKey, MACRO_UNSIGNEDSHORTINT) )
  {
    /* Macro syntax error. */
    return( FALSE );
  }
  
  /* Get the accelerator's shift state. */
  if( ! GetNextMacroArg( hDataWnd, hMacroEngine, &wShiftState, MACRO_UNSIGNEDSHORTINT) )
  {
    /* Macro syntax error. */
    return( FALSE );
  }
  
  /* Get the accelerator's macro argument. */
  if( ! GetNextMacroArg( hDataWnd, hMacroEngine, szMacro, MACRO_STRING) )
  {
    /* Macro syntax error. */
    return( FALSE );
  }
  
  /* Create the new accelerator. */
  AddAccelerator( hDataWnd, wKey, wShiftState, (LPSTR) szMacro );

  /* No macro syntax errors. */
  return( TRUE );
}
Exemplo n.º 3
0
 void NativeButton::SetIsDefault(bool is_default)
 {
     if(is_default == is_default_)
     {
         return;
     }
     if(is_default)
     {
         AddAccelerator(Accelerator(VKEY_RETURN, false, false, false));
     }
     else
     {
         RemoveAccelerator(Accelerator(VKEY_RETURN, false, false, false));
     }
     SetAppearsAsDefault(is_default);
 }
Exemplo n.º 4
0
 void DialogClientView::ShowDialogButtons()
 {
     DialogDelegate* dd = GetDialogDelegate();
     int buttons = dd->GetDialogButtons();
     if(buttons & ui::MessageBoxFlags::DIALOGBUTTON_OK && !ok_button_)
     {
         std::wstring label = dd->GetDialogButtonLabel(
             ui::MessageBoxFlags::DIALOGBUTTON_OK);
         if(label.empty())
         {
             label = UTF16ToWide(ui::GetStringUTF16(IDS_APP_OK));
         }
         bool is_default_button = (dd->GetDefaultDialogButton() &
             ui::MessageBoxFlags::DIALOGBUTTON_OK) != 0;
         ok_button_ = new DialogButton(this, GetWidget(),
             ui::MessageBoxFlags::DIALOGBUTTON_OK, label, is_default_button);
         ok_button_->SetGroup(kButtonGroup);
         if(is_default_button)
         {
             default_button_ = ok_button_;
         }
         if(!(buttons & ui::MessageBoxFlags::DIALOGBUTTON_CANCEL))
         {
             ok_button_->AddAccelerator(Accelerator(ui::VKEY_ESCAPE,
                 false, false, false));
         }
         AddChildView(ok_button_);
     }
     if(buttons & ui::MessageBoxFlags::DIALOGBUTTON_CANCEL && !cancel_button_)
     {
         std::wstring label = dd->GetDialogButtonLabel(
             ui::MessageBoxFlags::DIALOGBUTTON_CANCEL);
         if(label.empty())
         {
             if(buttons & ui::MessageBoxFlags::DIALOGBUTTON_OK)
             {
                 label = UTF16ToWide(ui::GetStringUTF16(IDS_APP_CANCEL));
             }
             else
             {
                 label = UTF16ToWide(ui::GetStringUTF16(IDS_APP_CLOSE));
             }
         }
         bool is_default_button = (dd->GetDefaultDialogButton() &
             ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) != 0;
         cancel_button_ = new DialogButton(this, GetWidget(),
             ui::MessageBoxFlags::DIALOGBUTTON_CANCEL,
             label, is_default_button);
         cancel_button_->SetGroup(kButtonGroup);
         cancel_button_->AddAccelerator(Accelerator(ui::VKEY_ESCAPE,
             false, false, false));
         if(is_default_button)
         {
             default_button_ = ok_button_;
         }
         AddChildView(cancel_button_);
     }
     if(!buttons)
     {
         // Register the escape key as an accelerator which will close the window
         // if there are no dialog buttons.
         AddAccelerator(Accelerator(ui::VKEY_ESCAPE, false, false, false));
     }
 }