/* Window "privates". Copyright (C) 2001 Johan Rydberg. All Rights Reserved. This file is part of Crust. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __ServicesFoundation_SXWindow_h #define __ServicesFoundation_SXWindow_h 1 #include #include #include #include #include #define SHADOW_WIDTH 8 #define SHADOW_HEIGHT 8 /* We have two surfaces living on one layer per window. The content surface contains window titlebar, resizebar and window contents. Shadow surface just contains the shadow for the surface. */ struct SFWindow { CFRuntimeBase runtime_base; /* Layer for the whole window. */ SFLayerRef window_layer; /* Surface for the WHOLE window. */ SFSurfaceRef window_surface; /* Surface for shadow. */ SFSurfaceRef shadow_surface; /* Pixbufs (images) for different parts of the window. */ GFImageRef pixbuf_titlebar; GFImageRef pixbuf_resizebar; GFImageRef pixbuf_content; /* We have three standard tracking areas for the titlebar: . bar area - used for moving window. . close - close button area. . mini - minimize button area. */ struct { SFTrackingAreaRef titlebar_bar; SFTrackingAreaRef titlebar_close; SFTrackingAreaRef titlebar_mini; /* ??? add other tracking areas here. */ } tracking_areas; /* Runtime flags for the window: . flag_active: TRUE if window is active . flag_focused: TRUE if we currently have cursor. . flag_drag: TRUE if we're moving window. */ unsigned int flag_active : 1; unsigned int flag_focused : 1; unsigned int flag_drag : 1; /* Last mouse position. Used when dragging window. */ int mouse_pos_x; int mouse_pos_y; /* Style mask for window. */ SFWindowStyleMask style_mask; /* Window level that this window belongs to. */ SFWindowLevel window_level; /* Frame of window (total) and content rectange. */ GFRect frame_rect; GFRect content_rect; }; /* Create a window that will live in TOPLAYER. LEVEL is just the for setting in the window structure. It is not used when creating the window. */ /* ??? release resources if we fail any step. */ SF_EXTERN SFWindowRef SXWindowCreate (SFLayerRef toplayer, GFRect frame_rect, char *title, SFWindowStyleMask style_mask, SFWindowLevel level); /* Update shadow image for WINDOW. */ SF_EXTERN void SXWindowUpdateShadow (SFWindowRef window); #endif /* SXWindow.h */