Create a window region
PhRid_t PhWindowOpen( unsigned fields, const PhRegion_t *region, const PhRect_t *rect, const PhWindowInfo_t *win_info );
This function creates a window region that will be managed by the Window Manager in the Photon event space. The Window Manager will provide a region to act as a frame in addition to the region created by the calling application.
The fields argument describes which members specified by region will be used. If some fields aren't specified, the function sets the corresponding members of the new region to their default values.
The region argument is a template region used when opening the new region. You must set the parent member of region; Photon fills in the other family members.
The rect argument points to the rectangle associated with the region, and win_info points to a description of the window's attributes, as specified in the PhWindowInfo_t structure (see PhWm.h).
The region ID of the new window's interior (not the RID of the frame).
If an error occurred, this function returns:
#include <Ph.h> open_raw_window( long parent_rid, long handle, PhArea_t *area, PhRid_t win_in_front, unsigned render_flags, unsigned managed_flags, unsigned notify_flags, unsigned state, PgColor_t title_color, short cursor_type, PgColor_t cursor_color, int flags ) { PhRegion_t region; PhRect_t rect; PhWindowInfo_t win_info; int xoff, yoff, woff, hoff; memset( ®ion, 0, sizeof region ); memset( &win_info, 0, sizeof win_info ); rect.ul.x = rect.ul.y = 0; rect.lr.x = area->dim.w -1; rect.lr.y = area->dim.h -1; region.parent = parent_rid; region.handle = (long)handle; // The constants used below are defined // in <photon/PhT.h> region.events_sense = Ph_EV_WIN_SENSE; region.events_opaque = Ph_EV_WIN_OPAQUE; region.origin.x = area->pos.x; region.origin.y = area->pos.y; region.cursor_type = cursor_type; region.cursor_color = cursor_color; region.data_len = sizeof( win_info ); if( flags & ( 1 << Pt_WINDOW_FORCE_FRONT ) ) region.flags |= Ph_FORCE_FRONT; // following defined in PhWm.h win_info.fields = Ph_WM_SET_FLAGS | Ph_WM_SET_STATE | Ph_WM_SET_RENDER | Ph_WM_SET_FRAME_ATTRIB; if( title ) { win_info.fields |= Ph_WM_SET_TITLE; strcpy( win_info.title, title ); } if ( win_in_front != 0) { win_info.fields |= Ph_WM_SET_FRONT_WINDOW; win_info.win_in_front = win_in_front; } win_info.render_f = render_flags; win_info.managed_f = managed_flags; win_info.notify_f = notify_flags | Ph_WM_FOCUS | (managed_flags & Ph_WM_MOVE); win_info.state_f = state; if( flags & Pt_BLOCKED ) win_info.state_f |= Ph_WM_STATE_ISBLOCKED; else win_info.state_f &= ~Ph_WM_STATE_ISBLOCKED; if ((window->managed_flags | window->notify_flags) & Ph_WM_MOVE) win_info.render_f |= Ph_WM_RENDER_MOVE; else win_info.render_f &= ~Ph_WM_RENDER_MOVE; // frame attributes PtFrameSize( render_flags, 1, &xoff, &yoff, &woff, &hoff ); win_info.dim_min.h = 100 + yoff + hoff; win_info.dim_min.w = 100 + xoff + woff; if( max_height ) win_info.dim_max.h = 480 + yoff + hoff; if( max_width ) win_info.dim_max.w = 640 + xoff + woff; win_info.frame_active_color = Pg_GREEN; win_info.frame_inactive_color = Pg_GREY; win_info.title_color = "Test Window"; win_info.version = 110; win_info.rhdr.type = Ph_RDATA_WINDOW; win_info.rhdr.len = sizeof( win_info ); if( ( rid = PhWindowOpen( Ph_REGION_RECT | Ph_REGION_HANDLE | Ph_REGION_EV_SENSE | Ph_REGION_EV_OPAQUE | Ph_REGION_DATA | Ph_REGION_CURSOR | Ph_REGION_FLAGS | set_flags, ®ion, &rect, &win_info ) ) <= 0 ) { return( -1 ); } return( rid ); }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PhWindowChange(), PhRegionChange(), PhWindowClose(), PhRegionOpen()
See PhWm.h for a description of PhWindowInfo_t.