MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / SetActiveColorRepresentation

Method SetActiveColorRepresentation

Xaml/Controls/ColorPicker.cpp:800–860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

798 }
799
800 void ColorPicker::SetActiveColorRepresentation(txmp::ColorRepresentation representation)
801 {
802 bool eventsDisconnectedByMethod = false;
803
804 // Disable events during the update
805 if (m_EventsConnected)
806 {
807 ConnectEvents(false);
808 eventsDisconnectedByMethod = true;
809 }
810
811 // Sync the UI controls and visual state
812 // The default is always RGBA
813 if (representation == txmp::ColorRepresentation::Hsva)
814 {
815 if (m_RgbToggleButton)
816 {
817 const auto isChecked = m_RgbToggleButton.IsChecked();
818 if (isChecked && isChecked.Value())
819 {
820 m_RgbToggleButton.IsChecked(false);
821 }
822 }
823
824 if (m_HsvToggleButton)
825 {
826 const auto isChecked = m_HsvToggleButton.IsChecked();
827 if (!isChecked || !isChecked.Value())
828 {
829 m_HsvToggleButton.IsChecked(true);
830 }
831 }
832 }
833 else
834 {
835 if (m_RgbToggleButton)
836 {
837 const auto isChecked = m_RgbToggleButton.IsChecked();
838 if (!isChecked || !isChecked.Value())
839 {
840 m_RgbToggleButton.IsChecked(true);
841 }
842 }
843
844 if (m_HsvToggleButton)
845 {
846 const auto isChecked = m_HsvToggleButton.IsChecked();
847 if (isChecked && isChecked.Value())
848 {
849 m_HsvToggleButton.IsChecked(false);
850 }
851 }
852 }
853
854 UpdateVisualState(false);
855
856 if (eventsDisconnectedByMethod)
857 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected