Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

G4UIWin32 Class Reference

#include <G4UIWin32.hh>

Inheritance diagram for G4UIWin32:

Inheritance graph
[legend]
Collaboration diagram for G4UIWin32:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 G4UIWin32 ()
G4UIsession * SessionStart ()
void AddMenu (const char *, const char *)
void AddButton (const char *, const char *, const char *)
 ~G4UIWin32 ()
void Prompt (G4String)
void SessionTerminate ()
void PauseSessionStart (G4String)
G4int ReceiveG4cout (G4String)
G4int ReceiveG4cerr (G4String)
G4String GetCommand (int)
void TextAppendString (char *)

Private Member Functions

void SecondaryLoop (G4String)
G4bool GetHelpChoice (G4int &)
void ExitHelp ()

Static Private Member Functions

LRESULT CALLBACK MainWindowProc (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK TextWindowProc (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK EditWindowProc (HWND, UINT, WPARAM, LPARAM)

Private Attributes

G4VInteractorManagerinteractorManager
HWND mainWindow
HWND textWindow
HWND editWindow
HMENU menuBar
HMENU defaultMenu
std::map< int, G4String, std::less<
int > > 
commands
void * textBuffer
int textRows
int textCols
G4bool fHelp
G4int fHelpChoice
std::vector< G4String > fHistory
int fHistoryPos

Constructor & Destructor Documentation

G4UIWin32::G4UIWin32  ) 
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 182 of file G4UIWin32.cc.

References defaultMenu, G4Win32::getInstance(), interactorManager, mainClassName, mainWindow, MainWindowProc(), menuBar, textBuffer, textClassName, TextWindowProc(), and tmpSession.

00184 :mainWindow(NULL)
00185 ,textWindow(NULL)
00186 ,editWindow(NULL)
00187 ,menuBar(NULL)
00188 ,textBuffer(NULL)
00189 ,textCols(80)
00190 ,textRows(12)
00191 ,fHelp(false)
00192 ,fHelpChoice(0)
00193 ,fHistoryPos(-1)
00194 /***************************************************************************/
00196 {
00197   G4UImanager* UI = G4UImanager::GetUIpointer();
00198   if(UI!=NULL) UI->SetSession(this);
00199 
00200   interactorManager = G4Win32::getInstance ();
00201   static G4bool Done = FALSE;
00202   if(Done==FALSE) {
00203     WNDCLASS         wc;
00204     wc.style         = CS_HREDRAW | CS_VREDRAW;
00205     wc.lpfnWndProc   = (WNDPROC)G4UIWin32::MainWindowProc;
00206     wc.cbClsExtra    = 0;
00207     wc.cbWndExtra    = 0;
00208     wc.hInstance     = ::GetModuleHandle(NULL);
00209     wc.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
00210     wc.hCursor       = LoadCursor(NULL,IDC_ARROW);
00211     wc.hbrBackground = GetStockBrush(WHITE_BRUSH);
00212     wc.lpszMenuName  = mainClassName;
00213     wc.lpszClassName = mainClassName;
00214     ::RegisterClass  (&wc);
00215     
00216     wc.style         = CS_HREDRAW | CS_VREDRAW;
00217     wc.lpfnWndProc   = (WNDPROC)G4UIWin32::TextWindowProc;
00218     wc.cbClsExtra    = 0;
00219     wc.cbWndExtra    = 0;
00220     wc.hInstance     = ::GetModuleHandle(NULL);
00221     wc.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
00222     wc.hCursor       = LoadCursor(NULL,IDC_ARROW);
00223     wc.hbrBackground = GetStockBrush(WHITE_BRUSH);
00224     wc.lpszMenuName  = textClassName;
00225     wc.lpszClassName = textClassName;
00226     ::RegisterClass  (&wc);
00227     Done = TRUE;
00228   }
00229 
00230   menuBar = CreateMenu();
00231   defaultMenu = CreatePopupMenu();
00232   AppendMenu(menuBar,MF_POPUP,(UINT)defaultMenu,"Geant4");
00233 
00234   textBuffer = new TextBuffer();
00235 
00236   tmpSession = this;
00237   mainWindow = ::CreateWindow(mainClassName,mainClassName, 
00238                               WS_OVERLAPPEDWINDOW,
00239                               CW_USEDEFAULT,CW_USEDEFAULT, 
00240                               0,0,
00241                               NULL,menuBar,
00242                               ::GetModuleHandle(NULL),
00243                               NULL);
00244   tmpSession = NULL;
00245   ::SetWindowLong(mainWindow,GWL_USERDATA,LONG(this));
00246 
00247   ::SetForegroundWindow(mainWindow);
00248   ::ShowWindow(mainWindow,SW_SHOWDEFAULT);
00249   ::UpdateWindow(mainWindow);
00250 
00251   if(UI!=NULL) UI->SetCoutDestination(this);
00252 }

Here is the call graph for this function:

G4UIWin32::~G4UIWin32  ) 
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 254 of file G4UIWin32.cc.

