зеркало из https://github.com/mozilla/pjs.git
r=pedemont, sr=blizzard, a=asa OS/2 only - rewrite cursor code - support crosshair
This commit is contained in:
Родитель
8493126f3e
Коммит
02b7d36a77
|
@ -89,7 +89,7 @@ void nsWidgetModuleData::Init( nsIAppShell *aPrimaevalAppShell)
|
|||
// Both combobox and (atm) nsBrowserWindow depend on this.
|
||||
lHtEntryfield = 26;
|
||||
|
||||
hptrSelect = hptrFrameIcon = 0;
|
||||
hptrFrameIcon = 0;
|
||||
idSelect = 0;
|
||||
|
||||
// Work out if the system is DBCS
|
||||
|
@ -113,6 +113,10 @@ void nsWidgetModuleData::Init( nsIAppShell *aPrimaevalAppShell)
|
|||
#if 0
|
||||
mWindows = nsnull;
|
||||
#endif
|
||||
|
||||
for (int i=0;i<=16;i++ ) {
|
||||
hptrArray[i] = ::WinLoadPointer(HWND_DESKTOP, gModuleHandle, IDC_BASE+i);
|
||||
}
|
||||
}
|
||||
|
||||
nsWidgetModuleData::~nsWidgetModuleData()
|
||||
|
@ -127,8 +131,10 @@ nsWidgetModuleData::~nsWidgetModuleData()
|
|||
for( PRInt32 i = 0; i < cAtoms; i++)
|
||||
WinDeleteAtom( systbl, (ATOM) atoms.ElementAt(i));
|
||||
|
||||
if( hptrSelect)
|
||||
WinDestroyPointer( hptrSelect);
|
||||
for (i=0;i<=16;i++ ) {
|
||||
WinDestroyPointer(hptrArray[i]);
|
||||
}
|
||||
|
||||
if( hptrFrameIcon)
|
||||
WinDestroyPointer( hptrFrameIcon);
|
||||
#if 0
|
||||
|
@ -142,64 +148,11 @@ nsWidgetModuleData::~nsWidgetModuleData()
|
|||
NS_IF_RELEASE(appshell);
|
||||
}
|
||||
|
||||
HPOINTER nsWidgetModuleData::GetPointer( nsCursor aCursor)
|
||||
{
|
||||
ULONG idPtr = 0;
|
||||
|
||||
switch( aCursor)
|
||||
{
|
||||
case eCursor_hyperlink: idPtr = ID_PTR_SELECTURL ; break;
|
||||
case eCursor_arrow_north: idPtr = ID_PTR_ARROWNORTH ; break;
|
||||
case eCursor_arrow_north_plus: idPtr = ID_PTR_ARROWNORTHP; break;
|
||||
case eCursor_arrow_south: idPtr = ID_PTR_ARROWSOUTH ; break;
|
||||
case eCursor_arrow_south_plus: idPtr = ID_PTR_ARROWSOUTHP; break;
|
||||
case eCursor_arrow_west: idPtr = ID_PTR_ARROWWEST ; break;
|
||||
case eCursor_arrow_west_plus: idPtr = ID_PTR_ARROWWESTP ; break;
|
||||
case eCursor_arrow_east: idPtr = ID_PTR_ARROWEAST ; break;
|
||||
case eCursor_arrow_east_plus: idPtr = ID_PTR_ARROWEASTP ; break;
|
||||
case eCursor_copy: idPtr = ID_PTR_COPY ; break;
|
||||
case eCursor_alias: idPtr = ID_PTR_ALIAS ; break;
|
||||
case eCursor_cell: idPtr = ID_PTR_CELL ; break;
|
||||
case eCursor_grab: idPtr = ID_PTR_GRAB ; break;
|
||||
case eCursor_grabbing: idPtr = ID_PTR_GRABBING ; break;
|
||||
case eCursor_spinning: idPtr = ID_PTR_ARROWWAIT ; break;
|
||||
|
||||
case eCursor_crosshair:
|
||||
case eCursor_help:
|
||||
case eCursor_context_menu:
|
||||
case eCursor_count_up:
|
||||
case eCursor_count_down:
|
||||
case eCursor_count_up_down:
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_ASSERTION( 0, "Unknown cursor type");
|
||||
break;
|
||||
}
|
||||
|
||||
if( idPtr == 0)
|
||||
{
|
||||
idPtr = ID_PTR_SELECTURL; // default to hyperlink cursor?
|
||||
#ifdef DEBUG
|
||||
printf( "\n*** Need to implement cursor type %d (see widget/src/os2/nsModule.cpp)\n\n", (int) aCursor);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Use an array and indices here since we have all the pointers in place?
|
||||
if( idSelect != idPtr)
|
||||
{
|
||||
idSelect = idPtr;
|
||||
hptrSelect = WinLoadPointer( HWND_DESKTOP, hModResources, idSelect);
|
||||
}
|
||||
|
||||
return hptrSelect;
|
||||
}
|
||||
|
||||
HPOINTER nsWidgetModuleData::GetFrameIcon()
|
||||
{
|
||||
if( !hptrFrameIcon)
|
||||
hptrFrameIcon = WinLoadPointer( HWND_DESKTOP,
|
||||
hModResources, ID_ICO_FRAME);
|
||||
gModuleHandle, ID_ICO_FRAME);
|
||||
return hptrFrameIcon;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ class nsWidgetModuleData : public nsISupports
|
|||
BOOL bMouseSwitched; // true if MB1 is the RH mouse button
|
||||
LONG lHtEntryfield; // ideal height of an entryfield
|
||||
BOOL bIsDBCS; // true if system is dbcs
|
||||
HPOINTER hptrArray[17];
|
||||
|
||||
// xptoolkit services we look after, & the primaeval appshell too.
|
||||
nsDragService *dragService;
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#ifdef DEBUG_sobotka
|
||||
static int WINDOWCOUNT = 0;
|
||||
#endif
|
||||
|
@ -1372,7 +1374,6 @@ NS_METHOD nsWindow::SetFont(const nsFont &aFont)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this component cursor
|
||||
|
@ -1381,61 +1382,126 @@ NS_METHOD nsWindow::SetFont(const nsFont &aFont)
|
|||
|
||||
NS_METHOD nsWindow::SetCursor(nsCursor aCursor)
|
||||
{
|
||||
// Only change cursor if it's changing
|
||||
HPOINTER newPointer = NULLHANDLE;
|
||||
|
||||
switch(aCursor) {
|
||||
case eCursor_select:
|
||||
newPointer = ::WinQuerySysPointer(HWND_DESKTOP, SPTR_TEXT, FALSE);
|
||||
break;
|
||||
|
||||
case eCursor_wait:
|
||||
newPointer = ::WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE);
|
||||
break;
|
||||
|
||||
case eCursor_hyperlink:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_SELECTANCHOR-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_standard:
|
||||
newPointer = ::WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE);
|
||||
break;
|
||||
|
||||
case eCursor_sizeWE:
|
||||
newPointer = ::WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZEWE, FALSE);
|
||||
break;
|
||||
|
||||
case eCursor_sizeNS:
|
||||
newPointer = ::WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZENS, FALSE);
|
||||
break;
|
||||
|
||||
case eCursor_sizeNW:
|
||||
case eCursor_sizeSE:
|
||||
newPointer = ::WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZENWSE, FALSE);
|
||||
break;
|
||||
|
||||
case eCursor_sizeNE:
|
||||
case eCursor_sizeSW:
|
||||
newPointer = ::WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZENESW, FALSE);
|
||||
break;
|
||||
|
||||
case eCursor_arrow_north:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_ARROWNORTH-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_arrow_north_plus:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_ARROWNORTHPLUS-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_arrow_south:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_ARROWSOUTH-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_arrow_south_plus:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_ARROWSOUTHPLUS-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_arrow_east:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_ARROWEAST-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_arrow_east_plus:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_ARROWEASTPLUS-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_arrow_west:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_ARROWWEST-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_arrow_west_plus:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_ARROWWESTPLUS-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_crosshair:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_CROSS-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_move:
|
||||
newPointer = ::WinQuerySysPointer(HWND_DESKTOP, SPTR_MOVE, FALSE);
|
||||
break;
|
||||
|
||||
case eCursor_help:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_HELP-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_copy: // CSS3
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_COPY-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_alias:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_ALIAS-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_cell:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_CELL-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_grab:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_GRAB-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_grabbing:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_GRABBING-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_spinning:
|
||||
newPointer = gWidgetModuleData->hptrArray[IDC_ARROWWAIT-IDC_BASE];
|
||||
break;
|
||||
|
||||
case eCursor_context_menu:
|
||||
case eCursor_count_up:
|
||||
case eCursor_count_down:
|
||||
case eCursor_count_up_down:
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_ASSERTION(0, "Invalid cursor type");
|
||||
break;
|
||||
}
|
||||
|
||||
if (newPointer) {
|
||||
WinSetPointer(HWND_DESKTOP, newPointer);
|
||||
}
|
||||
|
||||
//XXX mCursor isn't always right. Scrollbars and others change it, too.
|
||||
//XXX If we want this optimization we need a better way to do it.
|
||||
//if (aCursor != mCursor) {
|
||||
ULONG sptr = 0;
|
||||
switch(aCursor) {
|
||||
// builtins
|
||||
case eCursor_standard: sptr = SPTR_ARROW; break;
|
||||
case eCursor_wait: sptr = SPTR_WAIT; break;
|
||||
case eCursor_select: sptr = SPTR_TEXT; break;
|
||||
case eCursor_sizeWE: sptr = SPTR_SIZEWE; break;
|
||||
case eCursor_sizeNS: sptr = SPTR_SIZENS; break;
|
||||
case eCursor_sizeNW: sptr = SPTR_SIZENWSE; break;
|
||||
case eCursor_sizeSE: sptr = SPTR_SIZENWSE; break;
|
||||
case eCursor_sizeNE: sptr = SPTR_SIZENESW; break;
|
||||
case eCursor_sizeSW: sptr = SPTR_SIZENESW; break;
|
||||
case eCursor_move: sptr = SPTR_MOVE; break;
|
||||
// custom
|
||||
case eCursor_hyperlink:
|
||||
case eCursor_arrow_north:
|
||||
case eCursor_arrow_north_plus:
|
||||
case eCursor_arrow_south:
|
||||
case eCursor_arrow_south_plus:
|
||||
case eCursor_arrow_west:
|
||||
case eCursor_arrow_west_plus:
|
||||
case eCursor_arrow_east:
|
||||
case eCursor_arrow_east_plus:
|
||||
case eCursor_crosshair:
|
||||
case eCursor_help:
|
||||
case eCursor_copy:
|
||||
case eCursor_alias:
|
||||
case eCursor_context_menu:
|
||||
case eCursor_cell:
|
||||
case eCursor_grab:
|
||||
case eCursor_grabbing:
|
||||
case eCursor_spinning:
|
||||
case eCursor_count_up:
|
||||
case eCursor_count_down:
|
||||
case eCursor_count_up_down:
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_ASSERTION(0, "Invalid cursor type");
|
||||
break;
|
||||
}
|
||||
|
||||
if( sptr)
|
||||
mPointer = WinQuerySysPointer( HWND_DESKTOP, sptr, FALSE);
|
||||
else
|
||||
mPointer = gWidgetModuleData->GetPointer( aCursor);
|
||||
|
||||
WinSetPointer( HWND_DESKTOP, mPointer);
|
||||
mCursor = aCursor;
|
||||
//}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1876,12 +1942,17 @@ PRBool nsWindow::OnKey( MPARAM mp1, MPARAM mp2)
|
|||
gWidgetModuleData->ConvertToUcs( (char *)inbuf, (PRUnichar *)outbuf, 4);
|
||||
|
||||
event.charCode = outbuf[0];
|
||||
|
||||
if( event.isControl && !event.isShift && event.charCode >= 'A' && event.charCode <= 'Z' )
|
||||
{
|
||||
event.charCode = tolower(event.charCode);
|
||||
}
|
||||
else if( !event.isControl && !event.isAlt && event.charCode != 0)
|
||||
if (event.isControl && !(fsFlags & (KC_VIRTUALKEY | KC_DEADKEY))) {
|
||||
if (!event.isShift && (event.charCode >= 'A' && event.charCode <= 'Z'))
|
||||
{
|
||||
event.charCode = tolower(event.charCode);
|
||||
}
|
||||
if (event.isShift && (event.charCode >= 'a' && event.charCode <= 'z'))
|
||||
{
|
||||
event.charCode = toupper(event.charCode);
|
||||
}
|
||||
event.keyCode = 0;
|
||||
} else if( !event.isControl && !event.isAlt && event.charCode != 0)
|
||||
{
|
||||
if ( !(fsFlags & KC_VIRTUALKEY) ||
|
||||
((fsFlags & KC_CHAR) && (event.keyCode == 0)) )
|
||||
|
@ -2169,7 +2240,9 @@ PRBool nsWindow::ProcessMessage( ULONG msg, MPARAM mp1, MPARAM mp2, MRESULT &rc)
|
|||
break;
|
||||
|
||||
case DM_DRAGOVER:
|
||||
result = OnDragOver( mp1, mp2, rc);
|
||||
rc = MRFROM2SHORT(DOR_DROP, DO_COPY);
|
||||
result = PR_TRUE;
|
||||
// result = OnDragOver( mp1, mp2, rc);
|
||||
break;
|
||||
|
||||
case DM_DRAGLEAVE:
|
||||
|
@ -2967,7 +3040,7 @@ PRBool nsWindow::OnDragLeave( MPARAM mp1, MPARAM mp2)
|
|||
PRBool nsWindow::OnDrop( MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
// gWidgetModuleData->dragService->InitDrop( (PDRAGINFO) mp1);
|
||||
// DispatchDragDropEvent( NS_DRAGDROP_DROP);
|
||||
DispatchDragDropEvent( NS_DRAGDROP_DROP);
|
||||
// gWidgetModuleData->dragService->TermDrop();
|
||||
|
||||
mDragInside = FALSE;
|
||||
|
|
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -16,52 +16,38 @@
|
|||
* Copyright (C) 1999 John Fairhurst. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* IBM Corp.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _resid_h
|
||||
#define _resid_h
|
||||
#define IDC_BASE 4100
|
||||
|
||||
// Resource IDs for the widget DLL.
|
||||
#define IDC_SELECTANCHOR 4100
|
||||
#define IDC_ARROWSOUTH 4101
|
||||
#define IDC_ARROWNORTH 4102
|
||||
#define IDC_ARROWEAST 4103
|
||||
#define IDC_ARROWWEST 4104
|
||||
#define IDC_ARROWSOUTHPLUS 4105
|
||||
#define IDC_ARROWNORTHPLUS 4106
|
||||
#define IDC_ARROWEASTPLUS 4107
|
||||
#define IDC_ARROWWESTPLUS 4108
|
||||
#define IDC_GRAB 4109
|
||||
#define IDC_GRABBING 4110
|
||||
#define IDC_CELL 4111
|
||||
#define IDC_COPY 4112
|
||||
#define IDC_ALIAS 4113
|
||||
|
||||
// Directory-picker dialog
|
||||
#define DID_DIRPICKER 100
|
||||
|
||||
#define IDD_TREECNR 101
|
||||
#define IDD_CBDRIVES 102
|
||||
#define IDD_EFPATH 103
|
||||
#define IDD_HELPBUTTON 104
|
||||
#define IDC_ARROWWAIT 4114
|
||||
#define IDC_CROSS 4115
|
||||
#define IDC_HELP 4116
|
||||
|
||||
// Icons
|
||||
#define ID_ICO_FRAME 500
|
||||
#define ID_ICO_FOLDER 501
|
||||
#define ID_ICO_DRAGITEM 502
|
||||
|
||||
#define ID_PTR_SELECTURL 2000
|
||||
#define ID_PTR_ARROWNORTH 2001
|
||||
#define ID_PTR_ARROWNORTHP 2002
|
||||
#define ID_PTR_ARROWSOUTH 2003
|
||||
#define ID_PTR_ARROWSOUTHP 2004
|
||||
#define ID_PTR_ARROWWEST 2005
|
||||
#define ID_PTR_ARROWWESTP 2006
|
||||
#define ID_PTR_ARROWEAST 2007
|
||||
#define ID_PTR_ARROWEASTP 2008
|
||||
#define ID_PTR_COPY 2009
|
||||
#define ID_PTR_ALIAS 2010
|
||||
#define ID_PTR_CELL 2011
|
||||
#define ID_PTR_GRAB 2012
|
||||
#define ID_PTR_GRABBING 2013
|
||||
#define ID_PTR_ARROWWAIT 2014
|
||||
|
||||
#define ID_STR_FONT 10000
|
||||
#define ID_STR_HMMDIR 10001
|
||||
#define ID_STR_NOCDIR 10002
|
||||
|
||||
// OS2TODO HCT temporary bug fix
|
||||
|
||||
#ifndef FCF_CLOSEBUTTON // defined in the Merlin toolkit
|
||||
#define FCF_CLOSEBUTTON 0x04000000L
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,20 +28,21 @@ ICON ID_ICO_FOLDER res\folder.ico
|
|||
ICON ID_ICO_DRAGITEM res\dragitem.ico
|
||||
|
||||
/* pointers */
|
||||
POINTER ID_PTR_SELECTURL res\select.ptr
|
||||
POINTER ID_PTR_ARROWNORTH res\arrow_north.ptr
|
||||
POINTER ID_PTR_ARROWNORTHP res\arrow_north_plus.ptr
|
||||
POINTER ID_PTR_ARROWSOUTH res\arrow_south.ptr
|
||||
POINTER ID_PTR_ARROWSOUTHP res\arrow_south_plus.ptr
|
||||
POINTER ID_PTR_ARROWWEST res\arrow_west.ptr
|
||||
POINTER ID_PTR_ARROWWESTP res\arrow_west_plus.ptr
|
||||
POINTER ID_PTR_ARROWEAST res\arrow_east.ptr
|
||||
POINTER ID_PTR_ARROWEASTP res\arrow_east_plus.ptr
|
||||
POINTER ID_PTR_COPY res\copy.ptr
|
||||
POINTER ID_PTR_ALIAS res\aliasb.ptr
|
||||
POINTER ID_PTR_CELL res\cell.ptr
|
||||
POINTER ID_PTR_GRAB res\grab.ptr
|
||||
POINTER ID_PTR_GRABBING res\grabbing.ptr
|
||||
POINTER ID_PTR_ARROWWAIT res\arrow_wait.ptr
|
||||
|
||||
POINTER IDC_SELECTANCHOR res\select.ptr
|
||||
POINTER IDC_ARROWNORTH res\arrow_north.ptr
|
||||
POINTER IDC_ARROWNORTHPLUS res\arrow_north_plus.ptr
|
||||
POINTER IDC_ARROWSOUTH res\arrow_south.ptr
|
||||
POINTER IDC_ARROWSOUTHPLUS res\arrow_south_plus.ptr
|
||||
POINTER IDC_ARROWWEST res\arrow_west.ptr
|
||||
POINTER IDC_ARROWWESTPLUS res\arrow_west_plus.ptr
|
||||
POINTER IDC_ARROWEAST res\arrow_east.ptr
|
||||
POINTER IDC_ARROWEASTPLUS res\arrow_east_plus.ptr
|
||||
POINTER IDC_COPY res\copy.ptr
|
||||
POINTER IDC_ALIAS res\aliasb.ptr
|
||||
POINTER IDC_CELL res\cell.ptr
|
||||
POINTER IDC_GRAB res\grab.ptr
|
||||
POINTER IDC_GRABBING res\grabbing.ptr
|
||||
POINTER IDC_ARROWWAIT res\arrow_wait.ptr
|
||||
POINTER IDC_CROSS res\crosshair.ptr
|
||||
POINTER IDC_HELP res\help.ptr
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче