Audacity 3.2.0
Functions
anonymous_namespace{AColor.cpp} Namespace Reference

Functions

void DrawNinePatch (wxDC &dc, wxBitmap &bitmap, const wxRect &r)
 
int GetButtonImageIndex (bool up, bool selected, bool highlight)
 

Function Documentation

◆ DrawNinePatch()

void anonymous_namespace{AColor.cpp}::DrawNinePatch ( wxDC &  dc,
wxBitmap &  bitmap,
const wxRect &  r 
)

Definition at line 82 of file AColor.cpp.

83 {
84 wxMemoryDC memDC;
85 memDC.SelectObject(bitmap);
86
87 // image slices
88
89 const auto uw0 = bitmap.GetWidth() / 2;
90 const auto uw1 = 1;
91 const auto uw2 = bitmap.GetWidth() - uw0 - uw1;
92
93 const auto vh0 = bitmap.GetHeight() / 2;
94 const auto vh1 = 1;
95 const auto vh2 = bitmap.GetHeight() - vh1 - vh0;
96
97 const auto u0 = 0;
98 const auto u1 = uw0;
99 const auto u2 = uw0 + uw1;
100
101 const auto v0 = 0;
102 const auto v1 = vh0;
103 const auto v2 = vh0 + vh1;
104
105 //Button geometry
106
107 const auto xw0 = std::min(uw0, r.width / 2);
108 const auto xw2 = std::min(uw2, r.width / 2);
109 const auto xw1 = r.width - xw0 - xw2;
110
111 const auto yh0 = std::min(vh0, r.height / 2);
112 const auto yh2 = std::min(vh2, r.height / 2);
113 const auto yh1 = r.height - yh0 - yh2;
114
115 const auto x0 = r.x;
116 const auto x1 = r.x + xw0;
117 const auto x2 = r.x + xw0 + xw1;
118
119 const auto y0 = r.y;
120 const auto y1 = r.y + yh0;
121 const auto y2 = r.y + yh0 + yh1;
122
123 dc.StretchBlit(x0, y0, xw0, yh0, &memDC, u0, v0, uw0, vh0, wxCOPY, true);
124 dc.StretchBlit(x1, y0, xw1, yh0, &memDC, u1, v0, uw1, vh0, wxCOPY, true);
125 dc.StretchBlit(x2, y0, xw2, yh0, &memDC, u2, v0, uw2, vh0, wxCOPY, true);
126
127 dc.StretchBlit(x0, y1, xw0, yh1, &memDC, u0, v1, uw0, vh1, wxCOPY, true);
128 dc.StretchBlit(x1, y1, xw1, yh1, &memDC, u1, v1, uw1, vh1, wxCOPY, true);
129 dc.StretchBlit(x2, y1, xw2, yh1, &memDC, u2, v1, uw2, vh1, wxCOPY, true);
130
131 dc.StretchBlit(x0, y2, xw0, yh2, &memDC, u0, v2, uw0, vh2, wxCOPY, true);
132 dc.StretchBlit(x1, y2, xw1, yh2, &memDC, u1, v2, uw1, vh2, wxCOPY, true);
133 dc.StretchBlit(x2, y2, xw2, yh2, &memDC, u2, v2, uw2, vh2, wxCOPY, true);
134 }
int min(int a, int b)

References min().

Referenced by AColor::ButtonStretch(), and AColor::DrawFrame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetButtonImageIndex()

int anonymous_namespace{AColor.cpp}::GetButtonImageIndex ( bool  up,
bool  selected,
bool  highlight 
)

Definition at line 136 of file AColor.cpp.

137 {
138 // There are eight button states in the TCP.
139 // A theme might not differentiate among them all. That's up to
140 // the theme designer.
141 // Button highlighted (i.e. hovered over) or not.
142 // Track selected or not
143 // Button up or down.
144 // Highlight in most themes is lighter than not highlighted.
145 if ( highlight && selected)
146 return up ? bmpHiliteUpButtonExpandSel : bmpHiliteButtonExpandSel;
147 if ( highlight )
148 return up ? bmpHiliteUpButtonExpand : bmpHiliteButtonExpand;
149 if( selected )
150 return up ? bmpUpButtonExpandSel : bmpDownButtonExpandSel;
151 return up ? bmpUpButtonExpand : bmpDownButtonExpand;
152 }

Referenced by AColor::Bevel2(), and AColor::ButtonStretch().

Here is the caller graph for this function: