b41ef0ff25268523fe6eb1e3f8f0297e70fc3017
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: OGLEdit palette
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 // #pragma implementation
16 // For compilers that support precompilation, includes "wx.h".
17 #include <wx/wxprec.h>
27 #include <wx/toolbar.h>
39 #if defined(__WXGTK__) || defined(__WXMOTIF__)
40 #include "bitmaps/arrow.xpm"
41 #include "bitmaps/tool1.xpm"
42 #include "bitmaps/tool2.xpm"
43 #include "bitmaps/tool3.xpm"
44 #include "bitmaps/tool4.xpm"
48 * Object editor tool palette
52 EditorToolPalette::EditorToolPalette(wxWindow
* parent
, const wxPoint
& pos
, const wxSize
& size
,
54 TOOLPALETTECLASS(parent
, -1, pos
, size
, style
)
56 currentlySelected
= -1;
58 #if 1 // ndef __WXGTK__
59 SetMaxRowsCols(1000, 1);
63 bool EditorToolPalette::OnLeftClick(int toolIndex
, bool toggled
)
65 // BEGIN mutual exclusivity code
66 if (toggled
&& (currentlySelected
!= -1) && (toolIndex
!= currentlySelected
))
67 ToggleTool(currentlySelected
, FALSE
);
70 currentlySelected
= toolIndex
;
71 else if (currentlySelected
== toolIndex
)
72 currentlySelected
= -1;
73 // END mutual exclusivity code
78 void EditorToolPalette::OnMouseEnter(int toolIndex
)
82 void EditorToolPalette::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
84 TOOLPALETTECLASS::SetSize(x
, y
, width
, height
, sizeFlags
);
87 EditorToolPalette
*MyApp::CreatePalette(wxFrame
*parent
)
89 // Load palette bitmaps
91 wxBitmap
PaletteTool1("TOOL1");
92 wxBitmap
PaletteTool2("TOOL2");
93 wxBitmap
PaletteTool3("TOOL3");
94 wxBitmap
PaletteTool4("TOOL4");
95 wxBitmap
PaletteArrow("ARROWTOOL");
96 #elif defined(__WXGTK__) || defined(__WXMOTIF__)
97 wxBitmap
PaletteTool1(tool1_xpm
);
98 wxBitmap
PaletteTool2(tool2_xpm
);
99 wxBitmap
PaletteTool3(tool3_xpm
);
100 wxBitmap
PaletteTool4(tool4_xpm
);
101 wxBitmap
PaletteArrow(arrow_xpm
);
104 EditorToolPalette
*palette
= new EditorToolPalette(parent
, wxPoint(0, 0), wxSize(-1, -1), wxTB_HORIZONTAL
);
106 palette
->SetMargins(2, 2);
109 if (palette
->IsKindOf(CLASSINFO(wxToolBar95
)))
110 ((wxToolBar95
*)palette
)->SetToolBitmapSize(wxSize(22, 22));
113 palette
->AddTool(PALETTE_ARROW
, PaletteArrow
, wxNullBitmap
, TRUE
, 0, -1, NULL
, "Pointer");
114 palette
->AddTool(PALETTE_TOOL1
, PaletteTool1
, wxNullBitmap
, TRUE
, 0, -1, NULL
, "Tool 1");
115 palette
->AddTool(PALETTE_TOOL2
, PaletteTool2
, wxNullBitmap
, TRUE
, 0, -1, NULL
, "Tool 2");
116 palette
->AddTool(PALETTE_TOOL3
, PaletteTool3
, wxNullBitmap
, TRUE
, 0, -1, NULL
, "Tool 3");
117 palette
->AddTool(PALETTE_TOOL4
, PaletteTool4
, wxNullBitmap
, TRUE
, 0, -1, NULL
, "Tool 4");
121 palette
->ToggleTool(PALETTE_ARROW
, TRUE
);
122 palette
->currentlySelected
= PALETTE_ARROW
;