All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
Refer to licensing information at http://www.artifex.com or contact
Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
CA 94129, USA, for further information.
*/
#ifndef dwtext_INCLUDED
# define dwtext_INCLUDED
#ifdef _WINDOWS
#define _Windows
#endif
#define UNICODE
#include "windows_.h"
#undef UNICODE
typedef struct TEXTWINDOW_S {
const char *Title;
wchar_t *TitleW;
HICON hIcon;
wchar_t *ScreenBuffer;
POINT ScreenSize;
char *DragPre;
char *DragPost;
int nCmdShow;
HWND hwnd;
BYTE *KeyBuf;
BYTE *KeyBufIn;
BYTE *KeyBufOut;
unsigned int KeyBufSize;
BOOL quitnow;
char line_buf[256];
int line_end;
int line_start;
BOOL line_complete;
BOOL line_eof;
BOOL bFocus;
BOOL bGetCh;
char *fontname;
int fontsize;
HFONT hfont;
int CharAscent;
int CaretHeight;
int CursorFlag;
POINT CursorPos;
POINT ClientSize;
POINT CharSize;
POINT ScrollPos;
POINT ScrollMax;
int x, y, cx, cy;
int utf8shift;
TCHAR** szFiles;
int cFiles;
} TW;
TW *text_new(void);
void text_destroy(TW *tw);
* return TRUE if key hit
* return FALSE if no key
*/
int text_kbhit(TW *tw);
int getch(void);
* store line in buf, with no more than len characters
* including null character
* return number of characters read
*/
int text_gets(TW *tw, char *buf, int len);
* store line in buf, with no more than len characters
* line is not null terminated
* return number of characters read
*/
int text_read_line(TW *tw, char *buf, int len);
int text_putch(TW *tw, int ch);
void text_write_buf(TW *tw, const char *buf, int cnt);
void text_puts(TW *tw, const char *str);
void text_to_cursor(TW *tw);
int text_register_class(TW *tw, HICON hicon);
int text_create(TW *tw, const char *title, int cmdShow);
void text_font(TW *tw, const char *fontname, int fontsize);
void text_size(TW *tw, int width, int height);
void text_setpos(TW *tw, int x, int y, int cx, int cy);
int text_getpos(TW *tw, int *px, int *py, int *pcx, int *pcy);
* If a file is dropped on the window, the following will
* be poked into the keyboard buffer:
* the pre_drag string
* the file name
* the post_drag string
*/
void text_drag(TW *tw, const char *pre_drag, const char *post_drag);
void
text_clear_drag_and_drop_list(TW* tw, int freelist);
HWND text_get_handle(TW *tw);
#endif