X11 Work Bench Toolkit  1.0
window_dressing.h
Go to the documentation of this file.
1 
2 // _ _ _ _ _ //
3 // __ __(_) _ __ __| | ___ __ __ __| | _ __ ___ ___ ___ (_) _ __ __ _ | |__ //
4 // \ \ /\ / /| || '_ \ / _` | / _ \\ \ /\ / / / _` || '__|/ _ \/ __|/ __|| || '_ \ / _` | | '_ \ //
5 // \ V V / | || | | || (_| || (_) |\ V V / | (_| || | | __/\__ \\__ \| || | | || (_| | _ | | | | //
6 // \_/\_/ |_||_| |_| \__,_| \___/ \_/\_/_____\__,_||_| \___||___/|___/|_||_| |_| \__, |(_)|_| |_| //
7 // |_____| |___/ //
8 // //
9 // Utilities for painting and handling standard components of windows //
10 // //
12 
13 /*****************************************************************************
14 
15  X11workbench - X11 programmer's 'work bench' application and toolkit
16  Copyright (c) 2010-2016 by Bob Frazier (aka 'Big Bad Bombastic Bob')
17  all rights reserved
18 
19  DISCLAIMER: The X11workbench application and toolkit software are supplied
20  'as-is', with no warranties, either implied or explicit.
21  Any claims to alleged functionality or features should be
22  considered 'preliminary', and might not function as advertised.
23 
24  BSD-like license:
25 
26  There is no restriction as to what you can do with this software, so long
27  as you include the above copyright notice and DISCLAIMER for any distributed
28  work that is equal to or derived from this one, along with this paragraph
29  that explains the terms of the license if the source is also being made
30  available. A "derived work" describes a work that uses a significant portion
31  of the source files or algorithms that are included with this one.
32  Specifically excluded from this are files that were generated by the software,
33  or anything that is included with the software that is part of another package
34  (such as files that were created or added during the 'configure' process).
35  Specifically included is the use of part or all of any of the X11 workbench
36  toolkit source or header files in your distributed application. If you do not
37  ship the source, the above copyright statement is still required to be placed
38  in a reasonably prominent place, such as documentation, splash screens, and/or
39  'about the application' dialog boxes.
40 
41  Use and distribution are in accordance with GPL, LGPL, and/or the above
42  BSD-like license. See COPYING and README files for more information.
43 
44 
45  Additional information at http://sourceforge.net/projects/X11workbench
46 
47 ******************************************************************************/
48 
49 
50 #ifndef _WINDOW_DRESSING_H_INCLUDED_
51 #define _WINDOW_DRESSING_H_INCLUDED_
52 
53 #include "window_helper.h" // make sure
54 #include "font_helper.h" // make sure
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif // __cplusplus
59 
60 
64 // SCROLL BARS
65 
117 typedef struct __WB_SCROLLINFO__
118 {
120 
121  // fixed dimension sizes - 0 if not known, else based on owner client width/height
126 
127  int iHKnob;
128  int iVKnob;
131 
132  int iHMin;
133  int iHMax;
134  int iVMin;
135  int iVMax;
136 
137  int iHPos;
138  int iVPos;
139 
148 } WB_SCROLLINFO;
149 
150 
160 {
167 };
168 
169 
179 static __inline__ void WBInitScrollInfo(WB_SCROLLINFO *pSI) { bzero(pSI, sizeof(*pSI)); pSI->iHPos = pSI->iVPos = -1; }
180 
193 void WBSetVScrollRange(WB_SCROLLINFO *pSI, int iMin, int iMax);
194 
207 void WBSetHScrollRange(WB_SCROLLINFO *pSI, int iMin, int iMax);
208 
220 void WBSetVScrollPos(WB_SCROLLINFO *pSI, int iPos);
221 
233 void WBSetHScrollPos(WB_SCROLLINFO *pSI, int iPos);
234 
248 void WBUpdateScrollBarGeometry(WB_SCROLLINFO *pSI, XFontSet fontSetRef,
249  WB_GEOM *pgeomClient, WB_GEOM *pgeomUsable);
250 
262 int WBCalcVScrollDragPos(WB_SCROLLINFO *pScrollInfo, int iY); // 'iY' is the 'y' value for the mouse position relative to window orig
263 
275 int WBCalcHScrollDragPos(WB_SCROLLINFO *pScrollInfo, int iX); // 'iX' is the 'x' value for the mouse position relative to window orig
276 
277 // internal SCROLLINFO utilities for list-based dialog controls
292 void WBCalcVScrollBar(WB_SCROLLINFO *pScrollInfo, WB_GEOM *pgeomClient, int iVScrollWidth,
293  int iHScrollHeight, int nListItems, int nPos); // calculates V scroll geometry for paint
294 
309 void WBCalcHScrollBar(WB_SCROLLINFO *pScrollInfo, WB_GEOM *pgeomClient, int iVScrollWidth,
310  int iHScrollHeight, int nListItems, int nPos); // calculates H scroll geometry for paint
311 
325 void WBPaintVScrollBar(WB_SCROLLINFO *pScrollInfo, Display *pDisplay, Drawable wID,
326  GC gc, WB_GEOM *pgeomClient);
327 
341 void WBPaintHScrollBar(WB_SCROLLINFO *pScrollInfo, Display *pDisplay, Drawable wID,
342  GC gc, WB_GEOM *pgeomClient);
343 
344 // borders and '3D' rectangle art
345 
359 void WBDrawBorderRect(Display *pDisplay, Drawable wID, GC gc,
360  WB_GEOM *pgeomBorder, unsigned long lBorderColor);
361 
376 void WBDraw3DBorderRect(Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomBorder,
377  unsigned long lBorderColor1, unsigned long lBorderColor2);
378 
392 void WBDrawDashedRect(Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomRect, unsigned long lColor);
393 
394 
408 void WBDrawLeftArrow(Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomRect, unsigned long lColor);
409 
423 void WBDrawRightArrow(Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomRect, unsigned long lColor);
424 
438 void WBDrawUpArrow(Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomRect, unsigned long lColor);
439 
453 void WBDrawDownArrow(Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomRect, unsigned long lColor);
454 
455 
487 void WBDraw3DBorderTab(Display *pDisplay, Drawable wID, GC gc, WB_GEOM *pgeomOutline,
488  int fFocus, unsigned long lFGColor, unsigned long lBGColor,
489  unsigned long lBorderColor1, unsigned long lBorderColor2,
490  unsigned long lHighlightColor,
491  XFontSet fontSet, XFontSet fontSetBold,
492  Atom aGraphic, const char *szText);
493 
494 
495 
496 #ifdef __cplusplus
497 };
498 #endif // __cplusplus
499 
500 
501 #endif // _WINDOW_DRESSING_H_INCLUDED_
502 
503 
504