References mainWindow, textBuffer, and textWindow.

00258 { 
00259   G4UImanager* UI = G4UImanager::GetUIpointer();
00260   if(UI!=NULL) {
00261     UI->SetSession(NULL);
00262     UI->SetCoutDestination(NULL);
00263   }
00264   delete textBuffer;
00265   if(textWindow!=NULL) ::SetWindowLong(textWindow,GWL_USERDATA,LONG(NULL));
00266   if(mainWindow!=NULL) {
00267     ::SetWindowLong(mainWindow,GWL_USERDATA,LONG(NULL));
00268     ::DestroyWindow(mainWindow);
00269   }
00270 }


Member Function Documentation

void G4UIWin32::AddButton const char *  a_menu,
const char *  a_label,
const char *  a_command
[virtual]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reimplemented from G4VInteractiveSession.

Definition at line 407 of file G4UIWin32.cc.

References actionIdentifier, commands, and G4VInteractiveSession::GetInteractor().

00414 {
00415   if(a_menu==NULL) return;
00416   if(a_label==NULL) return;
00417   if(a_command==NULL) return;
00418   HMENU hMenu = (HMENU)GetInteractor(a_menu);
00419   actionIdentifier++;
00420   commands[actionIdentifier] = a_command;
00421   AppendMenu (hMenu,MF_STRING,actionIdentifier,a_label);
00422 }

Here is the call graph for this function:

void G4UIWin32::AddMenu const char *  a_name,
const char *  a_label
[virtual]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reimplemented from G4VInteractiveSession.

Definition at line 389 of file G4UIWin32.cc.

References G4VInteractiveSession::AddInteractor(), defaultMenu, G4Interactor, mainWindow, and menuBar.

00395 {
00396   if(a_name==NULL) return;
00397   if(defaultMenu!=NULL) {
00398     DeleteMenu (menuBar,0,MF_BYPOSITION);
00399     defaultMenu = NULL;
00400   }
00401   HMENU hMenu = CreatePopupMenu();
00402   AppendMenu(menuBar,MF_POPUP,(UINT)hMenu,a_label);
00403   AddInteractor(a_name,(G4Interactor)hMenu);
00404   DrawMenuBar(mainWindow);
00405 }

Here is the call graph for this function:

LRESULT CALLBACK G4UIWin32::EditWindowProc HWND  a_window,
UINT  a_message,
WPARAM  a_wParam,
LPARAM  a_lParam
[static, private]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 587 of file G4UIWin32.cc.

References G4VBasicShell::ApplyShellCommand(), G4VBasicShell::Complete(), ConvertStringToInt(), exitHelp, exitPause, exitSession, fHelp, fHelpChoice, fHistory, fHistoryPos, and oldEditWindowProc.

Referenced by MainWindowProc().

