📄 wdefani.c
字号:
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
#include <windows.h>
#include <win1632.h>
#include "wdeglbl.h"
#include "wdemem.h"
#include "wderesin.h"
#include "wdeobjid.h"
#include "wdefutil.h"
#include "wde_wres.h"
#include "wdemain.h"
#include "wdeoinfo.h"
#include "wdedefsz.h"
#include "wdedebug.h"
#include "wde_rc.h"
#include "wdesdup.h"
#include "wdecctl.h"
#include "wdefani.h"
/****************************************************************************/
/* type definitions */
/****************************************************************************/
typedef struct {
FARPROC dispatcher;
OBJPTR object_handle;
OBJ_ID object_id;
OBJPTR control;
} WdeAniCObject;
/****************************************************************************/
/* external function prototypes */
/****************************************************************************/
extern BOOL WINEXPORT WdeAniCDispatcher ( ACTION, WdeAniCObject *, void *,
void *);
extern LRESULT WINEXPORT WdeAniCSuperClassProc ( HWND, UINT, WPARAM, LPARAM);
/****************************************************************************/
/* static function prototypes */
/****************************************************************************/
static OBJPTR WdeMakeAniC ( OBJPTR, RECT *, OBJPTR, DialogStyle,
char *, OBJ_ID );
static OBJPTR WdeAniCreate ( OBJPTR, RECT *, OBJPTR,
OBJ_ID, WdeDialogBoxControl *);
static BOOL WdeAniCDestroy ( WdeAniCObject *, BOOL *, void *);
static BOOL WdeAniCValidateAction ( WdeAniCObject *, ACTION *, void *);
static BOOL WdeAniCCopyObject ( WdeAniCObject *, WdeAniCObject **,
WdeAniCObject *);
static BOOL WdeAniCIdentify ( WdeAniCObject *, OBJ_ID *, void *);
static BOOL WdeAniCGetWndProc ( WdeAniCObject *, WNDPROC *, void *);
static BOOL WdeAniCGetWindowClass ( WdeAniCObject *, char **, void *);
static BOOL WdeAniCDefine ( WdeAniCObject *, POINT *, void *);
static void WdeAniCSetDefineInfo ( WdeDefineObjectInfo *, HWND );
static void WdeAniCGetDefineInfo ( WdeDefineObjectInfo *, HWND );
static BOOL WdeAniCDefineHook ( HWND, UINT, WPARAM, LPARAM,
DialogStyle );
/****************************************************************************/
/* static variables */
/****************************************************************************/
static HINSTANCE WdeApplicationInstance;
static FARPROC WdeAniCDispatch;
static WdeDialogBoxControl *WdeDefaultAniC = NULL;
static int WdeAniCWndExtra;
static WNDPROC WdeOriginalAniCProc;
//static WNDPROC WdeAniCProc;
#define WANIMATE_CLASS ANIMATE_CLASS
static DISPATCH_ITEM WdeAniCActions[] = {
{ DESTROY , (BOOL (*)(OBJPTR, void *, void *))WdeAniCDestroy }
, { COPY , (BOOL (*)(OBJPTR, void *, void *))WdeAniCCopyObject }
, { VALIDATE_ACTION , (BOOL (*)(OBJPTR, void *, void *))WdeAniCValidateAction }
, { IDENTIFY , (BOOL (*)(OBJPTR, void *, void *))WdeAniCIdentify }
, { GET_WINDOW_CLASS , (BOOL (*)(OBJPTR, void *, void *))WdeAniCGetWindowClass }
, { DEFINE , (BOOL (*)(OBJPTR, void *, void *))WdeAniCDefine }
, { GET_WND_PROC , (BOOL (*)(OBJPTR, void *, void *))WdeAniCGetWndProc }
};
#define MAX_ACTIONS (sizeof(WdeAniCActions)/sizeof (DISPATCH_ITEM))
OBJPTR WINEXPORT WdeAniCCreate( OBJPTR parent, RECT *obj_rect, OBJPTR handle)
{
if( handle == NULL ) {
return( WdeMakeAniC( parent, obj_rect, handle,
0, "", ANIMATE_OBJ ) );
} else {
return( WdeAniCreate( parent, obj_rect, NULL, ANIMATE_OBJ,
(WdeDialogBoxControl *) handle) );
}
}
OBJPTR WdeMakeAniC( OBJPTR parent, RECT *obj_rect, OBJPTR handle,
DialogStyle style, char *text, OBJ_ID id )
{
OBJPTR new;
style |= WS_BORDER | WS_VISIBLE | WS_TABSTOP | WS_CHILD;
SETCTL_STYLE( WdeDefaultAniC, style );
SETCTL_TEXT( WdeDefaultAniC, ResStrToNameOrOrd( text ) );
SETCTL_ID( WdeDefaultAniC, WdeGetNextControlID() );
WdeChangeSizeToDefIfSmallRect ( parent, id, obj_rect );
new = WdeAniCreate ( parent, obj_rect, handle, id, WdeDefaultAniC );
WdeMemFree( GETCTL_TEXT(WdeDefaultAniC) );
SETCTL_TEXT( WdeDefaultAniC, NULL );
return ( new );
}
OBJPTR WdeAniCreate( OBJPTR parent, RECT *obj_rect, OBJPTR handle,
OBJ_ID id, WdeDialogBoxControl *info)
{
WdeAniCObject *new;
WdeDebugCreate("AniC", parent, obj_rect, handle);
if ( parent == NULL ) {
WdeWriteTrail("WdeAniCCreate: AniC has no parent!");
return ( NULL );
}
new = (WdeAniCObject *) WdeMemAlloc ( sizeof(WdeAniCObject) );
if ( new == NULL ) {
WdeWriteTrail("WdeAniCCreate: Object malloc failed");
return ( NULL );
}
new->dispatcher = WdeAniCDispatch;
new->object_id = id;
if ( handle == NULL ) {
new->object_handle = new;
} else {
new->object_handle = handle;
}
new->control = Create( CONTROL_OBJ, parent, obj_rect, new->object_handle);
if (new->control == NULL) {
WdeWriteTrail("WdeAniCCreate: CONTROL_OBJ not created!");
WdeMemFree ( new );
return ( NULL );
}
if (!Forward ( (OBJPTR)new->object_handle, SET_OBJECT_INFO, info, NULL) ) {
WdeWriteTrail("WdeAniCCreate: SET_OBJECT_INFO failed!");
Destroy ( new->control, FALSE );
WdeMemFree ( new );
return ( NULL );
}
if (!Forward ( (OBJPTR)new->object_handle, CREATE_WINDOW,
NULL, NULL) ) {
WdeWriteTrail("WdeAniCCreate: CREATE_WINDOW failed!");
Destroy ( new->control, FALSE );
WdeMemFree ( new );
return ( NULL );
}
return ( new );
}
BOOL WINEXPORT WdeAniCDispatcher ( ACTION act, WdeAniCObject *obj,
void *p1, void *p2)
{
int i;
WdeDebugDispatch("AniC", act, obj, p1, p2);
for ( i = 0; i < MAX_ACTIONS; i++ ) {
if( WdeAniCActions[i].id == act ) {
return( (WdeAniCActions[i].rtn)( obj, p1, p2 ) );
}
}
return (Forward ((OBJPTR)obj->control, act, p1, p2));
}
Bool WdeAniCInit( Bool first )
{
WNDCLASS wc;
WdeApplicationInstance = WdeGetAppInstance();
GetClassInfo( (HINSTANCE)NULL, WANIMATE_CLASS, &wc );
WdeOriginalAniCProc = wc.lpfnWndProc;
WdeAniCWndExtra = wc.cbWndExtra;
if( first ) {
#if 0
if ( wc.style & CS_GLOBALCLASS ) {
wc.style ^= CS_GLOBALCLASS;
}
if ( wc.style & CS_PARENTDC ) {
wc.style ^= CS_PARENTDC;
}
wc.style |= ( CS_HREDRAW | CS_VREDRAW );
wc.hInstance = WdeApplicationInstance;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -