1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tbarmsw.h
|
|
|
|
// Purpose: wxToolBarMSW class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_TBARMSW_H_
|
|
|
|
#define _WX_TBARMSW_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "tbarmsw.h"
|
|
|
|
#endif
|
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#if wxUSE_BUTTONBAR && wxUSE_TOOLBAR
|
1999-06-08 06:08:05 -04:00
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
#include "wx/tbarbase.h"
|
|
|
|
|
|
|
|
WXDLLEXPORT_DATA(extern const char*) wxButtonBarNameStr;
|
|
|
|
|
1998-07-27 05:47:57 -04:00
|
|
|
class WXDLLEXPORT wxMemoryDC;
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
// Non-Win95 (WIN32, WIN16, UNIX) version
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxToolBarMSW: public wxToolBarBase
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxToolBarMSW)
|
|
|
|
public:
|
|
|
|
/*
|
|
|
|
* Public interface
|
|
|
|
*/
|
|
|
|
wxToolBarMSW(void);
|
|
|
|
|
1998-07-04 11:17:59 -04:00
|
|
|
inline wxToolBarMSW(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
1998-07-27 05:47:57 -04:00
|
|
|
long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxButtonBarNameStr)
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1998-07-27 05:47:57 -04:00
|
|
|
Create(parent, id, pos, size, style, name);
|
1998-05-20 10:12:05 -04:00
|
|
|
}
|
1998-07-04 11:17:59 -04:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
1998-07-27 05:47:57 -04:00
|
|
|
long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxButtonBarNameStr);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
~wxToolBarMSW(void);
|
|
|
|
|
|
|
|
// Handle wxWindows events
|
|
|
|
void OnPaint(wxPaintEvent& event);
|
|
|
|
void OnSize(wxSizeEvent& event);
|
|
|
|
void OnMouseEvent(wxMouseEvent& event);
|
|
|
|
|
|
|
|
// If pushedBitmap is NULL, a reversed version of bitmap is
|
|
|
|
// created and used as the pushed/toggled image.
|
|
|
|
// If toggle is TRUE, the button toggles between the two states.
|
1998-07-04 11:17:59 -04:00
|
|
|
wxToolBarTool *AddTool(int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap,
|
|
|
|
bool toggle = FALSE, long xPos = -1, long yPos = -1, wxObject *clientData = NULL,
|
1998-12-28 07:35:49 -05:00
|
|
|
const wxString& helpString1 = wxEmptyString, const wxString& helpString2 = wxEmptyString);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
void DrawTool(wxDC& dc, wxMemoryDC& memDc, wxToolBarTool *tool);
|
|
|
|
|
|
|
|
// Set default bitmap size
|
1998-07-27 05:47:57 -04:00
|
|
|
virtual void SetToolBitmapSize(const wxSize& size);
|
1998-07-04 11:17:59 -04:00
|
|
|
void EnableTool(int toolIndex, bool enable); // additional drawing on enabling
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// The button size is bigger than the bitmap size
|
1998-07-27 05:47:57 -04:00
|
|
|
wxSize GetToolSize(void) const;
|
|
|
|
|
1999-05-09 20:42:57 -04:00
|
|
|
void LayoutTools();
|
1998-07-27 05:47:57 -04:00
|
|
|
|
|
|
|
// The post-tool-addition call
|
|
|
|
bool Realize() { Layout(); return TRUE; };
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
protected:
|
|
|
|
void DrawTool(wxDC& dc, wxToolBarTool *tool, int state);
|
|
|
|
|
|
|
|
void GetSysColors(void);
|
|
|
|
bool InitGlobalObjects(void);
|
|
|
|
void FreeGlobalObjects(void);
|
|
|
|
void PatB(WXHDC hdc,int x,int y,int dx,int dy, long rgb);
|
|
|
|
void CreateMask(WXHDC hDC, int xoffset, int yoffset, int dx, int dy);
|
|
|
|
void DrawBlankButton(WXHDC hdc, int x, int y, int dx, int dy, int state);
|
|
|
|
void DrawButton(WXHDC hdc, int x, int y, int dx, int dy, wxToolBarTool *tool, int state);
|
|
|
|
WXHBITMAP CreateDitherBitmap();
|
|
|
|
bool CreateDitherBrush(void);
|
|
|
|
bool FreeDitherBrush(void);
|
|
|
|
WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, void *lpBitmapInfo);
|
|
|
|
WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap);
|
|
|
|
|
1998-07-27 05:47:57 -04:00
|
|
|
protected:
|
|
|
|
int m_currentRowsOrColumns;
|
|
|
|
long m_lastX, m_lastY;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
WXHBRUSH m_hbrDither;
|
|
|
|
WXDWORD m_rgbFace;
|
|
|
|
WXDWORD m_rgbShadow;
|
|
|
|
WXDWORD m_rgbHilight;
|
|
|
|
WXDWORD m_rgbFrame;
|
|
|
|
|
|
|
|
//
|
|
|
|
// m_hdcMono is the DC that holds a mono bitmap, m_hbmMono
|
|
|
|
// that is used to create highlights
|
|
|
|
// of button faces.
|
|
|
|
// m_hbmDefault hold the default bitmap if there is one.
|
|
|
|
//
|
|
|
|
WXHDC m_hdcMono;
|
|
|
|
WXHBITMAP m_hbmMono;
|
|
|
|
WXHBITMAP m_hbmDefault;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// States (not all of them currently used)
|
|
|
|
//
|
|
|
|
#define wxTBSTATE_CHECKED 0x01 // radio button is checked
|
|
|
|
#define wxTBSTATE_PRESSED 0x02 // button is being depressed (any style)
|
|
|
|
#define wxTBSTATE_ENABLED 0x04 // button is enabled
|
|
|
|
#define wxTBSTATE_HIDDEN 0x08 // button is hidden
|
|
|
|
#define wxTBSTATE_INDETERMINATE 0x10 // button is indeterminate
|
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#endif // wxUSE_TOOL/BUTTONBAR
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_TBARMSW_H_
|