00595 {
00596   switch (a_message) { 
00597   case WM_KEYDOWN:
00598     switch(a_wParam){
00599     case VK_RETURN:{
00600       G4UIWin32* This = (G4UIWin32*)::GetWindowLong(
00601                          GetParent(a_window),GWL_USERDATA);
00602       char buffer[128];
00603       GetWindowText (a_window,buffer,128);
00604       G4String command (buffer);
00605       //SetWindowText (a_window,"");
00606       Edit_SetText(a_window,"");
00607       Edit_SetSel(a_window,0,0);
00608 
00609       if(This!=NULL) {
00610         if(This->fHelp==true) {
00611           exitHelp = true;
00612           This->fHelp = ConvertStringToInt(command.data(),This->fHelpChoice);
00613         } else {
00614           This->fHistory.push_back(command);
00615           This->fHistoryPos = -1;
00616           This->ApplyShellCommand (command,exitSession,exitPause);
00617         }
00618       }
00619 
00620     }break;
00621     case VK_TAB:{
00622       G4UIWin32* This = (G4UIWin32*)::GetWindowLong(
00623                          GetParent(a_window),GWL_USERDATA);
00624       if( (This!=NULL) && (This->fHelp==true) ) break;
00625       char buffer[128];
00626       Edit_GetText(a_window,buffer,128);
00627 
00628       G4String command(buffer);
00629 
00630       if(This!=NULL) {
00631         G4String cmd = This->Complete(command);
00632         const char* d = cmd.data();
00633         int l = strlen(d);
00634         Edit_SetText(a_window,d);
00635         Edit_SetSel(a_window,l,l);
00636       }
00637       
00638     }break;
00639     case VK_UP:{
00640       G4UIWin32* This = (G4UIWin32*)::GetWindowLong(
00641                          GetParent(a_window),GWL_USERDATA);
00642       if(This!=NULL) {
00643         int pos = This->fHistoryPos== -1 ? 
00644           This->fHistory.size()-1 : This->fHistoryPos-1;
00645         if((pos>=0)&&(pos<(int)This->fHistory.size())) {
00646           G4String command = This->fHistory[pos];
00647           const char* d = command.data();
00648           int l = strlen(d);
00649           Edit_SetText(a_window,d);
00650           Edit_SetSel(a_window,l,l);
00651           //
00652           This->fHistoryPos = pos;
00653         }
00654       }
00655     }return 0; //Do not jump into oldEditProc.
00656     case VK_DOWN:{
00657       G4UIWin32* This = (G4UIWin32*)::GetWindowLong(
00658                          GetParent(a_window),GWL_USERDATA);
00659       if(This!=NULL) {
00660         int pos = This->fHistoryPos + 1;
00661         if((pos>=0)&&(pos<(int)This->fHistory.size())) {
00662           G4String command = This->fHistory[pos];
00663           const char* d = command.data();
00664           int l = strlen(d);
00665           Edit_SetText(a_window,d);
00666           Edit_SetSel(a_window,l,l);
00667           //
00668           This->fHistoryPos = pos;
00669         } else if(pos>=(int)This->fHistory.size()) {
00670           Edit_SetText(a_window,"");
00671           Edit_SetSel(a_window,0,0);
00672           //
00673           This->fHistoryPos = -1;
00674         }
00675       }
00676     }return 0; //Do not jump into oldEditProc.
00677     }
00678   }
00679   return CallWindowProc(oldEditWindowProc,
00680                         a_window,a_message,
00681                         a_wParam,a_lParam);
00682 }

Here is the call graph for this function:

void G4UIWin32::ExitHelp  )  [private, virtual]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VBasicShell.

Definition at line 382 of file G4UIWin32.cc.

00386 {
00387 }

G4String G4UIWin32::GetCommand int  a_id  ) 
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 424 of file G4UIWin32.cc.

References commands.

Referenced by MainWindowProc().

00429 {
00430   return commands[a_id];
00431 }

G4bool G4UIWin32::GetHelpChoice G4int &  aInt  )  [private, virtual]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VBasicShell.

Definition at line 358 of file G4UIWin32.cc.

References G4VInteractorManager::DispatchEvent(), exitHelp, fHelp, fHelpChoice, G4VInteractorManager::GetEvent(), interactorManager, and Prompt().

00363 {
00364   fHelp = true;
00365   //
00366   if(interactorManager==NULL) return false;
00367   Prompt("Help");
00368   exitHelp = false;
00369   void* event;
00370   while((event = interactorManager->GetEvent())!=NULL) { 
00371     interactorManager->DispatchEvent(event);
00372     if(exitHelp==true) break;
00373   }
00374   Prompt("session");
00375   //
00376   if(fHelp==false) return false;
00377   aInt = fHelpChoice;
00378   fHelp = false;
00379   return true;
00380 }

Here is the call graph for this function:

LRESULT CALLBACK G4UIWin32::MainWindowProc HWND  a_window,
UINT  a_message,
WPARAM  a_wParam,
LPARAM  a_lParam
[static, private]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 435 of file G4UIWin32.cc.

References G4VBasicShell::ApplyShellCommand(), editWindow, EditWindowProc(), exitPause, exitSession, fHelp, GetCommand(), oldEditWindowProc, textBuffer, textClassName, textCols, textRows, textWindow, and tmpSession.

Referenced by G4UIWin32().

