]>
git.saurik.com Git - wxWidgets.git/blob - utils/ogl/samples/ogledit/palette.cpp
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/tbar95.h>
39 * Object editor tool palette
43 EditorToolPalette::EditorToolPalette(wxWindow
* parent
, const wxPoint
& pos
, const wxSize
& size
,
45 TOOLPALETTECLASS(parent
, -1, pos
, size
, style
)
47 currentlySelected
= -1;
49 SetMaxRowsCols(1000, 1);
52 bool EditorToolPalette::OnLeftClick(int toolIndex
, bool toggled
)
54 // BEGIN mutual exclusivity code
55 if (toggled
&& (currentlySelected
!= -1) && (toolIndex
!= currentlySelected
))
56 ToggleTool(currentlySelected
, FALSE
);
59 currentlySelected
= toolIndex
;
60 else if (currentlySelected
== toolIndex
)
61 currentlySelected
= -1;
62 // END mutual exclusivity code
67 void EditorToolPalette::OnMouseEnter(int toolIndex
)
71 void EditorToolPalette::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
73 TOOLPALETTECLASS::SetSize(x
, y
, width
, height
, sizeFlags
);
76 EditorToolPalette
*MyApp::CreatePalette(wxFrame
*parent
)
78 // Load palette bitmaps
80 wxBitmap
PaletteTool1("TOOL1");
81 wxBitmap
PaletteTool2("TOOL2");
82 wxBitmap
PaletteTool3("TOOL3");
83 wxBitmap
PaletteTool4("TOOL4");
84 wxBitmap
PaletteArrow("ARROWTOOL");
87 wxBitmap
PaletteTool1(tool1_bits
, tool1_width
, tool1_height
);
88 wxBitmap
PaletteTool2(tool2_bits
, tool2_width
, tool2_height
);
89 wxBitmap
PaletteTool3(tool3_bits
, tool3_width
, tool3_height
);
90 wxBitmap
PaletteTool4(tool4_bits
, tool4_width
, tool4_height
);
91 wxBitmap
PaletteArrow(arrow_bits
, arrow_width
, arrow_height
);
94 EditorToolPalette
*palette
= new EditorToolPalette(parent
, wxPoint(0, 0), wxSize(-1, -1), wxTB_HORIZONTAL
);
96 palette
->SetMargins(2, 2);
99 if (palette
->IsKindOf(CLASSINFO(wxToolBar95
)))
100 ((wxToolBar95
*)palette
)->SetToolBitmapSize(wxSize(22, 22));
103 palette
->AddTool(PALETTE_ARROW
, PaletteArrow
, wxNullBitmap
, TRUE
, 0, -1, NULL
, "Pointer");
104 palette
->AddTool(PALETTE_TOOL1
, PaletteTool1
, wxNullBitmap
, TRUE
, 0, -1, NULL
, "Tool 1");
105 palette
->AddTool(PALETTE_TOOL2
, PaletteTool2
, wxNullBitmap
, TRUE
, 0, -1, NULL
, "Tool 2");
106 palette
->AddTool(PALETTE_TOOL3
, PaletteTool3
, wxNullBitmap
, TRUE
, 0, -1, NULL
, "Tool 3");
107 palette
->AddTool(PALETTE_TOOL4
, PaletteTool4
, wxNullBitmap
, TRUE
, 0, -1, NULL
, "Tool 4");
111 palette
->ToggleTool(PALETTE_ARROW
, TRUE
);
112 palette
->currentlySelected
= PALETTE_ARROW
;