X11 Work Bench Toolkit  1.0
frame_window.c File Reference

Frame Window API function implementation. More...

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <memory.h>
#include <string.h>
#include <strings.h>
#include <signal.h>
#include <time.h>
#include "window_helper.h"
#include "pixmap_helper.h"
#include "frame_window.h"
#include "child_frame.h"
#include "conf_help.h"
#include "draw_text.h"
#include "dialog_window.h"

Go to the source code of this file.

Macros

#define _FRAME_WINDOW_C_   /* because of the atoms */
 
#define TAB_BAR_HEIGHT   24 /* for now */
 
#define TAB_BAR_TAB_WIDTH   20 /* 20 average characters wide */
 
#define TAB_BAR_SCROLL_WIDTH   12 /* width of 'tab scroll' buttons */
 
#define TAB_BAR_ADD_BUTTON_WIDTH   12 /* width of 'tab add' button */
 
#define STATUS_BAR_HEIGHT   20
 
#define DEFAULT_STATUS_BAR_TAB   16 /* default 16 characters per column */
 
#define DEFAULT_STATUS_STRING   "Status: none"
 
#define FRAME_WINDOW_MIN_WIDTH   (100 + 12 * TAB_BAR_TAB_WIDTH) /* re-sizable window absolute minimum width */
 
#define FRAME_WINDOW_MIN_HEIGHT   (100 + TAB_BAR_HEIGHT + STATUS_BAR_HEIGHT) /* re-sizable window absolute minimum height */
 
#define NEW_TAB_MESSAGE   1
 
#define NEXT_TAB_MESSAGE   2
 
#define PREV_TAB_MESSAGE   3
 
#define SET_TAB_MESSAGE   4
 
#define CLOSE_TAB_MESSAGE   5
 
#define REORDER_TAB_MESSAGE   6
 
#define LOAD_COLOR0(X, Y)   if(CHGetResourceString(WBGetDefaultDisplay(), X, Y, sizeof(Y)) > 0) { }
 
#define LOAD_COLOR(X, Y, Z)   if(CHGetResourceString(WBGetDefaultDisplay(), X, Y, sizeof(Y)) <= 0){ WB_WARN_PRINT("%s - WARNING: can't find color %s, using default value %s\n", __FUNCTION__, X, Z); strcpy(Y,Z); }
 
#define __SIZEOF_POINTER__   0
 

Typedefs

typedef struct __FRAME_WINDOW__ FRAME_WINDOW
 

Enumerations

enum  __tab_bar_button_flags__ {
  tab_bar_button_PREV = 1, tab_bar_button_NEXT = 2, tab_bar_button_NEW = 4, tab_bar_button_BUTTONMASK = 7,
  tab_bar_button_GRAB = 8
}
 

Functions

int FWDefaultCallback (Window wID, XEvent *pEvent)
 
static FRAME_WINDOW * InternalGet_FRAME_WINDOW (WBFrameWindow *pFW)
 
static void InternalPaintTabBar (FRAME_WINDOW *pFrameWindow, XExposeEvent *pEvent)
 
static void InternalPaintStatusBar (FRAME_WINDOW *pFrameWindow, XExposeEvent *pEvent)
 
static int Internal_Tab_Bar_Event (FRAME_WINDOW *pFrameWindow, XEvent *pEvent)
 
static void InternalCalcStatusBarRect (FRAME_WINDOW *pFrameWindow, WB_RECT *pRect)
 
static void InternalCalcTabBarRect (FRAME_WINDOW *pFrameWindow, WB_RECT *pRect)
 
int __internal_do_status_tab_cols (FRAME_WINDOW *pFrameWindow, const WB_RECT *prct, char ***pppCols, char **ppData, struct __status_tab_cols__ **ppTabs, int *pnCol)
 
static void __internal_destroy_frame_window (FRAME_WINDOW *pTemp)
 
void WBFrameWindowExit ()
 
static void InternalCheckFWAtoms (void)
 
