mirror of
https://github.com/gwm17/implot.git
synced 2024-11-26 12:18:52 -05:00
[#174] DatePicker separate disabled color
Separate disabled color from the selected date to the truly disabled dates in another month. Move setting col/styles after we are done getting them.
This commit is contained in:
parent
e64df657b2
commit
413fb083ad
12
implot.cpp
12
implot.cpp
|
@ -3878,12 +3878,14 @@ bool ShowDatePicker(const char* id, int* level, ImPlotTime* t, const ImPlotTime*
|
|||
|
||||
ImGui::PushID(id);
|
||||
ImGui::BeginGroup();
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0,0,0,0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0));
|
||||
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImVec4 col_txt = style.Colors[ImGuiCol_Text];
|
||||
ImVec4 col_dis = style.Colors[ImGuiCol_TextDisabled];
|
||||
ImVec4 col_btn = style.Colors[ImGuiCol_Button];
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0,0,0,0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0));
|
||||
|
||||
const float ht = ImGui::GetFrameHeight();
|
||||
ImVec2 cell_size(ht*1.25f,ht);
|
||||
char buff[32];
|
||||
|
@ -3969,7 +3971,7 @@ bool ShowDatePicker(const char* id, int* level, ImPlotTime* t, const ImPlotTime*
|
|||
if (off_mo)
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, col_dis);
|
||||
if (t1_or_t2) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, col_dis);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, col_btn);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, col_txt);
|
||||
}
|
||||
ImGui::PushID(i*7+j);
|
||||
|
@ -4019,7 +4021,7 @@ bool ShowDatePicker(const char* id, int* level, ImPlotTime* t, const ImPlotTime*
|
|||
const bool t1_or_t2 = (t1 != NULL && t1_yr == this_yr && t1_mo == mo) ||
|
||||
(t2 != NULL && t2_yr == this_yr && t2_mo == mo);
|
||||
if (t1_or_t2)
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, col_dis);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, col_btn);
|
||||
if (ImGui::Button(MONTH_ABRVS[mo],cell_size) && !clk) {
|
||||
*t = MakeTime(this_yr, mo);
|
||||
*level = 0;
|
||||
|
@ -4057,7 +4059,7 @@ bool ShowDatePicker(const char* id, int* level, ImPlotTime* t, const ImPlotTime*
|
|||
for (int j = 0; j < 4; ++j) {
|
||||
const bool t1_or_t2 = (t1 != NULL && t1_yr == yr) || (t2 != NULL && t2_yr == yr);
|
||||
if (t1_or_t2)
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, col_dis);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, col_btn);
|
||||
snprintf(buff,32,"%d",yr);
|
||||
if (yr<1970||yr>3000) {
|
||||
ImGui::Dummy(cell_size);
|
||||
|
|
Loading…
Reference in New Issue
Block a user