win32.h File Reference


Functions

void open_display ()
void close_display ()
HDC getDC ()
HFONT xfont ()
TEXTMETRICW * textmetric ()
COLORREF xpixel (Color i)
HPEN setpen ()
HBRUSH setbrush ()
void clip_region (HRGN)
HRGN clip_region ()
void draw_into (HBITMAP, int w, int h)
void stop_drawing (HBITMAP)
void stop_drawing (HWND)

Variables

HINSTANCE xdisplay
HPALETTE xpalette
MSG msg
HDC dc
COLORREF current_xpixel

Detailed Description

Declarations of FLTK symbols and interfaces that only exist if FLTK is compiled on Windows. It is recommended you avoid using this header file, and that you segregate code requiring it to it's own source file.

This header includes the horrible <windows.h> header file, followed by a large list of undef's to get rid of name conflicts. It is recommended you use this if you need any windows functions rather than including that file directly.

You can probably combine FLTK with other libraries that make their own WIN32 window classes. The easiest way is to call wait(), it will call DispatchMessage() for all messages to the other windows. If your other library insists on reading all the events, it will still work (as long as it calls DispatchMessage()), but you will have to arrange for the function flush() to be called regularily so that widgets are updated. Timeouts, the idle function, and file descriptor callbacks will not work in this case.

Many of the functions have the same name and purpose as ones defined in x11.h, just with different return types. Due to how Doxygen works, the X version of these is described here.


Function Documentation

HRGN clip_region  ) 
 

Return the current region as a system-specific structure. You must include <fltk/x.h> to use this. Returns null if there is no clipping.

void close_display  ) 
 

This closes the X connection. You do not need to call this to exit, and in fact it is faster to not do so! It may be useful to call this if you want your program to continue without the X connection. You cannot open the display again, and probably cannot call any FLTK functions.

HDC getDC  ) 
 

Return an arbitrary HDC which you can use for Win32 functions that need one as an argument. The returned value is short-lived and may be destroyed the next time anything is drawn into a window!

void open_display  ) 
 

Opens the display. Does nothing if it is already open. You should call this if you wish to do X calls and there is a chance that your code will be called before the first show() of a window. This is called automatically Window::show().

This may call abort() if there is an error opening the display.

HBRUSH setbrush  ) 
 

Set the current "brush" in the DC to match the most recent setcolor() and line_style() calls. This is stupid-expensive on Windows so we defer it until the brush is needed.

HPEN setpen  ) 
 

Set the current "pen" in the DC to match the most recent setcolor() and line_style() calls. This is stupid-expensive on Windows so we defer it until the pen is needed.

void stop_drawing HWND  window  ) 
 

Destroy any dc or other objects used to draw into this window.

HFONT xfont  ) 
 

Returns the operating-system dependent structure defining the current font. You must include <fltk/x.h> to use this.

COLORREF xpixel Color  i  ) 
 

Returns the X pixel number used to draw the given FLTK color. If a colormapped visual is being used, this may allocate it, or find the nearest match.


Variable Documentation

COLORREF current_xpixel
 

The color picked by the most recent setcolor(Color).

HDC dc
 

The device context that is currently being drawn into.

MSG msg
 

The most recent message read by GetMessage() (which is called by wait(). This may not be the most recent message sent to an FLTK window (because our fun-loving friends at MicroSoft decided that calling the handle procedures directly would be a good idea sometimes...)

HINSTANCE xdisplay
 

The open X display. This is needed as an argument to most Xlib calls. Don't attempt to change it! This is NULL before open_display() is called.

HPALETTE xpalette
 

If non-zero this is the palette alloced by fltk on an 8-bit screen. Hopefully you can ignore this, I'm not even sure it works anymore.


Sun Jan 7 00:55:17 2007. FLTK ©2006 Bill Spitzak and others.
Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.