00443 {
00444   static short charWidth,charHeight;
00445 
00446   switch (a_message) { 
00447   case WM_CREATE:{
00448     HDC hdc;
00449     TEXTMETRIC tm;
00450     RECT rect;
00451     GetWindowRect (a_window,&rect);
00452 
00453     hdc = GetDC (a_window);
00454     GetTextMetrics (hdc,&tm);
00455     charWidth = (short)tm.tmAveCharWidth;
00456     charHeight = (short)(tm.tmHeight + tm.tmExternalLeading);
00457     ReleaseDC (a_window,hdc);
00458 
00459     G4UIWin32* This = (G4UIWin32*)tmpSession;
00460     if(This!=NULL) {
00461       This->textWindow = CreateWindow (textClassName,NULL,
00462                                        WS_CHILD | WS_VISIBLE | WS_VSCROLL,
00463                                        0,0,
00464                                        This->textCols * charWidth,
00465                                        This->textRows * charHeight,
00466                                        a_window,NULL,
00467                                        GetWindowInstance(a_window),
00468                                        NULL);
00469       ::SetWindowLong (This->textWindow,GWL_USERDATA,LONG(This));
00470       
00471       This->editWindow = CreateWindow ("edit",NULL,
00472                                        WS_CHILD | WS_VISIBLE | WS_BORDER,
00473                                        0,This->textRows  * charHeight,
00474                                        This->textCols  * charWidth,charHeight,
00475                                        a_window,(HMENU)1,
00476                                        GetWindowInstance(a_window),
00477                                        NULL);
00478       oldEditWindowProc = (WNDPROC)GetWindowLong(This->editWindow,GWL_WNDPROC);
00479       SetWindowLong (This->editWindow,GWL_WNDPROC,(LONG)EditWindowProc);
00480       
00481       MoveWindow (a_window,
00482                   rect.left,rect.top,
00483                   2 * GetSystemMetrics(SM_CXFRAME) + 
00484                   This->textCols  * charWidth,
00485                   GetSystemMetrics(SM_CYCAPTION) + 
00486                   2 * GetSystemMetrics(SM_CYFRAME) + 
00487                   This->textRows * charHeight + charHeight,
00488                   TRUE);
00489     }
00490     }return 0;
00491   case WM_SIZE:{
00492     G4UIWin32* This = (G4UIWin32*)::GetWindowLong(a_window,GWL_USERDATA);
00493     if(This!=NULL) {
00494       // Client size :
00495       int width = LOWORD(a_lParam);
00496       int height = HIWORD(a_lParam);
00497       int editHeight = /*2 * GetSystemMetrics(SM_CYBORDER) + */ charHeight;
00498       MoveWindow (This->textWindow,
00499                   0,0,
00500                   width,height - editHeight,
00501                   FALSE);
00502       MoveWindow (This->editWindow,
00503                   0,height - editHeight,
00504                   width,charHeight,
00505                   FALSE);
00506       ((TextBuffer*)This->textBuffer)->SetHeightOfPage(height/charHeight);
00507     }
00508     }return 0;
00509   case WM_SETFOCUS:{
00510     G4UIWin32* This = (G4UIWin32*)::GetWindowLong(a_window,GWL_USERDATA);
00511     if(This!=NULL) SetFocus (This->editWindow);
00512     }return 0;
00513   case WM_COMMAND:{
00514     G4UIWin32* This = (G4UIWin32*)::GetWindowLong(a_window,GWL_USERDATA);
00515     if(This!=NULL) {
00516       if(This->fHelp==false) {
00517         G4String command = This->GetCommand(a_wParam);
00518         This->ApplyShellCommand (command,exitSession,exitPause);
00519       }
00520     }
00521     }return 0;
00522   case WM_DESTROY:
00523     PostQuitMessage(0);
00524     return   0;
00525   }
00526   return (DefWindowProc(a_window,a_message,a_wParam,a_lParam));
00527 }

Here is the call graph for this function:

void G4UIWin32::PauseSessionStart G4String  a_state  )  [virtual]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VBasicShell.

Definition at line 305 of file G4UIWin32.cc.

References SecondaryLoop().

00310 {
00311   if(a_state=="G4_pause> ") { 
00312     SecondaryLoop ("Pause, type continue to exit this state");
00313   }
00314 
00315   if(a_state=="EndOfEvent") {
00316     // Picking with feed back in event data Done here !!!
00317     SecondaryLoop ("End of event, type continue to exit this state");
00318   }
00319 }

Here is the call graph for this function:

void G4UIWin32::Prompt G4String  a_prompt  ) 
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 290 of file G4UIWin32.cc.

