Makes a button and its four different state bitmaps @param parent Parent window for the button. @param eUp Background for when button is Up. @param eDown Background for when button is Down. @param eHilite Background for when button is Hilit. @param eStandardUp Foreground when enabled, up. @param eStandardDown Foreground when enabled, down. @
| 837 | /// @param processdownevents true iff button handles down events. |
| 838 | /// @param size Size of the background. |
| 839 | AButton * ToolBar::MakeButton(wxWindow *parent, |
| 840 | teBmps eUp, |
| 841 | teBmps eDown, |
| 842 | teBmps eHilite, |
| 843 | teBmps eDownHi, |
| 844 | teBmps eStandardUp, |
| 845 | teBmps eStandardDown, |
| 846 | teBmps eDisabled, |
| 847 | wxWindowID id, |
| 848 | wxPoint placement, |
| 849 | bool processdownevents, |
| 850 | wxSize size) |
| 851 | { |
| 852 | // wxMax to cater for case of image being bigger than the button. |
| 853 | int xoff = wxMax( 0, (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2); |
| 854 | int yoff = wxMax( 0, (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2); |
| 855 | |
| 856 | typedef std::unique_ptr<wxImage> wxImagePtr; |
| 857 | wxImagePtr up2 (OverlayImage(eUp, eStandardUp, xoff, yoff)); |
| 858 | wxImagePtr hilite2 (OverlayImage(eHilite, eStandardUp, xoff, yoff)); |
| 859 | wxImagePtr down2 (OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1)); |
| 860 | wxImagePtr downHi2 (OverlayImage(eDownHi, eStandardDown, xoff + 1, yoff + 1)); |
| 861 | wxImagePtr disable2 (OverlayImage(eUp, eDisabled, xoff, yoff)); |
| 862 | |
| 863 | wxASSERT(parent); // to justify safenew |
| 864 | AButton * button = |
| 865 | safenew AButton(parent, id, placement, size, *up2, *hilite2, *down2, *downHi2, |
| 866 | *disable2, processdownevents); |
| 867 | |
| 868 | return button; |
| 869 | } |
| 870 | |
| 871 | // This is a convenience function that allows for button creation in |
| 872 | // MakeButtons() with fewer arguments |
nothing calls this directly
no test coverage detected