X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1fc25a89ac1e6c5208db24bfc0abc8666b791dc6..16aa9c84bca0619ff0a89267772ca30d80324951:/contrib/samples/ogl/studio/cspalette.cpp diff --git a/contrib/samples/ogl/studio/cspalette.cpp b/contrib/samples/ogl/studio/cspalette.cpp index 50c5aee777..23a238dc2a 100644 --- a/contrib/samples/ogl/studio/cspalette.cpp +++ b/contrib/samples/ogl/studio/cspalette.cpp @@ -14,7 +14,7 @@ #endif // For compilers that support precompilation, includes "wx.h". -#include +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop @@ -36,7 +36,7 @@ #include "cspalette.h" #include "symbols.h" -#if defined(__WXGTK__) || defined(__WXMOTIF__) +#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) #include "bitmaps/arrow.xpm" #include "bitmaps/texttool.xpm" #endif @@ -72,9 +72,9 @@ bool csEditorToolPalette::OnLeftClick(int toolIndex, bool toggled) void csEditorToolPalette::OnMouseEnter(int toolIndex) { - wxString msg(""); + wxString msg = wxEmptyString; if (toolIndex == PALETTE_ARROW) - msg = "Pointer"; + msg = _T("Pointer"); else if (toolIndex != -1) { csSymbol* symbol = wxGetApp().GetSymbolDatabase()->FindSymbol(toolIndex); @@ -106,7 +106,7 @@ bool csApp::CreatePalette(wxFrame *parent) win->SetDefaultSize(wxSize(10000, 40)); win->SetOrientation(wxLAYOUT_HORIZONTAL); win->SetAlignment(wxLAYOUT_TOP); - win->SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); + win->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); win->SetSashVisible(wxSASH_BOTTOM, TRUE); m_diagramPaletteSashWindow = win; @@ -115,33 +115,83 @@ bool csApp::CreatePalette(wxFrame *parent) // Load palette bitmaps #ifdef __WXMSW__ - wxBitmap PaletteArrow("arrowtool"); - wxBitmap TextTool("texttool"); -#elif defined(__WXGTK__) || defined(__WXMOTIF__) + wxBitmap PaletteArrow(_T("arrowtool")); + wxBitmap TextTool(_T("texttool")); + wxSize toolBitmapSize(32, 32); +#elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) wxBitmap PaletteArrow(arrow_xpm); wxBitmap TextTool(texttool_xpm); + wxSize toolBitmapSize(22, 22); #endif csEditorToolPalette *palette = new csEditorToolPalette(m_diagramPaletteSashWindow, ID_DIAGRAM_PALETTE, wxPoint(0, 0), wxSize(-1, -1), wxTB_HORIZONTAL|wxNO_BORDER); palette->SetMargins(2, 2); - palette->SetToolBitmapSize(wxSize(32, 32)); + palette->SetToolBitmapSize(toolBitmapSize); - palette->AddTool(PALETTE_ARROW, PaletteArrow, wxNullBitmap, TRUE, 0, -1, NULL, "Pointer"); - palette->AddTool(PALETTE_TEXT_TOOL, TextTool, wxNullBitmap, TRUE, 0, -1, NULL, "Text"); + palette->AddTool(PALETTE_ARROW, PaletteArrow, wxNullBitmap, TRUE, 0, -1, NULL, _T("Pointer")); + palette->AddTool(PALETTE_TEXT_TOOL, TextTool, wxNullBitmap, TRUE, 0, -1, NULL, _T("Text")); + wxChar** symbols = new wxChar*[20]; + int noSymbols = 0; + + symbols[noSymbols] = _T("Wide Rectangle"); + noSymbols ++; + + symbols[noSymbols] = _T("Thin Rectangle"); + noSymbols ++; + + symbols[noSymbols] = _T("Triangle"); + noSymbols ++; + + symbols[noSymbols] = _T("Octagon"); + noSymbols ++; + + // For some reason, we're getting Gdk errors with + // some shapes, such as ones that use DrawEllipse. +#ifndef __WXGTK__ + symbols[noSymbols] = _T("Group"); + noSymbols ++; + + symbols[noSymbols] = _T("Circle"); + noSymbols ++; + + symbols[noSymbols] = _T("Circle shadow"); + noSymbols ++; + + symbols[noSymbols] = _T("SemiCircle"); + noSymbols ++; +#endif + + int i; + for (i = 0; i < noSymbols; i++) + { + csSymbol* symbol = GetSymbolDatabase()->FindSymbol(symbols[i]); + if (symbol) + { + wxBitmap* bitmap = GetSymbolDatabase()->CreateToolBitmap(symbol, toolBitmapSize); + palette->AddTool(symbol->GetToolId(), *bitmap, wxNullBitmap, TRUE, 0, -1, NULL, symbol->GetName()); + + delete bitmap; + } + } + delete[] symbols; + +#if 0 wxNode* node = GetSymbolDatabase()->GetSymbols().First(); while (node) { csSymbol* symbol = (csSymbol*) node->Data(); - wxBitmap* bitmap = GetSymbolDatabase()->CreateToolBitmap(symbol); + + wxBitmap* bitmap = GetSymbolDatabase()->CreateToolBitmap(symbol, toolBitmapSize); palette->AddTool(symbol->GetToolId(), *bitmap, wxNullBitmap, TRUE, 0, -1, NULL, symbol->GetName()); delete bitmap; node = node->Next(); } +#endif palette->Realize();