#include "wx/button.h"
#include "wx/string.h"
+// defaults
+#define NB_DEFAULT_MARGIN 2
+
// button label-text alignment types
#define NB_ALIGN_TEXT_RIGHT 0
bool isFlat = TRUE,
// this is the default type of fired events
int firedEventType = wxEVT_COMMAND_MENU_SELECTED,
- int marginX = 2,
- int marginY = 2,
+ int marginX = NB_DEFAULT_MARGIN,
+ int marginY = NB_DEFAULT_MARGIN,
int textToLabelGap = 2,
bool isSticky = FALSE
);
bool isFlat = TRUE,
// this is the default type of fired events
int firedEventType = wxEVT_COMMAND_MENU_SELECTED,
- int marginX = 2,
- int marginY = 2,
+ int marginX = NB_DEFAULT_MARGIN,
+ int marginY = NB_DEFAULT_MARGIN,
int textToLabelGap = 2,
bool isSticky = FALSE
);
// Sets the text alignment and margins.
virtual void SetAlignments( int alignText = NB_ALIGN_TEXT_BOTTOM,
- int marginX = 2,
- int marginY = 2,
+ int marginX = NB_DEFAULT_MARGIN,
+ int marginY = NB_DEFAULT_MARGIN,
int textToLabelGap = 2);
// Draws the decorations.
// Responds to a kill focus event.
void OnKillFocus( wxFocusEvent& event );
+ // Maps bitmap to current system colours on Windows
+#ifdef __WXMSW__
+ WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height);
+#endif
+
DECLARE_EVENT_TABLE()
};
#include "wx/fl/newbmpbtn.h"
#include "wx/utils.h" // import wxMin,wxMax macros
+#ifdef __WXMSW__
+#include "wx/msw/private.h"
+#endif
+
///////////// button-label rendering helpers //////////////////
static int* create_array( int width, int height, int fill = 0 )
destBmp->GetHeight() + mMarginY*2, 0
);
}
+ destDc.SelectObject( wxNullBitmap );
+
+#ifdef __WXMSW__
+ // Map to system colours
+ (void) MapBitmap(destBmp->GetHBITMAP(), destBmp->GetWidth(), destBmp->GetHeight());
+#endif
}
+
void wxNewBitmapButton::RenderAllLabelImages()
{
if ( !mIsCreated )
wxMessageBox("kill-focus for button!");
}
+#ifdef __WXMSW__
+WXHBITMAP wxNewBitmapButton::MapBitmap(WXHBITMAP bitmap, int width, int height)
+{
+ MemoryHDC hdcMem;
+
+ if ( !hdcMem )
+ {
+ wxLogLastError(_T("CreateCompatibleDC"));
+
+ return bitmap;
+ }
+
+ SelectInHDC bmpInHDC(hdcMem, (HBITMAP)bitmap);
+
+ if ( !bmpInHDC )
+ {
+ wxLogLastError(_T("SelectObject"));
+
+ return bitmap;
+ }
+
+ wxCOLORMAP *cmap = wxGetStdColourMap();
+
+ for ( int i = 0; i < width; i++ )
+ {
+ for ( int j = 0; j < height; j++ )
+ {
+ COLORREF pixel = ::GetPixel(hdcMem, i, j);
+
+ for ( size_t k = 0; k < wxSTD_COL_MAX; k++ )
+ {
+ COLORREF col = cmap[k].from;
+ if ( abs(GetRValue(pixel) - GetRValue(col)) < 10 &&
+ abs(GetGValue(pixel) - GetGValue(col)) < 10 &&
+ abs(GetBValue(pixel) - GetBValue(col)) < 10 )
+ {
+ ::SetPixel(hdcMem, i, j, cmap[k].to);
+ break;
+ }
+ }
+ }
+ }
+
+ return bitmap;
+}
+#endif
helpwin.cpp MSW
icon.cpp MSW LowLevel
imaglist.cpp MSW Win32Only,LowLevel
-iniconf.cpp MSW NotWin32
+iniconf.cpp MSW
joystick.cpp MSW
listbox.cpp MSW
listctrl.cpp MSW Win32Only
- the separators are not seen behind the controls added to the toolbar any more
- wxLB_SORT style can be used with wxCheckListBox
- wxWindowDC and wxClientDC::GetSize() works correctly now
+- Added wxTB_NODIVIDER and wxTB_NOALIGN so native toolbar can
+ be used in FL
wxGTK:
\twocolitem{\windowstyle{wxTB\_VERTICAL}}{Specifies vertical layout (not available for the GTK and Windows 95
toolbar).}
\twocolitem{\windowstyle{wxTB\_3DBUTTONS}}{Gives wxToolBarSimple a mild 3D look to its buttons.}
-\twocolitem{\windowstyle{wxTB\_TEXT}}{Show the text in the toolbar buttons, by default only icons are shown}
-\twocolitem{\windowstyle{wxTB\_NOICONS}}{Doesn't show the icons in the toolbar buttons, by default they are shown}
+\twocolitem{\windowstyle{wxTB\_TEXT}}{Show the text in the toolbar buttons; by default only icons are shown.}
+\twocolitem{\windowstyle{wxTB\_NOICONS}}{Specifies no icons in the toolbar buttons; by default they are shown.}
+\twocolitem{\windowstyle{wxTB\_NODIVIDER}}{Specifies no divider above the toolbar; by default it is shown. Windows only.}
+\twocolitem{\windowstyle{wxTB\_NOALIGN}}{Specifies no alignment with the parent window. Windows only.}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}. Note that the Win32
#define wxTB_DOCKABLE 0x0040 // use native docking under GTK
#define wxTB_NOICONS 0x0080 // don't show the icons
#define wxTB_TEXT 0x0100 // show the text
+#define wxTB_NODIVIDER 0x0200 // don't show the divider (Windows)
+#define wxTB_NOALIGN 0x0400 // no automatic alignment (Windows)
/*
* wxStatusBar95 flags
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
+ void Clear() ;
+
private:
void SetName(const wxChar *charset);
#include "wx/intl.h"
#endif // PCH
+#include "wx/module.h"
#include "wx/fontmap.h"
#if wxUSE_CONFIG
// global data
// ----------------------------------------------------------------------------
-// private object
-static wxFontMapper gs_fontMapper;
+wxFontMapper * wxTheFontMapper = NULL;
-// and public pointer
-wxFontMapper * wxTheFontMapper = &gs_fontMapper;
+class wxFontMapperModule: public wxModule
+{
+public:
+ wxFontMapperModule() : wxModule() { }
+ virtual bool OnInit() { wxTheFontMapper = new wxFontMapper; return TRUE; }
+ virtual void OnExit()
+ {
+ delete wxTheFontMapper;
+ wxTheFontMapper = NULL;
+ }
+
+ DECLARE_DYNAMIC_CLASS(wxFontMapperModule)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxFontMapperModule, wxModule)
// ----------------------------------------------------------------------------
// private classes
{
delete gs_mimeTypesManager.m_impl;
gs_mimeTypesManager.m_impl = NULL;
+ gs_mimeTypesManager.m_fallbacks.Clear();
}
}
#include <string.h>
#include <stdlib.h>
+#include "wx/module.h"
#include "wx/strconv.h"
// ----------------------------------------------------------------------------
WXDLLEXPORT_DATA(wxMBConv *) wxConvCurrent = &wxConvLibc;
+class wxStrConvModule: public wxModule
+{
+public:
+ wxStrConvModule() : wxModule() { }
+ virtual bool OnInit() { return TRUE; }
+ virtual void OnExit()
+ {
+ wxConvLocal.Clear();
+ }
+
+ DECLARE_DYNAMIC_CLASS(wxStrConvModule)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxStrConvModule, wxModule)
+
+
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
wxCSConv::~wxCSConv()
{
- free(m_name);
- delete m_cset;
+ Clear();
+}
+
+void wxCSConv::Clear()
+{
+ if (m_name)
+ free(m_name);
+ if (m_cset)
+ delete m_cset;
+ m_name = NULL;
+ m_cset = NULL;
}
void wxCSConv::SetName(const wxChar *charset)
msflags |= TBSTYLE_FLAT | TBSTYLE_TRANSPARENT;
}
}
+ if (style & wxTB_NODIVIDER)
+ msflags |= CCS_NODIVIDER;
+ if (style & wxTB_NOALIGN)
+ msflags |= CCS_NOPARENTALIGN;
// MSW-specific initialisation
if ( !wxControl::MSWCreateControl(TOOLBARCLASSNAME, msflags) )
if ( m_maxRows )
{
// FIXME: 6 is hardcoded separator line height...
- h += 6;
+ //h += 6;
+ if (HasFlag(wxTB_NODIVIDER))
+ h += 3;
+ else
+ h += 6;
h *= m_maxRows;
}
}