Referenced by GetHelpChoice(), SecondaryLoop(), and SessionStart().

00295 {
00296 }

G4int G4UIWin32::ReceiveG4cerr G4String  a_string  ) 
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 348 of file G4UIWin32.cc.

References TextAppendString().

00353 {
00354   TextAppendString((char*)a_string.data());
00355   return 0;
00356 }

Here is the call graph for this function:

G4int G4UIWin32::ReceiveG4cout G4String  a_string  ) 
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 338 of file G4UIWin32.cc.

References TextAppendString().

00343 {
00344   TextAppendString((char*)a_string.data());
00345   return 0;
00346 }

Here is the call graph for this function:

void G4UIWin32::SecondaryLoop G4String  a_prompt  )  [private]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 321 of file G4UIWin32.cc.

References G4VInteractorManager::DispatchEvent(), exitPause, G4VInteractorManager::GetEvent(), interactorManager, and Prompt().

Referenced by PauseSessionStart().

00326 {
00327   if(interactorManager==NULL) return;
00328   Prompt(a_prompt);
00329   exitPause = false;
00330   void* event;
00331   while((event = interactorManager->GetEvent())!=NULL) { 
00332     interactorManager->DispatchEvent(event);
00333     if(exitPause==true) break;
00334   }
00335   Prompt("session");
00336 }

Here is the call graph for this function:

G4UIsession * G4UIWin32::SessionStart  )  [virtual]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Implements G4VBasicShell.

Definition at line 272 of file G4UIWin32.cc.

References G4VInteractorManager::DisableSecondaryLoop(), G4VInteractorManager::DispatchEvent(), G4VInteractorManager::EnableSecondaryLoop(), exitSession, G4VInteractorManager::GetEvent(), interactorManager, and Prompt().

00276 {
00277   if(interactorManager==NULL) return this;
00278   Prompt       ("session");
00279   exitSession  = false;
00280   interactorManager->DisableSecondaryLoop ();
00281   void*         event;
00282   while((event = interactorManager->GetEvent())!=NULL) { 
00283     interactorManager->DispatchEvent(event);
00284     if(exitSession==true) break;
00285   }
00286   interactorManager->EnableSecondaryLoop ();
00287   return       this;
00288 }

Here is the call graph for this function:

void G4UIWin32::SessionTerminate  ) 
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 298 of file G4UIWin32.cc.

00302 {
00303 }

void G4UIWin32::TextAppendString char *  a_string  ) 
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 684 of file G4UIWin32.cc.

References textBuffer, and textWindow.

Referenced by ReceiveG4cerr(), and ReceiveG4cout().

00689 {
00690   if( (a_string==NULL) || (a_string[0]=='\0') ) return;
00691   if(textWindow==NULL) return;
00692   if(((TextBuffer*)textBuffer)->AppendString(a_string)==true) {
00693     // The appending triggers and end of line, and then updates window :
00694     RECT rect;
00695     GetClientRect(textWindow,&rect);
00696     InvalidateRect(textWindow,NULL,TRUE); //To erase background.
00697     HDC hdc = GetDC(textWindow);
00698     ((TextBuffer*)textBuffer)->Draw(hdc,&rect);
00699     ReleaseDC (textWindow,hdc);
00700     int linen = ((TextBuffer*)textBuffer)->GetNumberOfLines();
00701     SetScrollRange(textWindow,SB_VERT,0,linen-1,TRUE);
00702     SetScrollPos(textWindow,SB_VERT,linen-1,TRUE);
00703   }
00704 }

LRESULT CALLBACK G4UIWin32::TextWindowProc HWND  a_window,
UINT  a_message,
WPARAM  a_wParam,
LPARAM  a_lParam
[static, private]
 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 529 of file G4UIWin32.cc.

References TextBuffer::DecrementEndOfPage(), TextBuffer::Draw(), TextBuffer::GetEndOfPage(), TextBuffer::IncrementEndOfPage(), TextBuffer::JumpDownEndOfPage(), TextBuffer::JumpUpEndOfPage(), TextBuffer::SetEndOfPage(), and textBuffer.

Referenced by G4UIWin32().

