/* Copyright (C) 2018-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: Dk4WxColourPalette.wxc */ /** @file Dk4WxColourPalette.h Header file for the Dk4WxColourPalette module. */ #ifndef DK4WXCOLOURPALETTE_H_INCLUDED /** Avoid multiple inclusions. */ #define DK4WXCOLOURPALETTE_H_INCLUDED 1 #line 430 "Dk4WxColourPalette.wxc" #ifndef DK4CONF_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4conf.h" #else #include #endif #endif #ifndef WX_WXPREC_H_INCLUDED #include #define WX_WXPREC_H_INCLUDED 1 #endif #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #ifndef WX_WX_H_INCLUDED #include #define WX_WX_H_INCLUDED 1 #endif #endif #ifndef WX_GBSIZER_H_INCLUDED #include #define WX_GBSIZER_H_INCLUDED 1 #endif #ifndef WX_BOOKCTRL_H_INCLUDED #include #define WX_BOOKCTRL_H_INCLUDED 1 #endif #ifndef WX_CHOICEBK_H_INCLUDED #include #define WX_CHOICEBK_H_INCLUDED 1 #endif #ifndef WX_STATBOX_H_INCLUDED #include #define WX_STATBOX_H_INCLUDED 1 #endif #ifndef DK4WXAPPLICTIONHELPER_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "Dk4WxApplicationHelper.h" #else #include #endif #endif #ifndef DK4WXCOLOURVIEW_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "Dk4WxColourView.h" #else #include #endif #endif #line 492 "Dk4WxColourPalette.wxc" /** Color palette allowing to choose between predefined colours. */ class Dk4WxColourPalette : public wxDialog { /** Item in a colour palette. */ class Dk4WxColourPaletteItem : public wxControl { /** Class is dynamic. */ #if wxCHECK_VERSION(3,0,0) wxDECLARE_DYNAMIC_CLASS(Dk4WxColourPaletteItem); #else DECLARE_DYNAMIC_CLASS(Dk4WxColourPaletteItem) #endif /** Event table for control. */ #if wxCHECK_VERSION(3,0,0) wxDECLARE_EVENT_TABLE(); #else DECLARE_EVENT_TABLE() #endif protected: /** Parent dialog we have to notify about color change. */ Dk4WxColourPalette *pParentWindow; /** Application helper. */ Dk4WxApplicationHelper *pAppHelp; /** Class name, used in constructor and Create(). */ static wxChar const Dk4WxColourPaletteItemName[]; /** Height. */ int w; /** Width. */ int h; /** Red component of color to show. */ int r; /** Green component of color to show. */ int g; /** Blue component of color to show. */ int b; public: /** Default constructor. */ Dk4WxColourPaletteItem(); /** Constructor. @param pParent Parent window. @param wxid Window ID. @param appHelper Application helper. @param red Red component of color to show. @param green Green component of color to show. @param blue Blue component of color to show. @param pos Object position. @param size Object minimum size. @param style Style for control. @param name Class name. */ Dk4WxColourPaletteItem( wxWindow *pParent, wxWindowID wxid, Dk4WxColourPalette *pal, Dk4WxApplicationHelper *appHelper, int red, int green, int blue, wxPoint const & pos = wxDefaultPosition, wxSize const & size = wxDefaultSize, long style = wxBORDER_NONE, wxChar const *name = Dk4WxColourPaletteItemName ); /** Create object after using default constructor. @param pParent Parent window. @param wxid Window ID. @param appHelper Application helper. @param red Red component of color to show. @param green Green component of color to show. @param blue Blue component of color to show. @param pos Object position. @param size Object minimum size. @param style Style for control. @param name Class name. @return true on success, false on error. */ bool Create( wxWindow *pParent, wxWindowID wxid, Dk4WxColourPalette *pal, Dk4WxApplicationHelper *appHelper, int red = 255, int green = 255, int blue = 255, wxPoint const & pos = wxDefaultPosition, wxSize const & size = wxDefaultSize, long style = wxBORDER_NONE, wxChar const *name = Dk4WxColourPaletteItemName ); /** Find minimum size. */ wxSize DoGetBestSize() const; /** Handler for erase event. @param event Event to process. */ void OnErase(wxEraseEvent & event); /** Handler for paint event. @param event Event to process. */ void OnPaint(wxPaintEvent & event); /** Handler for mouse click event. @param event Event to process. */ void OnLeftMouseButtonDown(wxMouseEvent & event); }; private: /** Events we have to respond to. */ #if wxCHECK_VERSION(3,0,0) wxDECLARE_EVENT_TABLE(); #else DECLARE_EVENT_TABLE() #endif protected: /** Red colour for text labels. */ wxColour colourRed; /** Green colour for text labels. */ wxColour colourGreen; /** Blue colour for text labels. */ wxColour colourBlue; /** Application helper. */ Dk4WxApplicationHelper *pAppHelp; /** Localized texts. */ wxChar const * const *localizedTexts; /** Shade slider value -20 to 20. */ int slvshade; /** Red slider value 0 to 5. */ int slvred; /** Green slider value 0 to 5. */ int slvgreen; /** Blue slider value 0 to 5. */ int slvblue; /** Index of selected list item. */ int listSelection; /** Base red component, not shaded. */ int rb; /** Base green component, not shaded. */ int gb; /** Base blue component, not shaded. */ int bb; /** Result red component. */ int r; /** Result green component. */ int g; /** Result blue component. */ int b; /** Flag: Already in correction process. */ bool bIsCorrecting; /** Flag: GUI ok. */ bool dkctGUILayoutOK; /** GUI element mainSizerHorizontal. */ #line 12 "Dk4WxColourPalette.wxc" wxBoxSizer *mainSizerHorizontal; /** GUI element mainSizerVertical. */ #line 18 "Dk4WxColourPalette.wxc" wxBoxSizer *mainSizerVertical; /** GUI element choiceBookInput. */ #line 31 "Dk4WxColourPalette.wxc" wxChoicebook *choiceBookInput; /** GUI element resultSizerHexadecimal. */ #line 362 "Dk4WxColourPalette.wxc" wxBoxSizer *resultSizerHexadecimal; /** GUI element resultSizerDecimal. */ #line 371 "Dk4WxColourPalette.wxc" wxBoxSizer *resultSizerDecimal; /** GUI element colourViewResult. */ #line 408 "Dk4WxColourPalette.wxc" Dk4WxColourView *colourViewResult; /** GUI element buttonsDialog. */ #line 414 "Dk4WxColourPalette.wxc" wxStdDialogButtonSizer *buttonsDialog; /** GUI element panelFig. */ #line 38 "Dk4WxColourPalette.wxc" wxPanel *panelFig; /** GUI element panelHtmlNamed. */ #line 284 "Dk4WxColourPalette.wxc" wxPanel *panelHtmlNamed; /** GUI element panelHtml216. */ #line 306 "Dk4WxColourPalette.wxc" wxPanel *panelHtml216; /** GUI element figSizerHorizontal. */ #line 42 "Dk4WxColourPalette.wxc" wxBoxSizer *figSizerHorizontal; /** GUI element figSizerVertical. */ #line 48 "Dk4WxColourPalette.wxc" wxBoxSizer *figSizerVertical; /** GUI element figButtonRow0. */ #line 64 "Dk4WxColourPalette.wxc" wxBoxSizer *figButtonRow0; /** GUI element figButtonRow1. */ #line 82 "Dk4WxColourPalette.wxc" wxBoxSizer *figButtonRow1; /** GUI element figButtonRow2. */ #line 100 "Dk4WxColourPalette.wxc" wxBoxSizer *figButtonRow2; /** GUI element figButtonRow3. */ #line 118 "Dk4WxColourPalette.wxc" wxBoxSizer *figButtonRow3; /** GUI element figShaderLabelSizer. */ #line 264 "Dk4WxColourPalette.wxc" wxBoxSizer *figShaderLabelSizer; /** GUI element figShaderSlider. */ #line 276 "Dk4WxColourPalette.wxc" wxSlider *figShaderSlider; /** GUI element b00. */ #line 136 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b00; /** GUI element b01. */ #line 140 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b01; /** GUI element b02. */ #line 144 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b02; /** GUI element b03. */ #line 148 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b03; /** GUI element b04. */ #line 152 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b04; /** GUI element b05. */ #line 156 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b05; /** GUI element b06. */ #line 160 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b06; /** GUI element b07. */ #line 164 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b07; /** GUI element b08. */ #line 168 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b08; /** GUI element b09. */ #line 172 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b09; /** GUI element b10. */ #line 176 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b10; /** GUI element b11. */ #line 180 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b11; /** GUI element b12. */ #line 184 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b12; /** GUI element b13. */ #line 188 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b13; /** GUI element b14. */ #line 192 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b14; /** GUI element b15. */ #line 196 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b15; /** GUI element b16. */ #line 200 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b16; /** GUI element b17. */ #line 204 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b17; /** GUI element b18. */ #line 208 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b18; /** GUI element b19. */ #line 212 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b19; /** GUI element b20. */ #line 216 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b20; /** GUI element b21. */ #line 220 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b21; /** GUI element b22. */ #line 224 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b22; /** GUI element b23. */ #line 228 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b23; /** GUI element b24. */ #line 232 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b24; /** GUI element b25. */ #line 236 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b25; /** GUI element b26. */ #line 240 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b26; /** GUI element b27. */ #line 244 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b27; /** GUI element b28. */ #line 248 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b28; /** GUI element b29. */ #line 252 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b29; /** GUI element b30. */ #line 256 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b30; /** GUI element b31. */ #line 260 "Dk4WxColourPalette.wxc" Dk4WxColourPaletteItem *b31; /** GUI element figShaderLabelText. */ #line 271 "Dk4WxColourPalette.wxc" wxStaticText *figShaderLabelText; /** GUI element htmlNamedSizerHorizontal. */ #line 288 "Dk4WxColourPalette.wxc" wxBoxSizer *htmlNamedSizerHorizontal; /** GUI element htmlNamedSizerVertical. */ #line 294 "Dk4WxColourPalette.wxc" wxBoxSizer *htmlNamedSizerVertical; /** GUI element listHtmlNames. */ #line 299 "Dk4WxColourPalette.wxc" wxListBox *listHtmlNames; /** GUI element html216SizerHorizontal. */ #line 310 "Dk4WxColourPalette.wxc" wxBoxSizer *html216SizerHorizontal; /** GUI element html216SizerVertical. */ #line 316 "Dk4WxColourPalette.wxc" wxBoxSizer *html216SizerVertical; /** GUI element labelHtml216Red. */ #line 329 "Dk4WxColourPalette.wxc" wxStaticText *labelHtml216Red; /** GUI element sliderHtml216Red. */ #line 332 "Dk4WxColourPalette.wxc" wxSlider *sliderHtml216Red; /** GUI element labelHtml216Green. */ #line 340 "Dk4WxColourPalette.wxc" wxStaticText *labelHtml216Green; /** GUI element sliderHtml216Green. */ #line 343 "Dk4WxColourPalette.wxc" wxSlider *sliderHtml216Green; /** GUI element labelHtml216Blue. */ #line 351 "Dk4WxColourPalette.wxc" wxStaticText *labelHtml216Blue; /** GUI element sliderHtml216Blue. */ #line 354 "Dk4WxColourPalette.wxc" wxSlider *sliderHtml216Blue; /** GUI element hexRed. */ #line 380 "Dk4WxColourPalette.wxc" wxStaticText *hexRed; /** GUI element hexGreen. */ #line 384 "Dk4WxColourPalette.wxc" wxStaticText *hexGreen; /** GUI element hexBlue. */ #line 389 "Dk4WxColourPalette.wxc" wxStaticText *hexBlue; /** GUI element decRed. */ #line 394 "Dk4WxColourPalette.wxc" wxStaticText *decRed; /** GUI element decGreen. */ #line 398 "Dk4WxColourPalette.wxc" wxStaticText *decGreen; /** GUI element decBlue. */ #line 403 "Dk4WxColourPalette.wxc" wxStaticText *decBlue; /** GUI element buttonOK. */ #line 418 "Dk4WxColourPalette.wxc" wxButton *buttonOK; /** GUI element buttonCancel. */ #line 423 "Dk4WxColourPalette.wxc" wxButton *buttonCancel; #line 717 "Dk4WxColourPalette.wxc" protected: /** Correct shade label. */ void CorrectShadeLabel(void); /** Shade a color. @param val Original value. @return Shaded color value. */ int ShadeColour(int val); /** Correct appearance after using controls. @param reason Which control was used. */ void CorrectGui(int reason); /** Set the R, G, B text labels for the r, g, b variables. */ void SetRgbTextLabels(void); /** Find RGB slider value next to a given color value. */ int FindSliderValue(int colval); /** Find slider values next to the r, g, b variables. */ void FindRgbSliderValues(void); /** Find list box entry next to the r, g, b variables. */ void FindListBoxEntry(void); public: /** Our IDs. */ enum { /** ID of choicebook change. */ ID_CHOICEBOOK = ((wxID_HIGHEST) + 1) , /** ID of XFig shade slider. */ ID_SLIDER_SHADE , /** ID of HTML named colors list control. */ ID_HTML_NAMED_LIST , /** ID of HTML 216 red slider. */ ID_SLIDER_RED , /** ID of HTML 216 green slider. */ ID_SLIDER_GREEN , /** ID of HTML 216 blue slider. */ ID_SLIDER_BLUE }; /** Reasons for GUI corrections. */ enum { /** New page selected in choice book. */ REASON_CHOICEBOOK = 0 , /** Base colors changed. */ REASON_BASE_COLOR , /** Shade slider changed. */ REASON_SHADE_SLIDER , /** List selection changed. */ REASON_LIST_SELECT , /** RGB slider changed. */ REASON_RGB_SLIDER }; /** Default constructor. */ Dk4WxColourPalette(); /** Real constructor. @param pParent Parent window. @param pAppHelper Application helper. @param red Initial red component. @param green Initial green component. @param blue Initial blue component. @param withborder Flag: Show border around dialog box. */ Dk4WxColourPalette( wxWindow *pParent, Dk4WxApplicationHelper *pAppHelper, int red, int green, int blue, bool withborder = true ); /** Handler for OK button. @param event Event to respond to, unused. */ void OnOK(wxCommandEvent & event); /** Handler for Cancel button. @param event Event to respond to, unused. */ void OnCancel(wxCommandEvent & event); /** Handler for shade slider events. @param event Event to respond to, unused. */ void OnShadeSlider(wxCommandEvent & event); /** Handler for RGB slider events. @param event Event to respond to, unused. */ void OnRgbSlider(wxCommandEvent & event); #if wxCHECK_VERSION(3,0,0) /** Handler for changed choicebook page. @param event Event to respond to, unused */ void OnChoicebookChanged(wxBookCtrlEvent & event); #else /** Handler for changed choicebook page. @param event Event to respond to, unused */ void OnChoicebookChanged(wxChoicebookEvent & event); #endif /** Handler for changed selection on list box. @param event Event to respond to, unused. */ void OnListBoxChanged(wxCommandEvent & event); /** Retrieve red component. @return Red value. */ int Red(void) const; /** Retrieve green component. @return Green value. */ int Green(void) const; /** Retrieve blue component. @return Blue value. */ int Blue(void) const; /** React on Dk4WxColourPaletteItem click. @param red New base red component. @param green New base green component. @param blue New base blue component. */ void SetBaseRGB(int red, int green, int blue); /** Construct a dialog style value. @param bBorder Flag: Draw border. @param bTitle Flag: Title bar on dialog. */ static int GetDialogStyle(bool bBorder = true, bool bTitle = true); }; #line 916 "Dk4WxColourPalette.wxc" #endif