<< | < | 2005-03 | > | |||
---|---|---|---|---|---|---|
Su | Mo | Tu | We | Th | Fr | Sa |
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
(or *svn-dst-files-history* nil)
C:/tmp
にsvn-modeをエクスポートしようとするとき、svn export repository:/path/to/svn-mode/trunk c:/tmp/svn
C:/tmp/svn
ディレクトリは存在せず、exportサブコマンドで新規に作成する場合に、read-directory-nameは使えない。なので別の方法を考える必要があるわけなんだけど、……思いつかん(笑)(let ((dst (prog2
(define-key minibuffer-local-map #\TAB 'custom-completion)
(read-string "DST: "
:default (merge-pathnames (default-directory))
:history (or *svn-dst-files-history* nil))
(undefine-key minibuffer-local-map #\TAB))))
(export '( .... *svn-mode-prefix-key* ... ))
...
(defvar *svn-mode-prefix-key* '(#\C-c))
~/.xyzzy
とかsiteinit.l
で指定できるようにしてあります。前は決め打ちだったから、設定の手間はあるけどちょっとだけ便利になったかも(defun custom-completion ()
(interactive)
(let ((from (point-min))
(to (point-max)))
(goto-eol)
(do-completion from to :directory-name)))
(defun test-svn-export ()
(interactive)
(let ((dst nil)
(src nil)
(obind (lookup-keymap minibuffer-local-map #\TAB)))
(setq src "svn")
(setq dst (progn
(define-key minibuffer-local-map #\TAB 'custom-completion)
(read-string "(export)Local Path: "
:default (default-directory)
:history (or *svn-dst-files-history* nil))))
(if obind
`(define-key minibuffer-local-map #\TAB ',obind)
(undefine-key minibuffer-local-map #\TAB))
(insert dst)
(refresh-screen)))
(eval-when (:compile-toplevel :load-toplevel :execute)
(require "foreign")
(require "wip/winapi"))
(require "api")
(in-package "win-user")
(provide "notifyicon")
(*define WM_NOTIFYICON (+ WM_APP 100))
(*define NIF_MESSAGE #x00000001)
(*define NIF_ICON #x00000002)
(*define NIF_TIP #x00000004)
(*define NIF_STATE #x00000008)
(*define NIF_INFO #x00000010)
(*define NIF_GUID #x00000020)
(*define NIM_ADD #x00000000)
(*define NIM_MODIFY #x00000001)
(*define NIM_DELETE #x00000002)
(*define NIM_SETFOCUS #x00000003)
(*define NIM_SETVERSION #x00000004)
(*define IDC_BUTTON 3001)
(*define-c-struct WNDCLASSEX
(UINT cbSize)
(UINT style)
(WNDPROC lpfnWndProc)
(int cbClsExtra)
(int cbWndExtra)
(HINSTANCE hInstance)
(HICON hIcon)
(HCURSOR hCursor)
(HBRUSH hbrBackground)
(LPCSTR lpszMenuName)
(LPCSTR lpszClassName)
(HICON hIconSm))
(*define-c-struct GUID
(u_long Data1)
(u_short Data2)
(u_short Data3)
(u_char Data4 8))
(*define-c-struct
NOTIFYICONDATA
(DWORD cbSize)
(HWND hWnd)
(UINT uID)
(UINT uFlags)
(UINT uCallbackMessage)
(HICON hIcon)
(LPCSTR szTip) ;?
(DWORD dwState)
(DWORD dwStateMask)
(LPCSTR szInfo)
(UINT uTimeout) ;?
(LPCSTR szInfoTitle)
(DWORD dwInfoFlags)
(GUID guidItem))
(unless (boundp 'Shell_NotifyIconW)
(define-dll-entry BOOL Shell_NotifyIcon (DWORD (NOTIFYICONDATA *)) "shell32" "Shell_NotifyIconA"))
(unless (boundp 'PostQuitMessage)
(define-dll-entry void PostQuitMessage (int) "user32.dll"))
(unless (boundp 'RegisterClassEx)
(define-dll-entry ATOM RegisterClassEx ((WNDCLASSEX *)) "user32" "RegisterClassExA"))
(setq *window-class-name* "myNotification")
(defvar *gInstance* nil)
(unless (fboundp 'window-wndproc)
(defun-c-callable
LRESULT window-wndproc
((HWND hwnd) (UINT msg) (WPARAM wparam) (LPARAM lparam))
(let ((nid nil))
(cond
((= msg WM_CREATE)
(setq nid (create-notifyicondata hwnd))
(Shell_NotifyIcon NIM_ADD nid)
(CreateWindow
(si:make-string-chunk "BUTTON")
(si:make-string-chunk "Ballon")
(logior WS_CHILD WS_VISIBLE)
0 0
100 100
hwnd 0
(GetModuleHandle 0)
0)
(return-from window-wndproc 0))
((= msg WM_COMMAND)
(setq nid (create-notifyicondata hwnd))
(setf (NOTIFYICONDATA-szInfoTitle nid)
(si:make-string-chunk "myNotifyIcon Balloon tip"))
(setf (NOTIFYICONDATA-szInfo nid)
(si:make-string-chunk "test"))
(setf (NOTIFYICONDATA-uFlags nid) NIF_INFO)
(setf (NOTIFYICONDATA-dwInfoFlags nid) 3)
(Shell_NotifyIcon NIM_MODIFY nid)
(return-from window-wndproc 0))
((= msg WM_NOTIFYICON)
(return-from window-wndproc 0))
((= msg WM_CLOSE)
(setq nid (create-notifyicondata hwnd))
(Shell_NotifyIcon NIM_DELETE nid)
(DestroyWindow hwnd)
(return-from window-wndproc 0))
((= msg WM_NCDESTROY)
(PostQuitMessage 0)
(return-from window-wndproc 1)
))
(DefWindowProc hwnd msg wparam lparam))))
(defun initialize-window ()
(let ((hwnd nil)
(wc (make-WNDCLASSEX)))
(setf (WNDCLASSEX-cbSize wc) (c::c-struct-size-of WNDCLASSEX))
(setf (WNDCLASSEX-style wc) 0)
(setf (WNDCLASSEX-lpfnWndProc wc) #'window-wndproc)
(setf (WNDCLASSEX-cbClsExtra wc) 0)
(setf (WNDCLASSEX-cbWndExtra wc) 0)
(setf (WNDCLASSEX-hInstance wc) (GetModuleHandle 0))
(setf (WNDCLASSEX-hIcon wc) 0)
(setf (WNDCLASSEX-hCursor wc)
(LoadCursor 0 (MAKEINTRESOURCE IDC_ARROW)))
(setf (WNDCLASSEX-hbrBackground wc) 6) ;?
(setf (WNDCLASSEX-lpszMenuName wc) 0)
(setf (WNDCLASSEX-lpszClassName wc)
(si:make-string-chunk *window-class-name*))
(setf (WNDCLASSEX-hIconSm wc) 0)
(RegisterClassEx wc)
(setq hwnd (CreateWindowEx
WS_EX_TOOLWINDOW
(si:make-string-chunk *window-class-name*)
(si:make-string-chunk *window-class-name*)
(logior WS_OVERLAPPEDWINDOW #x40 #x01 #x02 WS_POPUP)
CW_USEDEFAULT
CW_USEDEFAULT
CW_USEDEFAULT
CW_USEDEFAULT
(ed::get-window-handle)
0
(GetModuleHandle 0)
0))
(SendMessage hwnd (+ #x0400 24) 0 200)
(SendMessage hwnd (+ #x0400 32) 1 (si::address-of (si:make-string-chunk "myNotifyIconTest")))
(ShowWindow hwnd SW_SHOW)
(UpdateWindow hwnd)
hwnd))
(defun create-notifyicondata (hwnd)
(let ((nid (make-NOTIFYICONDATA)))
(setf (NOTIFYICONDATA-cbSize nid)
(c::c-struct-size-of NOTIFYICONDATA))
(setf (NOTIFYICONDATA-hWnd nid) hwnd)
(setf (NOTIFYICONDATA-uID nid) 0)
(setf (NOTIFYICONDATA-uFlags nid)
(logior NIF_ICON NIF_MESSAGE NIF_TIP))
(setf (NOTIFYICONDATA-uCallbackMessage nid) WM_NOTIFYICON)
(setf (NOTIFYICONDATA-hIcon nid)
(LoadIcon 0 (MAKEINTRESOURCE IDI_APPLICATION)))
(setf (NOTIFYICONDATA-szTip nid)
(si:make-string-chunk "myNotifyIcon help"))
nid))
(defun user::notify-main ()
(setq *gInstance* (win-user::initialize-window)))
// mynotifyicon.h
#define DLLEXPORT extern "C" __declspec(dllexport)
DLLEXPORT int createballoon(HWND hwnd, LPCSTR msg);
DLLEXPORT int modifyballoon(HWND hwnd,
LPCSTR title,
LPCSTR msg,
int IconStyle,
long Timeout);
DLLEXPORT int deleteballoon(HWND hwnd);
// mynotifyicon.cpp
#include <windows.h>
#include <shellapi.h>
#include "mynotifyicon.h"
#define WM_USER_TRAY (WM_APP + 100)
DLLEXPORT BOOL APIENTRY DllMain(HINSTANCE hinst, DWORD ul_reason_for_call, LPVOID pParam)
{
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
DLLEXPORT int createballoon(HWND hwnd, LPCSTR msg)
{
NOTIFYICONDATA nid;
ZeroMemory(&nid, sizeof(NOTIFYICONDATA));
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hwnd;
nid.uID = 0;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_USER_TRAY;
nid.hIcon = NULL;
lstrcpy(nid.szTip, msg);
Shell_NotifyIcon(NIM_ADD, &nid);
return TRUE;
}
DLLEXPORT int modifyballoon(HWND hwnd,
LPCSTR title,
LPCSTR msg,
int IconStyle = 0,
long Timeout = 10000)
{
NOTIFYICONDATA nid;
ZeroMemory(&nid, sizeof(NOTIFYICONDATA));
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.uFlags = NIF_INFO;
nid.hWnd = hwnd;
strcpy(nid.szInfoTitle, title);
strcpy(nid.szInfo, msg);
nid.dwInfoFlags = IconStyle;
nid.uTimeout = Timeout;
Shell_NotifyIcon(NIM_MODIFY, &nid);
return TRUE;
}
DLLEXPORT int deleteballoon(HWND hwnd)
{
NOTIFYICONDATA nid;
ZeroMemory(&nid, sizeof(NOTIFYICONDATA));
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hwnd;
Shell_NotifyIcon(NIM_DELETE, &nid);
return TRUE;
}
(c::define-dll-entry c::int deleteballoon (winapi::HWND) "mynotifyicon.dll")
(c::define-dll-entry c::int createballoon (winapi::HWND winapi::LPCSTR) "mynotifyicon.dll")
(c::define-dll-entry c::int modifyballoon
(
winapi::HWND
winapi::LPCSTR
winapi::LPCSTR
c::int
c::long) "mynotifyicon.dll")
(progn
(createballoon (get-window-handle) (si:make-string-chunk "Balloon test."))
(modifyballoon (get-window-handle)
(si:make-string-chunk "バルーンテスト")
(si:make-string-chunk "バルーンをテスト!")
1
50000
))
;;; -*- Mode: Lisp; Package: WIN-USER -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
(require "wip/winapi"))
(require "api")
(in-package "win-user")
(defconstant animate-window-class "Animate-Window-Class")
(*define-c-struct WNDCLASSEX
(UINT cbSize)
(UINT style)
(WNDPROC lpfnWndProc)
(int cbClsExtra)
(int cbWndExtra)
(HINSTANCE hInstance)
(HICON hIcon)
(HCURSOR hCursor)
(HBRUSH hbrBackground)
(LPCSTR lpszMenuName)
(LPCSTR lpszClassName)
(HICON hIconSm))
(c::define-dll-entry BOOL AnimateWindow (HWND DWORD DWORD) "user32")
(c::define-dll-entry ATOM RegisterClassEx ((WNDCLASSEX *)) "user32" "RegisterClassExA")
(c::define-dll-entry BOOL SystemParametersInfo (UINT UINT PVOID UINT) "user32" "SystemParametersInfoA")
(*define-c-macro RGB (r g b) (logior (logior (ash r 0) (ash g 8)) (ash b 16)))
(c::define-dll-entry HBRUSH CreateSolidBrush (COLORREF) "gdi32")
(c::define-dll-entry int SetBkMode (HDC int) "gdi32")
(*define TRANSPARENT 1)
(*define OPAQUE 2)
(*define BKMODE_LAST 2)
(*define SPI_GETWORKAREA 48)
(*define SS_CENTER #x00000001)
(unless (fboundp 'animate-window-wndproc)
(defun-c-callable LRESULT animate-window-wndproc
((HWND hWnd) (UINT msg) (WPARAM wparam) (LPARAM lparam))
(cond
((= msg WM_NCDESTROY)
(return-from animate-window-wndproc 0)
)
((= msg WM_CTLCOLORSTATIC)
(SetBkMode wparam TRANSPARENT)
(return-from animate-window-wndproc
(CreateSolidBrush (RGB 224 255 255))))
((= msg WM_CREATE)
(return-from animate-window-wndproc 0)
))
(DefWindowProc hWnd msg wparam lparam)))
(defun delete-animate-window (hWnd)
(AnimateWindow hWnd
200
(logior AW_HIDE AW_SLIDE AW_VER_POSITIVE))
(DestroyWindow hWnd))
(defun create-animate-window ()
(let ((wc (make-WNDCLASSEX)))
(setf (WNDCLASSEX-cbSize wc) (c-struct-size-of WNDCLASSEX))
(setf (WNDCLASSEX-style wc) (logior CS_HREDRAW CS_VREDRAW))
(setf (WNDCLASSEX-lpfnWndProc wc) #'animate-window-wndproc)
(setf (WNDCLASSEX-cbClsExtra wc) 0)
(setf (WNDCLASSEX-cbWndExtra wc) 0)
(setf (WNDCLASSEX-hInstance wc) (GetModuleHandle 0))
(setf (WNDCLASSEX-hIcon wc) (LoadIcon 0 (MAKEINTRESOURCE IDI_APPLICATION)))
(setf (WNDCLASSEX-hCursor wc) (LoadCursor 0 (MAKEINTRESOURCE IDC_ARROW)))
(setf (WNDCLASSEX-hbrBackground wc) (CreateSolidBrush (RGB 224 255 255)))
(setf (WNDCLASSEX-lpszMenuName wc) 0)
(setf (WNDCLASSEX-lpszClassName wc)
(si:make-string-chunk animate-window-class))
(setf (WNDCLASSEX-hIconSm wc) 0)
(RegisterClassEx wc))
(let* ((rect (make-RECT)))
(SystemParametersInfo SPI_GETWORKAREA 0 rect 0)
(let ((hWnd (CreateWindowEx
(logior WS_EX_TOOLWINDOW WS_EX_TOPMOST)
(si:make-string-chunk animate-window-class)
(si:make-string-chunk "Animate-Window")
(logior WS_THICKFRAME WS_POPUP)
(- (RECT-right rect) 205)
(- (RECT-bottom rect) 105)
200 100
0 0
(GetModuleHandle 0) 0))
(clientrect (make-RECT)))
(GetClientRect hWnd clientrect)
(CreateWindowEx
0
(si:make-string-chunk "Static")
(si:make-string-chunk "*Animate Window*")
(logior WS_CHILD WS_VISIBLE SS_CENTER)
(+ (RECT-left clientrect) 5 #|margin x|#)
(+ (RECT-top clientrect) 5 #|margin y|#)
(- (- (RECT-right clientrect) (RECT-left clientrect)) 5 #|width|#)
30 #|height|#
hWnd
0
(GetModuleHandle 0) 0)
(CreateWindowEx
0
(si:make-string-chunk "Static")
(si:make-string-chunk "動きますぅ〜")
(logior WS_CHILD WS_VISIBLE SS_CENTER)
(+ (RECT-top clientrect) 5 #|margin x|#)
(+ (+ (RECT-top clientrect) 30) 5 #|margin y|#)
(- (- (RECT-right clientrect) (RECT-left clientrect)) 5 #|width|#)
70 #|parent window(100) - static[title](30)|#
hWnd
0
(GetModuleHandle 0)
0)
(AnimateWindow hWnd
200
(logior AW_SLIDE AW_VER_NEGATIVE))
(ed::start-timer 5 #'(lambda () (funcall 'delete-animate-window hWnd)) t)
hWnd)))
(progn
(require "animatewindow")
(win-user::create-animate-window))
;;; -*- Mode: Lisp; Package: WIN-USER -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
(require "wip/winapi"))
(require "api")
(in-package "win-user")
(export
'(*animatewindow-after-parentwindow-hook*))
(defvar *animatewindow-after-parentwindow-hook* nil)
(defconstant animate-window-class "Animate-Window-Class")
(*define-c-struct WNDCLASSEX
(UINT cbSize)
(UINT style)
(WNDPROC lpfnWndProc)
(int cbClsExtra)
(int cbWndExtra)
(HINSTANCE hInstance)
(HICON hIcon)
(HCURSOR hCursor)
(HBRUSH hbrBackground)
(LPCSTR lpszMenuName)
(LPCSTR lpszClassName)
(HICON hIconSm))
(c::define-dll-entry BOOL AnimateWindow (HWND DWORD DWORD) "user32")
(c::define-dll-entry ATOM RegisterClassEx ((WNDCLASSEX *)) "user32" "RegisterClassExA")
(c::define-dll-entry BOOL SystemParametersInfo (UINT UINT PVOID UINT) "user32" "SystemParametersInfoA")
(*define-c-macro RGB (r g b) (logior (logior (ash r 0) (ash g 8)) (ash b 16)))
(c::define-dll-entry HBRUSH CreateSolidBrush (COLORREF) "gdi32")
(c::define-dll-entry int SetBkMode (HDC int) "gdi32")
(*define TRANSPARENT 1)
(*define OPAQUE 2)
(*define BKMODE_LAST 2)
(*define SPI_GETWORKAREA 48)
(*define SS_LEFT #x00000000)
(*define SS_CENTER #x00000001)
(*define SS_RIGHT #x00000002)
(*define SS_ICON #x00000003)
(*define SS_BLACKRECT #x00000004)
(*define SS_GRAYRECT #x00000005)
(*define SS_WHITERECT #x00000006)
(*define SS_BLACKFRAME #x00000007)
(*define SS_GRAYFRAME #x00000008)
(*define SS_WHITEFRAME #x00000009)
(*define SS_USERITEM #x0000000A)
(*define SS_SIMPLE #x0000000B)
(*define SS_LEFTNOWORDWRAP #x0000000C)
(*define SS_OWNERDRAW #x0000000D)
(*define SS_BITMAP #x0000000E)
(*define SS_ENHMETAFILE #x0000000F)
(*define SS_ETCHEDHORZ #x00000010)
(*define SS_ETCHEDVERT #x00000011)
(*define SS_ETCHEDFRAME #x00000012)
(*define SS_TYPEMASK #x0000001F)
(*define SS_NOPREFIX #x00000080)
(*define SS_NOTIFY #x00000100)
(*define SS_CENTERIMAGE #x00000200)
(*define SS_RIGHTJUST #x00000400)
(*define SS_REALSIZEIMAGE #x00000800)
(*define SS_SUNKEN #x00001000)
(*define SS_ENDELLIPSIS #x00004000)
(*define SS_PATHELLIPSIS #x00008000)
(*define SS_WORDELLIPSIS #x0000C000)
(*define SS_ELLIPSISMASK #x0000C000)
(*define STM_SETICON #x0170)
(*define STM_GETICON #x0171)
(*define STM_SETIMAGE #x0172)
(*define STM_GETIMAGE #x0173)
(*define STN_CLICKED 0)
(*define STN_DBLCLK 1)
(*define STN_ENABLE 2)
(*define STN_DISABLE 3)
(*define STM_MSGMAX #x0174)
(unless (fboundp 'animate-window-wndproc)
(defun-c-callable LRESULT animate-window-wndproc
((HWND hWnd) (UINT msg) (WPARAM wparam) (LPARAM lparam))
(cond
((= msg WM_NCDESTROY)
(return-from animate-window-wndproc 0)
)
((= msg WM_CTLCOLORSTATIC)
(SetBkMode wparam TRANSPARENT)
(return-from animate-window-wndproc
(CreateSolidBrush (RGB 224 255 255))))
((= msg WM_CREATE)
(return-from animate-window-wndproc 0)
))
(DefWindowProc hWnd msg wparam lparam)))
(defun delete-animate-window (hWnd &optional acount hide-style)
(let ((animate-count (or acount 200))
(style (or hide-style (logior AW_HIDE AW_SLIDE AW_NEGATIVE))))
(AnimateWindow hWnd
animate-count
style)
(DestroyWindow hWnd)))
(defun user::create-animate-window
(&key window-width window-height window-margin-x window-margin-y
window-position-x-flag window-position-x
window-position-y-flag window-position-y
window-show-style window-hide-style
animate-count wait)
"Create Animatation Window
オプション名: 説明 {指定できる値} [初期値]
WINDOW-WIDTH: 作成するウィンドウの幅を指定します {数値} [200]
WINDOW-HEIGHT: 作成するウィンドウの高さを指定します {数値} [100]
WINDOW-MARGIN-X: ウィンドウ外枠からのX軸マージンを指定します {数値} [5]
WINDOW-MARGIN-Y: ウィンドウ外枠からのY軸マージンを指定します {数値} [5]
WINDOW-POSITION-X-FLAG: ウィンドウのX軸の場所について画面左側からの
値か、画面右側からの値かを指定します
{:left|:right} [:left]
WINDOW-POSITION-X: ウィンドウX軸の場所を指定します {数値} [0]
WINDOW-POSITION-Y-FLAG: ウィンドウのY軸の場所について画面上部からの
値か、画面下部からの値かを指定します
{:top|:bottom} [:top]
WINDOW-POSITOIN-Y: ウィンドウY軸の場所を指定します {数値} [0]
WINDOW-SHOW-STYLE: 表示方法を指定します。
{数値、あるいは(logior 数値 数値 ... 数値)}
[(logior AW_SLIDE AW_VER_POSITIVE)]
WINDOW-HIDE-STYLE: 非表示の方法を指定します
{数値、あるいは(logior 数値 数値 ... 数値)}
[(logior AW_HIDE AW_SLIDE AW_NEGATIVE)]
ANIMATE-COUNT: アニメーションする時間をミリ秒単位で指定します
{数値} [200]
WAIT: 表示してから、非表示にするまでの待機時間を秒単位で指定します
{数値} [5]
WINDOW-SHOW-STYLE,WINDOW-HIDE-STYLEで指定できる値:
winapi::AW_HOR_POSITIVE
winapi::AW_HOR_NEGATIVE
winapi::AW_VER_POSITIVE
winapi::AW_VER_NEGATIVE
winapi::AW_CENTER
winapi::AW_HIDE
winapi::AW_ACTIVATE
winapi::AW_SLIDE
winapi::AW_BLEND
"
(let ((rect (make-RECT)))
(SystemParametersInfo SPI_GETWORKAREA 0 rect 0)
(let* ((width (or window-width 200))
(height (or window-height 100))
(margin-x (or window-margin-x 5))
(margin-y (or window-margin-y 5))
(position-x-flag (or window-position-x-flag :left))
(position-x (or window-position-x 0))
(position-y-flag (or window-position-y-flag :top))
(position-y (or window-position-y 0))
(show-style (or window-show-style
(logior AW_SLIDE AW_VER_POSITIVE)))
(hide-style (or window-hide-style
(logior AW_HIDE AW_SLIDE AW_VER_NEGATIVE)))
(animation-count (or animate-count 200))
(wait-count (or wait 5)))
(let ((wc (make-WNDCLASSEX)))
(setf (WNDCLASSEX-cbSize wc) (c-struct-size-of WNDCLASSEX))
(setf (WNDCLASSEX-style wc) (logior CS_HREDRAW CS_VREDRAW))
(setf (WNDCLASSEX-lpfnWndProc wc) #'animate-window-wndproc)
(setf (WNDCLASSEX-cbClsExtra wc) 0)
(setf (WNDCLASSEX-cbWndExtra wc) 0)
(setf (WNDCLASSEX-hInstance wc) (GetModuleHandle 0))
(setf (WNDCLASSEX-hIcon wc) (LoadIcon 0 (MAKEINTRESOURCE IDI_APPLICATION)))
(setf (WNDCLASSEX-hCursor wc) (LoadCursor 0 (MAKEINTRESOURCE IDC_ARROW)))
(setf (WNDCLASSEX-hbrBackground wc) (CreateSolidBrush (RGB 224 255 255)))
(setf (WNDCLASSEX-lpszMenuName wc) 0)
(setf (WNDCLASSEX-lpszClassName wc)
(si:make-string-chunk animate-window-class))
(setf (WNDCLASSEX-hIconSm wc) 0)
(RegisterClassEx wc))
(let ((hWnd (CreateWindowEx
(logior WS_EX_TOOLWINDOW WS_EX_TOPMOST)
(si:make-string-chunk animate-window-class)
(si:make-string-chunk "Animate-Window")
(logior WS_THICKFRAME WS_POPUP)
;;; position-x
(cond ((eql position-x-flag :left)
(+ (RECT-left rect) position-x)
)
((eql position-x-flag :right)
(- (RECT-right rect) position-x)
))
;;; position-y
(cond ((eql position-y-flag :top)
(+ (RECT-top rect) position-y)
)
((eql position-y-flag :bottom)
(- (RECT-bottom rect) position-y)
))
width height
0 0
(GetModuleHandle 0) 0))
(clientrect (make-RECT)))
(GetClientRect hWnd clientrect)
(ed::run-hook-with-args '*animatewindow-after-parentwindow-hook* hWnd clientrect)
(AnimateWindow hWnd animation-count show-style)
(ed::start-timer wait-count #'(lambda ()
(funcall 'delete-animate-window
hWnd animation-count hide-style)) t)
hWnd))))
(ed::add-hook '*animatewindow-after-parentwindow-hook*
'create-child-window)
(defun create-child-window (hWnd clientrect)
(CreateWindowEx
0
(si:make-string-chunk "Static")
(si:make-string-chunk "*Animate Window*")
(logior WS_BORDER WS_CHILD WS_VISIBLE SS_CENTER)
(+ (RECT-left clientrect) 5 #|margin x|#)
(+ (RECT-top clientrect) 5 #|margin y|#)
(- (- (RECT-right clientrect) (RECT-left clientrect)) 10 #|width|#)
20 #|height|#
hWnd
0
(GetModuleHandle 0) 0)
(CreateWindowEx
0
(si:make-string-chunk "Static")
(si:make-string-chunk "動きますぅ〜")
(logior WS_CHILD WS_VISIBLE SS_CENTER)
(+ (RECT-top clientrect) 5 #|margin x|#)
(+ (+ (RECT-top clientrect) 30) 5 #|margin y|#)
(- (- (RECT-right clientrect) (RECT-left clientrect)) 10 #|width|#)
60 #|parent window(100) - static[title](30)|#
hWnd
0
(GetModuleHandle 0) 0))
(require "animatewindow")
(delete-hook 'win-user::*animatewindow-after-parentwindow-hook*
'win-user::create-child-window)
(add-hook 'win-user::*animatewindow-after-parentwindow-hook*
#'(lambda (hWnd clientrect)
(let ((height 20) (margin-x 5) (margin-y 5))
(winapi::CreateWindowEx
0
(si:make-string-chunk "Static")
(si:make-string-chunk "新規文字列〜")
(logior winapi::WS_BORDER
winapi::WS_CHILD
winapi::WS_VISIBLE
win-user::SS_RIGHT)
(+ (winapi::RECT-left clientrect) margin-x)
(- (winapi::RECT-bottom clientrect) (+ height margin-y))
(- (- (winapi::RECT-right clientrect)
(winapi::RECT-left clientrect)) (* 2 margin-x))
height
hWnd
0
(winapi::GetModuleHandle 0)
0))))
(create-animate-window
:window-height 140
:window-show-style (logior winapi::AW_SLIDE winapi::AW_HOR_POSITIVE)
:window-hide-style (logior winapi::AW_HIDE winapi::AW_CENTER winapi::AW_BLEND)
)