Ejemplo n.º 1
0
//
/// Post a OWL-defined message regarding an event [identified by the 'id'
/// parameter] related to the specified view ('view').
//
/// If the current view changes, posts a WM_OWLVIEW message to indicate a change in
/// the status of the view.
//
void
TDocManager::PostEvent(int id, TView& view)
{
  TWindow* win = GetApplication()->GetMainWindow();
  if (win && win->GetHandle())
    win->SendMessage(WM_OWLVIEW, id, TParam2(&view));
}
Ejemplo n.º 2
0
TWindow *__FASTCALL__ PleaseWaitWnd()
{
   TWindow *w;
   w = CrtDlgWndnls(SYSTEM_BUSY,14,1);
   w->goto_xy(1,1); w->puts(PLEASE_WAIT);
   return w;
}
Ejemplo n.º 3
0
//
/// Post a OWL-defined message regarding an event [identified by the 'id'
/// parameter] related to the specified document ('doc').
//
/// If the current document changes, posts a WM_OWLDOCUMENT message to indicate a
/// change in the status of the document.
//
void
TDocManager::PostEvent(int id, TDocument& doc)
{
  TWindow* win = GetApplication()->GetMainWindow();
  if (win && win->GetHandle())
    win->SendMessage(WM_OWLDOCUMENT, id, TParam2(&doc));
}
Ejemplo n.º 4
0
//
/// When the gadget window receives a WM_COMMAND_ENABLE message, it is likely from a
/// gadget or control within a TControlGadget. This reroutes it to the command
/// target.
//
void
TGadgetWindow::EvCommandEnable(TCommandEnabler& ce)
{
  // If someone derived from TGadgetWindow and handles the command there,
  // give these handlers the first crack.
  //
  TEventInfo eventInfo(WM_COMMAND_ENABLE, ce.GetId());
  if (Find(eventInfo)) {
    Dispatch(eventInfo, 0, TParam2(&ce));
    return;
  }

  TWindow* target = GetParentO();

  // Forward to command target if the enabler was really destined for us, and
  // not a routing from the frame.
  //
  if (target && ce.IsReceiver(*this)) {
    CHECK(target->IsWindow());
    ce.SetReceiver(*target);
    target->EvCommandEnable(ce);
    if( ce.GetHandled() )
      return;
  }

  // Default to TWindow's implementation if the above routing fails
  //
  TWindow::EvCommandEnable(ce);
}
Ejemplo n.º 5
0
//
// !CQ Auto-hide all docking areas? Give them IDW_s
//
/// Handles checking and unchecking of menu items that are associated with
/// decorations.
//
void
TDecoratedFrame::EvCommandEnable(TCommandEnabler& commandEnabler)
{
  // Provide default command text to TooltipEnablers
  //
  if (dynamic_cast<TTooltipEnabler*>(&commandEnabler))
  {
    tstring hint = GetHintText(commandEnabler.GetId(), htTooltip);
    if (hint.length() > 0)
    {
      commandEnabler.SetText(hint);
      return;
    }
  }

#if 0
  TWindow*  decoration;
  if (DocAreaTop)
    decoration = DocAreaTop->ChildWithId(commandEnabler.GetId());
  else
    decoration = ChildWithId(commandEnabler.GetId());
#else
  TWindow*  decoration = ChildWithId(commandEnabler.GetId());
#endif

  if (!decoration)
    TFrameWindow::EvCommandEnable(commandEnabler);

  else {
    commandEnabler.Enable();
    commandEnabler.SetCheck(decoration->IsWindowVisible() ?
                            TCommandEnabler::Checked :
                            TCommandEnabler::Unchecked);
  }
}
void UIAccelerometer::addDelegate(UIAccelerometerDelegate* pDelegate)
{
    UIAccelerometerHandler* pHandler = UIAccelerometerHandler::handlerWithDelegate(pDelegate);

    if (pHandler)
    {
        m_pDelegates->addObject(pHandler);

        if (!m_pSensor)
        {
            m_pSensor = TCOM_Sensors_DataType_Client::GetInstance();

            if (m_pSensor)
            {
                m_pSensor->StartUp();
                m_pSensor->SetDelay(TG3_SENSOR_DELAY_FASTEST);

                TApplication* pApp = TApplication::GetCurrentApplication();
                TWindow* pWnd = pApp->GetActiveWindow();
                m_pSensor->SetWindowCtrlId(pWnd->GetWindowHwndId(), 0);
                m_pSensor->Activate(TG3_SENSOR_TYPE_ACCELEROMETER, TRUE);
            }
            else
            {
                CCLOG("cocos2d: The Accelerometer Sensor Open failed");
            }
        }
    }
}
Ejemplo n.º 7
0
//
/// Sets the text of the gadget. If the given text is blank, then we attempt to
/// load the text from the menu or tooltip.
//
void
TButtonTextGadget::SetText(const tstring& text, bool repaint)
{
  if (text == Text) return;
  Text = text;

  if (Text.length() == 0 && (Style & sText) && GetGadgetWindow())
  {
    TWindow* parent = GetGadgetWindow()->GetParentO();
    TDecoratedFrame* frame= parent ? dynamic_cast<TDecoratedFrame*>(parent) : 0;
    while (parent && !frame){
      parent = parent->GetParentO();
      if (parent)
        frame = dynamic_cast<TDecoratedFrame*>(parent);
    }
    CHECK(frame);
    Text = frame->GetHintText(GetResId().GetInt(), htTooltip);
  }

  if (GetGadgetWindow() && repaint)
  {
    GetGadgetWindow()->GadgetChangedSize(*this);
    Invalidate();
  }
}
Ejemplo n.º 8
0
void TMainMenu::SetWelcomeName()
{
	if(TSettings::GetInstance()->GetNumUsers() == 0)
	{
		TWindow *window = GetChildWindow("welcome", -1);
		if (window)
		{
			window->SetFlags(window->GetFlags() & ~kEnabled);
		}

		window = GetChildWindow("changeplayer", -1);
		if (window)
		{
			window->SetFlags(window->GetFlags() & ~kEnabled);
		}

	}
	else
	{
		TWindow *window = GetChildWindow("welcome", -1);
		if (window)
		{
			TText *text = window->GetCast<TText>();
			text->SetText(TPlatform::GetInstance()->GetStringTable()->GetString("welcome", TSettings::GetInstance()->GetCurrentUserName()));
		}
		
	}
}
Ejemplo n.º 9
0
TWindow * __FASTCALL__ CreateEditor(tAbsCoord X1,tAbsCoord Y1,tAbsCoord X2,tAbsCoord Y2,TWindow::twc_flag flags)
{
 TWindow *ret;
 ret = new(zeromem) TWindow(X1,Y1,X2-X1+1,Y2-Y1+1,flags);
 ret->set_color(dialog_cset.editor.active);
 ret->clear();
 return ret;
}
Ejemplo n.º 10
0
void TWindow::Create()
{
	ASSERT(!IsCreated());
	if (!IsCreated())
	{
		int screen = gApplication->GetDefaultScreen();
		Window parent = (fParent ? fParent->GetXWindow() : RootWindow(sDisplay, screen));

		XSetWindowAttributes	attributes;
		unsigned long attributesMask = CWBackPixel;
		int border = fBorder;

		attributes.background_pixel = fBackColor.GetPixel();

		if (fStyle == kPopupWindow)
		{
			attributes.save_under = true;
			attributes.override_redirect = true;
			attributesMask |= CWSaveUnder;
			attributesMask |= CWOverrideRedirect;
			border = 1;
		}
		
		fWindow = XCreateWindow(sDisplay, parent, fBounds.left, fBounds.top, GetWidth(), GetHeight(), 
										border,	CopyFromParent, InputOutput, CopyFromParent, attributesMask, &attributes);

		XSelectInput(sDisplay, fWindow, ExposureMask|FocusChangeMask|
									KeyPressMask|KeyReleaseMask|
									ButtonPressMask|ButtonReleaseMask|
									EnterWindowMask|LeaveWindowMask|PointerMotionMask|
									StructureNotifyMask | VisibilityChangeMask /*|SubstructureNotifyMask*/
									);
									
		XWindowAttributes	attr;
		XGetWindowAttributes(sDisplay, fWindow, &attr);
		fDepth = attr.depth;

	 	if (fStyle == kTopLevelWindow)
	 	{
	 		Atom	atoms[2] = { sDeleteWindowAtom, sTakeFocusAtom };
//ignore take focus?			XSetWMProtocols(sDisplay, fWindow, atoms, 2);
			XSetWMProtocols(sDisplay, fWindow, atoms, 1);
		}

		AddWindow(this);

		// give the positioner a chance to do its thing
//		if (fParent && fPositioner)
//			fPositioner(this, fParent->fBounds, fParent->fBounds);

		SetCursor(sDefaultCursor);

		TListIterator<TWindow> iter(fChildren);
		TWindow* child;
		while ((child = iter.Next()) != NULL)
			child->Create();
	}
}
Ejemplo n.º 11
0
void TWindow::NotifyBoundsChanged(const TRect& oldBounds)
{
	TListIterator<TWindow> iter(fChildren);

	TWindow* window;
	
	while ((window = iter.Next()) != NULL)
		window->ParentBoundsChanged(oldBounds, fBounds);
}
Ejemplo n.º 12
0
void TWindow::ProcessUpdates()
{
	TWindow* window = sFirstUpdate;
	sFirstUpdate = NULL;
	
	while (window)
	{
		window->Update();
		window = window->fNextUpdate;
	}
}
Ejemplo n.º 13
0
//
/// When the gadget window receives a WM_COMMAND message, it is likely from a gadget
/// or control within a TControlGadget. This reroutes it to the command target.
//
TResult
TGadgetWindow::EvCommand(uint id, HWND hWndCtl, uint notifyCode) 
{
  TRACEX(OwlCmd, 1, "TGadgetWindow::EvCommand - id(" << id << "), ctl(" <<\
                     hex << uint(hWndCtl) << "), code(" << notifyCode  << ")");

  // First allow any derived class that wants to handle the command
  // NOTE: This search only caters for menu-style WM_COMMANDs (not those
  //       sent by controls)
  //
  TEventInfo  eventInfo(0, id);
  if (Find(eventInfo)) {
    Dispatch(eventInfo, id);
    return 0;
  }


#if 0
  // Prior versions of TGadgetWindow relied on TWindow's EvCommand for
  // dispatching WM_COMMAND events. This required that one derives from
  // a decoration class (eg. TControlbar, TToolbox) to handle control
  // notifications. The current version uses a more generalized logic
  // involving the CommandTarget and a frame ancestor class. This allows
  // a client window to handle notifications of a control in a toolbar
  // without using a TControlbar-derived class.
  // However, if you need to previous behaviour, simply invoke TWindow's
  // EvCommand from this handler.

  return TWindow::EvCommand(id, hWndCtl, notifyCode);
#endif

  TWindow* target;
  TFrameWindow* frame;

  // Find the frame who is our latest ancestor and make it our command target
  //
  for (target = GetParentO(); target; target = target->GetParentO()) {
    frame = TYPESAFE_DOWNCAST(target, TFrameWindow);
    if (frame || !target->GetParentO())
      break;
  }

  // Make sure the frame doesn't think we are its command target, or a BAD
  // loop will happen
  //
  if (target && (!frame || frame->GetCommandTarget() != GetHandle())) {
    CHECK(target->IsWindow());
    return target->EvCommand(id, hWndCtl, notifyCode);
  }

  // If all command routing fails, go back to basic dispatching of TWindow
  //
  return TWindow::EvCommand(id, hWndCtl, notifyCode);
}
Ejemplo n.º 14
0
void TWindow::DoDestroy()
{
	TListIterator<TWindow> iter(fChildren);

	TWindow* child;
	while ((child = iter.Next()) != NULL)
		child->Destroy();

	if (IsCreated())
		XDestroyWindow(sDisplay, fWindow);

	delete this;
}
Ejemplo n.º 15
0
//
/// Search for child with ID = IDW_TOOLBAR, and if found check that it is
/// GadgetWindow and return it;
//
TGadgetWindow*
TDecoratedFrame::GetControlBar()
{
  TWindow* wnd = ChildWithId(IDW_TOOLBAR);
  if(!wnd){
    wnd = FirstThat(IsHaveGadgetWindow);
    if(!wnd || (wnd = wnd->ChildWithId(IDW_TOOLBAR))==0)
      return 0;
  }
  TGadgetWindow* toolBar = TYPESAFE_DOWNCAST(wnd, TGadgetWindow);
  if(toolBar)
    return toolBar;
  return 0;
}
Ejemplo n.º 16
0
void BeyeContext::init_tconsole( unsigned long vio_flg,unsigned long twin_flg )
{
    beye_priv& priv = static_cast<beye_priv&>(opaque);
    priv._tconsole=twInit(system(),codepage,vio_flg,twin_flg);
    if(priv._tconsole->vio_width() < 80 || priv._tconsole->vio_height() < 3) {
	if(priv._tconsole->vio_width()>16 && priv._tconsole->vio_height()>2) {
	    unsigned evt,x,y;
	    TWindow *win;
	    x = (priv._tconsole->vio_width()-17)/2;
	    y = (priv._tconsole->vio_height()-3)/2;
	    win = new(zeromem) TWindow(x,y,x+16,y+2,TWindow::Flag_None | TWindow::Flag_NLS);
	    if(!win) goto done;
	    win->set_title(" Error ",TWindow::TMode_Center,error_cset.border);
	    win->into_center();
	    win->set_color(error_cset.main);
	    win->set_frame(TWindow::DOUBLE_FRAME,error_cset.border);
	    win->goto_xy(1,1);
	    win->puts("Screensize<80x3");
	    win->show();
	    do {
		evt = GetEvent(NULL,NULL,win);
	    }while(!(evt == KE_ESCAPE || evt == KE_F(10) || evt == KE_ENTER));
	    delete win;
	}
done:
	twDestroy();
	std::cerr<<"Current size of video buffer is: w="<<priv._tconsole->vio_width()<<" h="<<priv._tconsole->vio_height()<<std::endl;
	throw std::runtime_error("Size of video buffer must be larger than 79x2");
    }
}
Ejemplo n.º 17
0
//
/// Applies the specified 'action' function to each TPropertyPage child of the
/// sheet.
/// \note The logic here traverses the TPropertySheet's ChildList. Therefore
///       we will miss any page that does not have an associated TPropertyPage
///       inserted in the sheet's ChildList.
void
TPropertySheet::ForEachPage(TActionPageFunc action, void* paramList)
{
  if (GetLastChild()) {
    TWindow*  curChild;
    TWindow*  nextChild = GetLastChild()->Next();
    TPropertyPage* curPage;
    do {
      curChild = nextChild;
      nextChild = nextChild->Next();
      curPage = TYPESAFE_DOWNCAST(curChild, TPropertyPage);
      if (curPage)
        action(curPage, paramList);
    } while (curChild != GetLastChild() && GetLastChild() != 0);
  }
}
Ejemplo n.º 18
0
//
/// Creates a TControlGadget object associated with the specified TControl window.
//
TControlGadget::TControlGadget(TWindow& control, TBorderStyle border)
:
  TGadget(control.GetId(), border)
{
  Control = &control;
  Control->ModifyStyle(0, WS_CLIPSIBLINGS);  // Make sure relayout paints OK
  TRACEX(OwlGadget, OWL_CDLEVEL, "TControlGadget constructed @" << (void*)this);
}
Ejemplo n.º 19
0
void
TApplication::ReadyToRun()
{
	EAlert *alert = new EAlert("Question",
				   "Would you like to run the scroll-test?\nChoose \"Cancel\" to quit.",
				   "Cancel", "OK", NULL,
				   E_WIDTH_AS_USUAL, E_IDEA_ALERT);

	if(alert->Go() != 1)
	{
		Quit();
		return;
	}

	TWindow *win = new TWindow(ERect(100, 100, 550, 500), "Scroll Test", E_TITLED_WINDOW, 0);
	win->Show();
}
Ejemplo n.º 20
0
//
/// Insert a decoration window into position at one of the four edges.
//
/// After you specify where the decoration should be placed, Insert adds it just
/// above, below, left, or right of the client window. This process is especially
/// important when there are multiple decorations. Insert looks at the decoration's
/// Attr.Style member and checks the WS_VISIBLE flag to tell whether the decoration
/// should initially be visible or hidden.
/// To position the decoration, Insert uses TLocation enum, which describes Top,
/// Left, Bottom, and Right positions where the decoration can be placed.
//
void
TDecoratedFrame::Insert(TWindow& decoration, TLocation location)
{
  // Store away location for remove/re-insetion
  //
  SetLocation(decoration, location);

  // Make sure the decoration has clipsiblings style, since our rearranging
  // causes corners to overlap sometimes.
  //
  ModifyStyle(0, WS_CLIPSIBLINGS);//|WS_CLIPCHILDREN);///????

  // Parent to decframe and remove layoutmetrics in case it's a re-insert
  //
  decoration.SetParent(this);
  RemoveChildLayoutMetrics(decoration);

  // If the window should be visible, proceed with insertion.
  // NOTE: Should we check the 'wfInsertAtEdge' flag here? It mostly
  //       important when hiding/showing decorations [i.e. In EvCommand
  //       handler]. However, it would be nice to check for it and use
  //       something other than ClientWnd if necessary.
  //
  if (decoration.GetWindowAttr().Style & WS_VISIBLE) {
    switch (location) {
      case None:
        break;
      case Top:
        InsertAtTop(decoration, ClientWnd);
        break;
      case Bottom:
        InsertAtBottom(decoration, ClientWnd);
        break;
      case Left:
        InsertAtLeft(decoration, ClientWnd);
        break;
      case Right:
        InsertAtRight(decoration, ClientWnd);
        break;
      default: //JJH added empty default statement
  break;
    }
  }
}
Ejemplo n.º 21
0
//
/// Applies the specified 'test' function to each 'TPropertyPage' of the sheet and
/// returns the first page which causes the 'test' function to return true. Returns
/// '0' if no page meets the condition.
//
TPropertyPage*
TPropertySheet::FirstPageThat(TCondPageFunc test, void* paramList)
{
  if (GetLastChild()) {
    TWindow*  curChild;
    TWindow*  nextChild = GetLastChild()->Next();
    TPropertyPage* curPage;
    do {
      curChild = nextChild;
      nextChild = nextChild->Next();
      curPage = TYPESAFE_DOWNCAST(curChild, TPropertyPage);
      if (curPage) {
        if (test(curPage, paramList))
          return curPage;
      }
    } while (curChild != GetLastChild() && GetLastChild() != 0);
  }
  return 0;
}
Ejemplo n.º 22
0
//
/// Insert a decoration window at the left of the client area, possibly to the
/// left of another given decoration or the client
//
void
TDecoratedFrame::InsertAtLeft(TWindow& decoration, TWindow* insertLeftOf)
{
  TLayoutMetrics  metrics;
  TWindow*        insertRightOf;

  // Get the layout metrics for "insertLeftOf"(the window the decoration is
  // going to be inserted to the left of)
  //
  GetChildLayoutMetrics(*insertLeftOf, metrics);

  insertRightOf = metrics.X.RelWin;

  // If "insertLeftOf" has a border then set its left edge to be the same as
  // the decoration's right edge; otherwise place its left edge one pixel to
  // the right of the decoration's right edge
  //
  metrics.X.Set(lmLeft,
                insertLeftOf->GetWindowAttr().Style & WS_BORDER ? lmSameAs : lmRightOf,
                &decoration, lmRight);
  SetChildLayoutMetrics(*insertLeftOf, metrics);

  // Now set the layout metrics for the decoration so it's left edge is the
  // same as the right edge of "insertRightOf"
  //
  bool overlap = (decoration.GetWindowAttr().Style & WS_BORDER);

  metrics.X.Set(lmLeft, overlap ? lmSameAs : lmRightOf, insertRightOf,
                insertRightOf ? lmRight : lmLeft);

  metrics.Width.AsIs(lmWidth);

  // If the client window & decoration both have or don't have borders then
  // place the decoration so its "y" and "bottom" are the same as the client
  // windows; otherwise place its "y" above/below the client window's "y" and
  // its "bottom" below/above the client window's "bottom" based on who's has
  // borders & who doesn't
  //
  // This way if there are top or bottom decorations they will be tiled
  // over/under the left/right decorations
  //
  if (ToBool(ClientWnd->GetWindowAttr().Style & WS_BORDER) == overlap) {
    metrics.Y.SameAs(ClientWnd, lmTop);
    metrics.Height.SameAs(ClientWnd, lmBottom);
  }
  else if (overlap) {
    metrics.Y.Set(lmTop, lmAbove, ClientWnd, lmTop);
    metrics.Height.Set(lmBottom, lmBelow, ClientWnd, lmBottom);
  }
  else {
    metrics.Y.Set(lmTop, lmBelow, ClientWnd, lmTop);
    metrics.Height.Set(lmBottom, lmAbove, ClientWnd, lmBottom);
  }
  SetChildLayoutMetrics(decoration, metrics);
}
Ejemplo n.º 23
0
//
/// Give the decorations an opportunity to do pre-processing. Don't bother
/// checking the client window since it is typically in the focus chain and
/// will be given an opportunity to do pre-processing
//
bool
TDecoratedFrame::PreProcessMsg(MSG& msg)
{
  TWindow*  firstChild = GetFirstChild();

  if (firstChild) {
    TWindow*  child = firstChild;

    do {
      if (child != ClientWnd && child->GetHandle() &&
         (child->GetWindowLong(GWL_STYLE) & WS_VISIBLE) &&
          child->PreProcessMsg(msg))
        return true;

      child = child->Next();
    } while (child != firstChild);
  }

  return TFrameWindow::PreProcessMsg(msg);
}
Ejemplo n.º 24
0
status_t
TMagnify::MagnifyTask(void *arg)
{
	TMagnify* view = (TMagnify*)arg;

	// static data members can't access members, methods without
	// a pointer to an instance of the class
	TWindow* window = (TWindow*)view->Window();

	while (true) {
		if (window->Lock()) {
			if (view->NeedToUpdate() || view->Active())
				view->Update(view->NeedToUpdate());

			window->Unlock();
		}
		snooze(35000);
	}

	return B_NO_ERROR;
}
Ejemplo n.º 25
0
void TWindow::Show(bool doShow)
{
	if (!IsCreated())
		Create();

	if (doShow)
	{
		XMapWindow(sDisplay, fWindow);
		fVisibility = kWindowVisible;
	}
	else
	{
		XUnmapWindow(sDisplay, fWindow);
		fVisibility = kWindowHidden;
	}

	TListIterator<TWindow> iter(fChildren);
	TWindow* child;
	while ((child = iter.Next()) != NULL)
		child->ParentShown(doShow);
}
Ejemplo n.º 26
0
//
/// Event handler for the WM_HELP message.
//
void
THelpFileManager::EvHelp(const HELPINFO& hi)
{
  THelpContext context;
  bool success = false;
  uint hlpCmd = HELP_CONTEXTPOPUP;

  if (hi.iContextType == HELPINFO_MENUITEM){
    success = GetHelpContextFromMenu(context, hi.iCtrlId);
    hlpCmd = HELP_CONTEXT;
  }
  else if (hi.iContextType == HELPINFO_WINDOW)
    success = GetHelpContextFromControl(context, hi.iCtrlId, (HWND)hi.hItemHandle);

  LastHit = hi.MousePos;
  if (::GetKeyState(VK_F1) < 0 && ::GetKeyState(VK_SHIFT) < 0)
  {
    TWindow* wnd = context.GetWindow();
    TWindow* child = wnd->ChildWithId(hi.iCtrlId);
    LastHit = TPoint(wnd->GetWindowAttr().X + child->GetWindowAttr().X, wnd->GetWindowAttr().Y + child->GetWindowAttr().Y);
  }
  else if(::GetKeyState(VK_F1) < 0)
    LastHit = TPoint(-1, -1);

  if (success)
    ActivateHelp(context.GetWindow(), context.GetHelpFileContextId(), hlpCmd);
}
Ejemplo n.º 27
0
void
TFlatPainter::Paint(TDC& dc, TRect& rect)
{
  TWindow* wnd = TYPESAFE_DOWNCAST(this, TWindow);
  if(!wnd)
    return;

  if(IsSet(fpMouseIn) && wnd->IsWindowEnabled()){
    // We draw the "tracked" situation
#ifdef TEST
    TBrush brush (TColor::LtRed);
#else
    TBrush brush (TColor::Sys3dFace);
#endif
    dc.FrameRect(rect, brush);
    rect.Inflate(-1, -1);
    dc.FrameRect(rect, brush);
    rect.Inflate(-1, -1);
    dc.FrameRect(rect, brush);
    rect.Inflate(1, 1);
    TUIBorder::DrawEdge(dc, rect, TUIBorder::SunkenOuter, TUIBorder::Rect);
  }
  else{
    // We draw the "untracked" situation
#ifdef TEST
    TBrush brush(TColor::LtBlue);
    TBrush brush2(TColor::LtGreen);
#else
    TBrush brush(TColor::Sys3dFace);
    TBrush brush2(TColor::SysWindow);
#endif

    dc.FrameRect(rect,brush);
    rect.Inflate(-1, -1);
    dc.FrameRect(rect,brush);
    rect.Inflate(-1, -1);
    dc.FrameRect(rect, brush2);
  }
}
Ejemplo n.º 28
0
void
TGadgetWindow::EnableTooltip(bool enable)
{
  if (!Tooltip) {

    // Find a parent for the tooltip: It's attractive to make the
    // gadgetwindow the owner of the tooltip, a popup window. However, this
    // will typically fail since the gadget window is invariably a child
    // window. Windows seems to accomodate this situation by simply making
    // the tooltip's owner the gadgetwindow's owner. This works fine until
    // the owner of the gadgetwindow is destroyed before the gadgetwindow
    // is destroyed, such as in the case of a gadgetwindow initally created
    // as a floating docking toolbar; When it's docked, the floating slip,
    // it's original owner, is destroyed and the gadget window is reparented
    // to an edge slip. In this scenario, the tooltip is silently destroyed
    // along with the floating slip [it's real owner!] and the docked
    // gadgetwindow no longer provide tool tips!
    //

    // To circumvent this scenario, we'll look for a window which is fairly
    // stable/rooted as owner of the tooltip. Ideally, we'll get the
    // application's main window.
    //
    TWindow* tipParent = this;
    while (tipParent->GetParentO()) {
      tipParent = tipParent->GetParentO();
      if (tipParent->IsFlagSet(wfMainWindow))
        break;
    }

    // Create and initialize tooltip
    //
    SetTooltip(new TTooltip(tipParent));
  }
  else {
    if (Tooltip->GetHandle())
      Tooltip->Activate(enable);
  }
}
Ejemplo n.º 29
0
/// Move and resize the window so that the window is the same size as the hyperlink
/// text. This stops the hyperlink cursor being active when it is not directly over
/// the text. If the text is left justified then the window is merely shrunk, but if
/// it is centred or right justified then the window will have to be moved as well.
//
// Suggested by Pål K. Tønder
void
TUrlLink::PositionWindow()
{
  // Get the current window position
  TRect rect;
  GetWindowRect(rect);

  TWindow* pParent = GetParentO();
  if(pParent){
    pParent->ScreenToClient(rect.TopLeft());
    pParent->ScreenToClient(rect.BottomRight());
  }

  // Get the size of the window text
  TTmpBuffer<tchar> buffer(MAX_PATH);
  GetText(buffer, MAX_PATH);

  TSize size = LinkFont->GetTextExtent(&buffer[0]);

  // Get the text justification via the window style
  uint32 style = GetStyle(); //TWindow

  // Recalc the window size and position based on the text justification
  if (style & SS_CENTERIMAGE)
    rect.Inflate(0, -(rect.Height() - size.cy)/2);
  else
    rect.bottom = rect.top + size.cy;

   if (style & SS_CENTER)
    rect.Inflate( -(rect.Width() - size.cx)/2, 0);
  else if (style & SS_RIGHT)
    rect.left  = rect.right - size.cx;
  else // SS_LEFT = 0, so we can't test for it explicitly
    rect.right = rect.left + size.cx;

  // Move the window
  SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
}
Ejemplo n.º 30
0
TWindow * __FASTCALL__ CrtHlpWndnls(const std::string& title,tAbsCoord x2,tAbsCoord y2)
{
 TWindow *win;
 TWindow::twc_flag flags = TWindow::Flag_Has_Frame|TWindow::Flag_NLS;
 win = new(zeromem) TWindow(0,0,x2+2,y2+2,flags);
 win->into_center();
 win->set_color(help_cset.main);
 win->clear();
 win->set_frame(TWindow::DOUBLE_FRAME,help_cset.border);
 if(!title.empty()) win->set_title(title,TWindow::TMode_Center,help_cset.title);
 win->show();
 return win;
}