File: cswsutil.h

package info (click to toggle)
crystalspace 0.94-20020412-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 62,276 kB
  • ctags: 52,843
  • sloc: cpp: 274,783; ansic: 6,608; perl: 6,276; objc: 3,952; asm: 2,942; python: 2,354; php: 542; pascal: 530; sh: 430; makefile: 370; awk: 193
file content (94 lines) | stat: -rw-r--r-- 3,446 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
    Crystal Space Windowing System: Miscelaneous CSWS utilites
    Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library 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
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __CSWSUTIL_H__
#define __CSWSUTIL_H__

#define CSWS_INTERNAL
#include "csws.h"
#include "cswindow.h"

/**
 * Window List class<p>
 * A window of this type is created when user clicks both mouse buttons
 * on application canvas.
 */
class csWindowList : public csWindow
{
protected:
  /// client dialog component
  csDialog *dialog;
  /// listbox containing window list
  csListBox *list;
  /// The buttons
  csButton *butshow, *butmaximize, *butclose;
  /// Window that was focused before WindowList itself
  csComponent *focusedwindow;
  /// Set to true when window list should close as soon as possible
  bool shouldclose;

public:
  /// Create a "window list" object
  csWindowList (csComponent *iParent);

  /// Set children positions on resize
  virtual bool SetRect (int xmin, int ymin, int xmax, int ymax);

  /// Override SetState method
  virtual void SetState (int mask, bool enable);

  /// Handle input events
  virtual bool HandleEvent (iEvent &Event);

protected:
  /// Rebuild window list
  void RebuildList ();
  /// Used in RebuildList ()
  static bool do_addtowindowlist (csComponent *child, void *param);
};

/// Compute the biggest union of a set of adjanced rectangles
/// (i.e. rectangles do not overlap and can have adjanced edges).
extern void RectUnion (cswsRectVector &rect, csRect &result);

/// Find a bitmap definition in one of CSWS.CFG bitmap arrays
extern void ParseConfigBitmap (csApp *app, const char *prefix,
  const char *section, const char *id, int &x, int &y, int &w, int &h);

/// Convert HLS to RGB
extern void csHLS2RGB (float h, float l, float s, float &r, float &g, float &b);
/// Convert RGB to HLS
extern void csRGB2HLS (float r, float g, float b, float &h, float &l, float &s);
/// Get a color's R,G,B components (iColor as returned by csApp::FindColor)
extern void csGetRGB (int iColor, csApp *iApp, float &r, float &g, float &b);

/// The short way to add a text button to a toolbar
extern csButton *csNewToolbarButton (csComponent *iToolbar, int iCommand,
  char *iText, csButtonFrameStyle iFrameStyle = csbfsThinRect,
  int iButtonStyle = CSBS_SHIFT | CSBS_TEXTBELOW);
/// The short way to add a icon button to a toolbar
extern csButton *csNewToolbarButton (csComponent *iToolbar, int iCommand,
  csPixmap *bmpup = NULL, csPixmap *bmpdn = NULL,
  csButtonFrameStyle iFrameStyle = csbfsThinRect,
  int iButtonStyle = CSBS_SHIFT, bool iDeletePixmaps = true);
/// Create and return a new bitmap (2D sprite)
extern csPixmap *NewBitmap (csApp *app, char *texturename, int tx, int ty,
  int tw, int th);

#endif // __CSWSUTIL_H__