Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
MyDocument Struct Reference
+ Collaboration diagram for MyDocument:

Public Member Functions

 MyDocument (const char *name, bool open=true, const ImVec4 &color=ImVec4(1.0f, 1.0f, 1.0f, 1.0f))
 
void DoOpen ()
 
void DoQueueClose ()
 
void DoForceClose ()
 
void DoSave ()
 

Static Public Member Functions

static void DisplayContents (MyDocument *doc)
 
static void DisplayContextMenu (MyDocument *doc)
 

Public Attributes

const char * Name
 
bool Open
 
bool OpenPrev
 
bool Dirty
 
bool WantClose
 
ImVec4 Color
 

Detailed Description

Constructor & Destructor Documentation

◆ MyDocument()

MyDocument::MyDocument ( const char *  name,
bool  open = true,
const ImVec4 color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f) 
)
inline
7455 {
7456 Name = name;
7457 Open = OpenPrev = open;
7458 Dirty = false;
7459 WantClose = false;
7460 Color = color;
7461 }
bool WantClose
Definition imgui_demo.cpp:7451
bool OpenPrev
Definition imgui_demo.cpp:7449
const char * Name
Definition imgui_demo.cpp:7447
ImVec4 Color
Definition imgui_demo.cpp:7452
bool Dirty
Definition imgui_demo.cpp:7450
bool Open
Definition imgui_demo.cpp:7448

References Color, Dirty, Name, Open, OpenPrev, and WantClose.

Member Function Documentation

◆ DisplayContents()

static void MyDocument::DisplayContents ( MyDocument doc)
inlinestatic
7469 {
7470 ImGui::PushID(doc);
7471 ImGui::Text("Document \"%s\"", doc->Name);
7473 ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
7475 if (ImGui::Button("Modify", ImVec2(100, 0)))
7476 doc->Dirty = true;
7478 if (ImGui::Button("Save", ImVec2(100, 0)))
7479 doc->DoSave();
7480 ImGui::ColorEdit3("color", &doc->Color.x); // Useful to test drag and drop and hold-dragged-to-open-tab behavior.
7481 ImGui::PopID();
7482 }
@ ImGuiCol_Text
Definition imgui.h:1413
IMGUI_API void PushID(const char *str_id)
Definition imgui.cpp:7018
IMGUI_API void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f)
Definition imgui.cpp:7455
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0))
Definition imgui_widgets.cpp:715
IMGUI_API bool ColorEdit3(const char *label, float col[3], ImGuiColorEditFlags flags=0)
Definition imgui_widgets.cpp:4684
IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col)
Definition imgui.cpp:2462
IMGUI_API void PopStyleColor(int count=1)
Definition imgui.cpp:2482
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
Definition imgui_widgets.cpp:260
IMGUI_API void PopID()
Definition imgui.cpp:7072
IMGUI_API void TextWrapped(const char *fmt,...) IM_FMTARGS(1)
Definition imgui_widgets.cpp:316
Definition imgui.h:245
float x
Definition imgui.h:259
void DoSave()
Definition imgui_demo.cpp:7465

References ImGui::Button(), Color, ImGui::ColorEdit3(), Dirty, DoSave(), ImGuiCol_Text, Name, ImGui::PopID(), ImGui::PopStyleColor(), ImGui::PushID(), ImGui::PushStyleColor(), ImGui::SameLine(), ImGui::Text(), ImGui::TextWrapped(), and ImVec4::x.

Referenced by ShowExampleAppDocuments().

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

◆ DisplayContextMenu()

static void MyDocument::DisplayContextMenu ( MyDocument doc)
inlinestatic
7486 {
7488 return;
7489
7490 char buf[256];
7491 sprintf(buf, "Save %s", doc->Name);
7492 if (ImGui::MenuItem(buf, "CTRL+S", false, doc->Open))
7493 doc->DoSave();
7494 if (ImGui::MenuItem("Close", "CTRL+W", false, doc->Open))
7495 doc->DoQueueClose();
7497 }
IMGUI_API bool BeginPopupContextItem(const char *str_id=NULL, ImGuiPopupFlags popup_flags=1)
Definition imgui.cpp:8406
IMGUI_API bool MenuItem(const char *label, const char *shortcut=NULL, bool selected=false, bool enabled=true)
Definition imgui_widgets.cpp:6872
IMGUI_API void EndPopup()
Definition imgui.cpp:8357
void DoQueueClose()
Definition imgui_demo.cpp:7463

References ImGui::BeginPopupContextItem(), DoQueueClose(), DoSave(), ImGui::EndPopup(), ImGui::MenuItem(), Name, and Open.

Referenced by ShowExampleAppDocuments().

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

◆ DoForceClose()

void MyDocument::DoForceClose ( )
inline
7464{ Open = false; Dirty = false; }

References Dirty, and Open.

Referenced by ShowExampleAppDocuments().

+ Here is the caller graph for this function:

◆ DoOpen()

void MyDocument::DoOpen ( )
inline
7462{ Open = true; }

References Open.

Referenced by ShowExampleAppDocuments().

+ Here is the caller graph for this function:

◆ DoQueueClose()

void MyDocument::DoQueueClose ( )
inline
7463{ WantClose = true; }

References WantClose.

Referenced by DisplayContextMenu(), and ShowExampleAppDocuments().

+ Here is the caller graph for this function:

◆ DoSave()

void MyDocument::DoSave ( )
inline
7465{ Dirty = false; }

References Dirty.

Referenced by DisplayContents(), and DisplayContextMenu().

+ Here is the caller graph for this function:

Member Data Documentation

◆ Color

ImVec4 MyDocument::Color

Referenced by MyDocument(), and DisplayContents().

◆ Dirty

bool MyDocument::Dirty

◆ Name

◆ Open

◆ OpenPrev

bool MyDocument::OpenPrev

◆ WantClose

bool MyDocument::WantClose

The documentation for this struct was generated from the following file: