TrackGit
LogWindow.cpp
Go to the documentation of this file.
1 
8 #include "LogWindow.h"
9 
10 #include <stdio.h>
11 
12 #include <Catalog.h>
13 #include <LayoutBuilder.h>
14 
15 #define B_TRANSLATION_CONTEXT "TrackGit"
16 
17 
18 enum {
20 };
21 
22 
27 LogWindow::LogWindow(BString repo)
28  :
29  TrackGitWindow(repo, BRect(0, 0, 400, 300), "TrackGit - Log",
30  B_DOCUMENT_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
31 {
32  fLogTextView = new BTextView("logText");
33  fLogTextView->SetText("Loading...");
34  fLogTextView->MakeEditable(false);
35 
36  BScrollView* fScrollView = new BScrollView("logScrollView",
37  fLogTextView, B_WILL_DRAW | B_FRAME_EVENTS, false, true,
38  B_PLAIN_BORDER);
39 
40  BButton* fOK = new BButton("ok", B_TRANSLATE("OK"),
41  new BMessage(kOK));
42 
43  BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
44  .SetInsets(10)
45  .Add(fScrollView)
46  .Add(fOK);
47 
48  CenterOnScreen();
49  Show();
50 }
51 
52 
57 void
58 LogWindow::SetText(BString text)
59 {
60  if (LockLooper()) {
61  fLogTextView->SetText(text.String());
62  UnlockLooper();
63  }
64 }
65 
66 
71 void
73 {
74  switch (msg->what) {
75  case kOK:
76  Quit();
77  break;
78  default:
79  BWindow::MessageReceived(msg);
80  }
81 }
virtual void Quit()
The function to Quit the window.
Header file of Log window.
LogWindow(BString)
LogWindow Constructor.
Definition: LogWindow.cpp:27
virtual void MessageReceived(BMessage *)
Handler to received messages.
Definition: LogWindow.cpp:72
BTextView * fLogTextView
The Log Text View.
Definition: LogWindow.h:24
void SetText(BString)
Sets Text of the View in Window.
Definition: LogWindow.cpp:58
The TrackGit Window class.