00537 {
00538   switch (a_message) { 
00539   case WM_PAINT:{
00540     G4UIWin32* This = (G4UIWin32*)::GetWindowLong(a_window,GWL_USERDATA);
00541     if(This!=NULL) {
00542       TextBuffer* textBuffer = (TextBuffer*)This->textBuffer;
00543       RECT rect;
00544       GetClientRect (a_window,&rect);
00545       PAINTSTRUCT ps;
00546       HDC hdc = BeginPaint(a_window,&ps);
00547       textBuffer->Draw(hdc,&rect);
00548       EndPaint(a_window,&ps);
00549     }
00550     }return 0;
00551   case WM_VSCROLL:{
00552     G4UIWin32* This = (G4UIWin32*)::GetWindowLong(a_window,GWL_USERDATA);
00553     if(This!=NULL) {
00554       TextBuffer* textBuffer = (TextBuffer*)This->textBuffer;
00555       int what = LOWORD(a_wParam);
00556       switch(what) {
00557       case SB_LINEUP:
00558         textBuffer->DecrementEndOfPage();
00559         break;
00560       case SB_LINEDOWN:
00561         textBuffer->IncrementEndOfPage();
00562         break;
00563       case SB_PAGEUP:
00564         textBuffer->JumpUpEndOfPage();
00565         break;
00566       case SB_PAGEDOWN:
00567         textBuffer->JumpDownEndOfPage();
00568         break;
00569       case SB_THUMBPOSITION:
00570       case SB_THUMBTRACK:
00571         textBuffer->SetEndOfPage(HIWORD(a_wParam));
00572         break;
00573       default:
00574         return 0;
00575       }
00576       int eop = textBuffer->GetEndOfPage();
00577       SetScrollPos(a_window,SB_VERT,eop,TRUE);
00578       InvalidateRect(a_window,NULL,TRUE);
00579     }}return 0;
00580   case WM_DESTROY:
00581     PostQuitMessage(0);
00582     return 0;
00583   }
00584   return (DefWindowProc(a_window,a_message,a_wParam,a_lParam));
00585 }

Here is the call graph for this function:


Member Data Documentation

std::map<int,G4String, std::less<int> > G4UIWin32::commands [private]
 

Definition at line 100 of file G4UIWin32.hh.

Referenced by AddButton(), and GetCommand().

HMENU G4UIWin32::defaultMenu [private]
 

Definition at line 99 of file G4UIWin32.hh.

Referenced by AddMenu(), and G4UIWin32().

HWND G4UIWin32::editWindow [private]
 

Definition at line 98 of file G4UIWin32.hh.

Referenced by MainWindowProc().

G4bool G4UIWin32::fHelp [private]
 

Definition at line 106 of file G4UIWin32.hh.

Referenced by EditWindowProc(), GetHelpChoice(), and MainWindowProc().

G4int G4UIWin32::fHelpChoice [private]
 

Definition at line 107 of file G4UIWin32.hh.

Referenced by EditWindowProc(), and GetHelpChoice().

std::vector<G4String> G4UIWin32::fHistory [private]
 

Definition at line 108 of file G4UIWin32.hh.

Referenced by EditWindowProc().

int G4UIWin32::fHistoryPos [private]
 

Definition at line 109 of file G4UIWin32.hh.

Referenced by EditWindowProc().

G4VInteractorManager* G4UIWin32::interactorManager [private]
 

Definition at line 96 of file G4UIWin32.hh.

Referenced by G4UIWin32(), GetHelpChoice(), SecondaryLoop(), and SessionStart().

HWND G4UIWin32::mainWindow [private]
 

Definition at line 97 of file G4UIWin32.hh.

Referenced by AddMenu(), G4UIWin32(), and ~G4UIWin32().

HMENU G4UIWin32::menuBar [private]
 

Definition at line 99 of file G4UIWin32.hh.

Referenced by AddMenu(), and G4UIWin32().

void* G4UIWin32::textBuffer [private]
 

Definition at line 101 of file G4UIWin32.hh.

Referenced by G4UIWin32(), MainWindowProc(), TextAppendString(), TextWindowProc(), and ~G4UIWin32().

int G4UIWin32::textCols [private]
 

Definition at line 102 of file G4UIWin32.hh.

Referenced by MainWindowProc().

int G4UIWin32::textRows [private]
 

Definition at line 102 of file G4UIWin32.hh.

Referenced by MainWindowProc().

HWND G4UIWin32::textWindow [private]
 

Definition at line 98 of file G4UIWin32.hh.

Referenced by MainWindowProc(), TextAppendString(), and ~G4UIWin32().


The documentation for this class was generated from the following files:
Generated on Fri Jun 22 11:07:43 2007 by doxygen 1.3.4