static void InternalCheckFWColors (void)
 
XColor FWGetDefaultFG (void)
 Get the default foreground color. More...
 
XColor FWGetDefaultBG (void)
 Get the default background color. More...
 
XColor FWGetDefaultBD (void)
 Get the default border color. More...
 
WBFrameWindowFWCreateFrameWindow (const char *szTitle, int idIcon, const char *szMenuResource, int iX, int iY, int iWidth, int iHeight, WBWinEvent pUserCallback, int iFlags)
 Create a frame window. More...
 
void FWDestroyFrameWindow (Window wID)
 Function to destroy a frame window based on the Window id. More...
 
void FWDestroyFrameWindow2 (WBFrameWindow *pFrameWindow)
 Function to destroy a frame window based on the WBFrameWindow structure. More...
 
void FWSetUserCallback (WBFrameWindow *pFW, WBWinEvent pCallBack)
 assign a new WBWinEvent callback function for a frame window More...
 
void FWSetMenuHandlers (WBFrameWindow *pFW, const WBFWMenuHandler *pHandlerArray)
 Function to assign the default menu handler to a frame window. More...
 
void FWRecalcLayout (Window wID)
 Force a frame window to recalculate its layout, which may involve resizing multiple contained windows. More...
 
int FWGetNumContWindows (const WBFrameWindow *pFW)
 Returns the total number of 'contained' windows. More...
 
WBChildFrameFWGetContainedWindowByIndex (const WBFrameWindow *pFW, int iIndex)
 Returns the Window ID for the specified 'contained' window. The index follows the tab order. More...
 
int FWAddContainedWindow (WBFrameWindow *pFW, WBChildFrame *pNew)
 Adds a 'contained' window and returns the tab order index. More...
 
void FWRemoveContainedWindow (WBFrameWindow *pFW, WBChildFrame *pCont)
 Removes a 'contained' window from a frame window. Does not destroy the 'contained' window. More...
 
void FWReplaceContainedWindow (WBFrameWindow *pFW, WBChildFrame *pCont, WBChildFrame *pContNew)
 Replace a 'contained' window from a frame window. More...
 
void FWSetFocusWindow (WBFrameWindow *pFW, WBChildFrame *pCont)
 Sets the focus to a specific contained window using the Window ID. More...
 
void FWSetFocusWindowIndex (WBFrameWindow *pFW, int iIndex)
 Sets the focus to a specific contained window using its tab order index. More...
 
int FWGetChildFrameIndex (WBFrameWindow *pFW, WBChildFrame *pCont)
 Sets the focus to a specific contained window using its tab order index. More...
 
void FWMoveChildFrameTabIndex (WBFrameWindow *pFW, WBChildFrame *pCont, int iIndex)
 Sets the specific contained window to a particular index in the tab order. More...
 
void FWSetStatusText (WBFrameWindow *pFW, const char *szText)
 Sets the 'status' text for a Frame Window with a status bar, forcing a re-paint. More...
 
void FWSetStatusTabInfo (WBFrameWindow *pFW, int nTabs, const int *pTabs)
 Sets the 'status' tab info for a Frame Window with a status bar. More...
 
static void Internal_CalcTabRect (FRAME_WINDOW *pFrameWindow, int iIndex, WB_RECT *prctTab)
 
static void Internal_CalcTabGeom (FRAME_WINDOW *pFrameWindow, int iIndex, WB_GEOM *pgTab)
 

Variables

static FRAME_WINDOW * pFrames = NULL
 
static XColor clrFG
 
static XColor clrBG
 
static XColor clrBD
 
static XColor clrBD2
 
static XColor clrBD3
 
static XColor clrABG
 
static int iInitColorFlag = 0
 
Atom aTAB_MESSAGE
 command sent by Client Message related to 'tab' operations
 

Detailed Description

Frame Window API function implementation.

A frame window is a top level window that can have a menu and an icon, and may contain child windows within it. It can USUALLY be resized, minimized, and maximized.

Definition in file frame_window.c.