Exemplo n.º 1
0
//
/// Calls TButtonGadget::GetDesiredSize  if (Style & sBitmap); calls
/// TGadget::GetDesiredSize and adds the size of the text region.
//
void
TButtonTextGadget::GetDesiredSize(TSize& size)
{
  PRECONDITION(Window);
  TRACEX(OwlGadget, 1, _T("TButtonTextGadget::GetDesiredSize() enter @") << this <<
    _T(" size ") << size);

  if(Style&sBitmap)
    TButtonGadget::GetDesiredSize(size);
  else
    TGadget::GetDesiredSize(size);

  // if paint text -> add text size
  if(Style&sText){
    TSize textSize;
    GetTextSize(textSize);

    TSize gsize;
    TGadget::GetDesiredSize(gsize);
    switch(LayoutStyle){
       case lTextLeft:
       case lTextRight:
         size.cx += textSize.cx + TextSpaceV;
         size.cy =  std::max(size.cy,textSize.cy+gsize.cy);
         break;
       case lTextTop:
       case lTextBottom:
         size.cx += std::max(size.cx,textSize.cx+gsize.cx);
         size.cy += textSize.cy + TextSpaceH;
         break;
    }
  }
  TRACEX(OwlGadget, 1, _T("TButtonTextGadget::GetDesiredSize() leave @") << this <<
    _T(" size ") << size);
}
Exemplo n.º 2
0
//
/// Starts the thread executing. The actual call depends on the operating system.
/// Returns the handle of the thread.
/// After the system call we check status. 
//
TThread::THandle TThread::Start()
{
  // If Start() has already been called for this thread, release the
  // previously created system thread object before launching a new one.
  //
  if ((GetStatus() != Created) && Handle) {
    ::CloseHandle(Handle);
  }

# if defined(BI_MULTI_THREAD_RTL)
#    if defined(BI_COMP_MSC) || defined(BI_COMP_GNUC)
  Handle = (HANDLE)::_beginthreadex(0, 4096, &TThread::Execute, this, 0, (uint*)&ThreadId);
#    else
  Handle = (HANDLE)::_beginthreadNT(&TThread::Execute, 4096, this, 0, 0, &ThreadId);
#    endif
# else
  Handle = ::CreateThread(0, 0, &TThread::Execute, this, 0, &ThreadId);
# endif


  if (Handle) {
    TRACEX(OwlThread, 1, _T("Thread started [id:") << Handle << _T(']'));
    Stat = Running;
  }
  else {
    TRACEX(OwlThread, 2, _T("Thread failed to start"));
    Stat = Invalid;
    throw TThreadError(TThreadError::CreationFailure);
  }

  return Handle;
}
Exemplo n.º 3
0
//
/// Removes a template from the list of templates currently managed by
/// the DocManager.
//
void
TDocManager::DeleteTemplate(TDocTemplate& tpl)
{
  // Skip static templates
  //
  if (tpl.IsStatic()) {
    TRACEX(OwlDocView, 0, _T("TDocManager::DeleteTemplate() invoked for static"));
    return;
  }

  // Check if it has an owner
  //
  if (!tpl.GetDocManager()) {
    TRACEX(OwlDocView, 0, _T("TDocManager::DeleteTemplate(), templ. has no owner"));
    return;
  }

  // Unreference the template - will be deleted unless documents
  // still reference template.
  //
  if (TDocTemplate::RemoveLink((TRegLink**)&TemplateList, &tpl)) {
    UnRefTemplate(tpl);
    return;
  }

  TRACEX(OwlDocView, 0, _T("TDocManager::DeleteTemplate(), not in app list"));
}
Exemplo n.º 4
0
/*==========================================================================*
 * FUNCTION : CommAccept
 * PURPOSE  : To accept a client from a server port
 * CALLS    : 
 * CALLED BY: 
 * ARGUMENTS: IN HANDLE  hPort : The opened server type port
 * RETURN   : HANDLE : NON-NULL: The accepted client handle. NULL: failure
 * COMMENTS : 
 *==========================================================================*/
 HANDLE CommAccept(IN HANDLE hPort)
{
	STD_PORT_DRV *pPort = (STD_PORT_DRV *)hPort;
	STD_PORT_DRV *pClient;
	HANDLE		hClient;

	pClient = NEW(STD_PORT_DRV, 1);
	if (pClient == NULL)
	{
#ifdef _DEBUG_HAL_COMM
		TRACEX("[CommAccept] -- No memory to new STD_PORT_DRV for client.\n");
#endif //_DEBUG_HAL_COMM
		return NULL;
	}

	hClient = pPort->pfnAccept( pPort->hInstance );
	if (hClient == NULL)
	{
#ifdef _DEBUG_HAL_COMM
		TRACEX("[CommAccept] --  Fails on accepting client.\n");
#endif //_DEBUG_HAL_COMM

		DELETE(pClient);

		return NULL;
	}

	*pClient = *pPort;				// get all properties of parent port.
	pClient->hInstance = hClient;	// new instance.
	(*pPort->pLibRef)++;			// increase ref.

	return (HANDLE)pClient;
}
Exemplo n.º 5
0
//
/// Initializes the view. Notifies others a view is created by posting the dnCreate
/// event.
//
TView*
TDocument::InitView(TView* view)
{
  if (!view) {
    TRACEX(OwlDocView, 0, _T("InitView(): 0 view specified!"));
    return 0;
  }
  if (!view->IsOK()) {
    TRACEX(OwlDocView, 0, _T("InitView(): Invalid view object specified!"));
    delete view;
    return 0;
  }

  CHECK(DocManager);
  DocManager->PostEvent(dnCreate, *view);

  if (!view->IsOK()) {
    TRACEX(OwlDocView, 0, _T("InitView(): Invalid view object post dnCreate!"));
    delete view;
    return 0;
  }

  ReindexFrames();
  TView::BumpNextViewId();

  return view;
}
Exemplo n.º 6
0
//
/// Returns the total number of properties for this document, where index is the
/// property index, dest contains the property data, and textlen is the size of the
/// array. If textlen is 0, property data is returned as binary data; otherwise,
/// property data is returned as text data.
//
int
TDocument::GetProperty(int prop, void * dest, int textlen)
{
  LPCTSTR src;
  tchar   numBuf[15];
  switch (prop) {
    case DocumentClass: {
        _USES_CONVERSION;
        src = _A2W(_OBJ_FULLTYPENAME(this));
      }
      break;

    case TemplateName:
      src = Template ? Template->GetDescription() : 0;
      break;

    case ViewCount: {
      int cnt;
      TView* view;
      for (view=ViewList, cnt=0; view != 0; view=view->NextView, cnt++)
        ; // Do nothing
      if (!textlen) {
        *(int *)dest = cnt;
        return sizeof(int);
      }
      wsprintf(numBuf, _T("%d"), cnt);
      src = numBuf;
      break;
    }

    case StoragePath:
      src = DocPath;
      break;

    case DocTitle:
      src = Title;
      break;

    default:
      TRACEX(OwlDocView, 0, _T("GetProperty(): invalid property [") 
             << prop << _T("] specified!") );
      return 0;
  }

  if (!textlen) {
    TRACEX(OwlDocView, 0, _T("GetProperty(): 0-Length buffer specified!"));
    return 0;
  }
  int srclen = src ? static_cast<int>(::_tcslen(src)) : 0;
  if (textlen > srclen)
    textlen = srclen;
  if (textlen)
    memcpy(dest, src, textlen*sizeof(tchar));
  *((LPTSTR)dest + textlen) = 0;
  return srclen;
}
Exemplo n.º 7
0
BOOL CRegNewUserDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	//! 서버의 메시지를 받을수 있게 준비.
	CChatSession::Instance().SetOwnerWnd(this->GetSafeHwnd());	
	
	if(m_strId.IsEmpty() == FALSE)
	{
		m_bModify = TRUE;
		InitInfo();
	}
	else
	{
		m_bModify = FALSE ;

		TRACEX("RAWSQL_GETCOMPANY_INFO 요청!\n");
		CString		strSql;	
		strSql = GetQueryCompany(); // name, code 구한다.	
		if(CChatSession::Instance().RequestRawSQL(RAWSQL_GETCOMPANY_INFO, (LPCSTR)strSql, strlen((LPCSTR)strSql) ) != TRUE)
		{
			return FALSE ;
		}

	    Sleep(1);

		// 직급 combobox setting m_cbGrade
		TRACEX("RAWSQL_GETCLASS_INFO 요청!\n");

		strSql = GetQueryClass(); // name, code 구한다.
		if(CChatSession::Instance().RequestRawSQL(RAWSQL_GETCLASS_INFO, (LPCSTR)strSql, strlen((LPCSTR)strSql) ) != TRUE)
		{
			return FALSE ;
		}

	}
	// 사용자상태에 따른 처리
	if( m_strStatus == _T("00") )
	{
		SetDlgItemText(ID_EB_PWD, _T(""));
		SetDlgItemText(ID_EB_CONFIRM_PWD, _T(""));
	}
	else
	{
		GetDlgItem(ID_EB_REG_SID		)->EnableWindow(FALSE);
		GetDlgItem(ID_EB_REG_NAME		)->EnableWindow(FALSE);
		GetDlgItem(ID_EB_USER_ID		)->EnableWindow(FALSE);
		GetDlgItem(ID_BTN_DUPID_CHECK	)->EnableWindow(FALSE);
	}

	/////////////////////////////////////////////////////////////////

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 8
0
//
/// Return name of predefined Windows button class
//
/// Overrides TWindow's GetClassName function. Returns the name "BUTTON".
//
TWindow::TGetClassNameReturnType
TButton::GetClassName()
{
#if defined(OWL_SUPPORT_BWCC)
  if (GetApplication()->BWCCEnabled()) {
    TRACEX(OwlControl, 1, "BWCC button used for classname @" << (void*)this);
    return BUTTON_CLASS;
  }
#endif
  TRACEX(OwlControl, 1, "Regular button used for classname @" << (void*)this);
  return _T("BUTTON");
}
Exemplo n.º 9
0
//
/// Calls TGadget::SetBounds and passes the dimensions of the control gadget's
/// rectangle. SetBounds informs the control gadget of a change in its bounding
/// rectangle.
//
void
TControlGadget::SetBounds(const TRect& bounds)
{
  TRACEX(OwlGadget, 1, "TControlGadget::SetBounds() enter @" << (void*)this <<
    " bounds = " << bounds);

  // Set the gadget bounds, then move & repaint the control
  //
  TGadget::SetBounds(bounds);
  Control->SetWindowPos(0, Bounds, SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOSIZE);

  TRACEX(OwlGadget, 1, "TControlGadget::SetBounds() leave @" << (void*)this <<
    " bounds = " << bounds);
}
Exemplo n.º 10
0
//
/// Return name of Windows check box class
//
/// returns "BUTTON."
//
TWindow::TGetClassNameReturnType
TCheckBox::GetClassName()
{
#if defined(OWL_SUPPORT_BWCC)
  if (GetApplication()->BWCCEnabled()) {
    TRACEX(OwlControl, 1, _T("BWCC checkbox used for classname @") << (void*)this);
    // !CQ to be consistent, we should do this trace for ALL bwcc-able controls,
    // !CQ or none.
    return CHECK_CLASS;
  }
#endif
  TRACEX(OwlControl, 1, _T("Regular checkbox used for classname @") << (void*)this);
  return _T("BUTTON");
}
Exemplo n.º 11
0
//
/// Constructs a TControlBar interface object with the specified direction (either
/// horizontal or vertical) and window font.
//
TControlBar::TControlBar(TWindow*        parent,
                         TTileDirection  direction,
                         TFont*          font,
                         TModule*        module)
:
  TGadgetWindow(parent, direction, font, module)
{
  GetMargins().Units = TMargins::BorderUnits;

  if (GetDirection() == Horizontal){
    GetMargins().Left = GetMargins().Right = TUIMetric::CxFixedFrame;
    GetMargins().Top = GetMargins().Bottom = TUIMetric::CyFixedFrame;
  }
  else {
    GetMargins().Left = GetMargins().Right = TUIMetric::CxFixedFrame;
    GetMargins().Top = GetMargins().Bottom = TUIMetric::CyFixedFrame;
  }

//  Margins.Left = Margins.Right = TUIMetric::CxSizeFrame + 2;  // (6) fixed?
//  Margins.Top = Margins.Bottom = TUIMetric::CyFixedFrame;     // (2) fixed?

  // Toolbars default to having tooltips
  //
  SetWantTooltip(true);

  TRACEX(OwlWin, OWL_CDLEVEL, "TControlBar constructed @" << (void*)this);
}
Exemplo n.º 12
0
int
TDocManager::GetSaveTemplates(TDocTemplate** tplList, int size,
                              TDocument& doc, bool sameDoc)
#endif
{
  // Check for no registered templates
  //
  if (!TemplateList) {
    TRACEX(OwlDocView, 0, _T("GetSaveTemplates(): No registered templates!"));
    return 0;
  }

  // Walk thru all of the templates looking for visible, non-dtReadOnly ones,
  // and if the same doc, ones that match the document
  //
  int tplCount = 0;
  for (TDocTemplate* tpl = TemplateList; tpl; tpl = tpl->GetNextTemplate()) {
    if (tpl->IsVisible() && !tpl->IsFlagSet(dtReadOnly)
                         && (!sameDoc || tpl->IsMyKindOfDoc(doc))) {
      if (tplList) {
        CHECK(tplCount < size);
        tplList[tplCount] = tpl;
      }
      tplCount++;
    }
  }
  return tplCount;
}
Exemplo n.º 13
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//                                                                    TOWLEXTDll
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TOWLEXTDll::TOWLEXTDll(bool shouldLoad, bool mustLoad)
:
TModule(OwlExtName, shouldLoad, mustLoad),
GetOWLEXTVersion(*this, "GetOWLEXTVersion")
{
  TRACEX(OwlExtModule, 1, "TOWLEXTDll external constructor invoked");
}
Exemplo n.º 14
0
//
/// Destroys a TControlGadget object and removes it from the associated window.
//
TControlGadget::~TControlGadget()
{
  if(Control)
    Control->Destroy(0);
  delete Control;
  TRACEX(OwlGadget, OWL_CDLEVEL, "TControlGadget destructed @" << (void*)this);
}
Exemplo n.º 15
0
TMsgThread::IdleAction(long /*idleCount*/)
#endif
{
  TRACEX(MsgThreads, 1, "TMsgThread::IdleAction() called @" << (void*)this <<
                        " idleCount " << idleCount);
  return false;
}
Exemplo n.º 16
0
//
/// Overrides TWindow's SetupWindow function. If the button is the default push
/// button and an owner-drawn button, SetupWindow sends a DM_SETDEFID message to the
/// parent window.
//
/// \note this only works (and IsDefPB should only be true) if Parent is a dialog
//
void
TButton::SetupWindow()
{
  TRACEX(OwlControl, 1, "TButton::SetupWindow() @" << (void*)this);
  if (IsDefPB && ((Attr.Style & BS_OWNERDRAW) == BS_OWNERDRAW))
    Parent->HandleMessage(DM_SETDEFID, Attr.Id);
}
Exemplo n.º 17
0
//
/// Creates a bitmap object from the given metaFile using the given palette and size
/// arguments.
//
TBitmap::TBitmap(const TMetaFilePict& metaFile, TPalette& palette, const TSize& defSize)
{
  // Adjust size to final metafile size as needed
  //
  TMemoryDC memDC;
  TSize size = metaFile.CalcPlaySize(memDC, defSize);

  // Create bitmap, either mono or screen compatible
  //
  uint16  nColors;
  palette.GetObject(nColors);
  if (nColors > 2) {
    TScreenDC dc;
    Handle = ::CreateCompatibleBitmap(dc, size.cx, size.cy);
  }
  else
    Handle = ::CreateBitmap(size.cx, size.cy, 1, 1, 0);

  CheckValid();
  RefAdd(Handle, Bitmap);

  // clear bitmap, then play metafile onto it
  //
  memDC.SelectObject(*this);

  memDC.SelectStockObject(WHITE_BRUSH);
  memDC.PatBlt(0, 0, size.cx, size.cy);
  memDC.SelectObject(palette, false);

  metaFile.PlayOnto(memDC, size);

  TRACEX(OwlGDI, OWL_CDLEVEL, "TBitmap constructed @" << (void*)this <<
         " from metafile @" << (void*)&metaFile << ".");
}
Exemplo n.º 18
0
uint
TColumnHeader::Transfer(void* /*buffer*/, TTransferDirection /*direction*/)
{
  TRACEX(OwlCommCtrl, OWL_CDLEVEL, "TColumnHeader::Transfer is not"\
                                   "implemented!");
  return 0;
}
Exemplo n.º 19
0
TOWLEXTDll::TOWLEXTDll(HINSTANCE instance)
:
TModule(OwlExtName, instance),
GetOWLEXTVersion(*this, "GetOWLEXTVersion")
{
  TRACEX(OwlExtModule, 1, "TOWLEXTDll internal constructor invoked");
}
Exemplo n.º 20
0
//
/// Destruct the CelArray and clean up its resources
//
/// If ShouldDelete is true (the default value), the bitmap is deleted. If
/// ShouldDelete is false, no action is taken.
//
TCelArray::~TCelArray()
{
  if (ShouldDelete)
    delete Bitmap;

  TRACEX(OwlGadget, OWL_CDLEVEL, "TCelArray destructed @" << (void*)this);
}
Exemplo n.º 21
0
int
TDocManager::GetNewTemplates(TDocTemplate** tplList, int size, bool newDoc)
#endif
{
  // Check for no registered templates
  //
  if (!TemplateList) {
    TRACEX(OwlDocView, 0, _T("GetNewTemplates(): No registered templates!"));
    return 0;
  }

  // Walk thru all of the templates looking for visible ones, and if a new
  // doc, non-dtReadOnly and non-dtForbidNew ones.
  //
  int tplCount = 0;
  for (TDocTemplate* tpl = TemplateList; tpl; tpl = tpl->GetNextTemplate()) {
    if (tpl->IsVisible() &&
        !((tpl->IsFlagSet(dtReadOnly) || tpl->IsFlagSet(dtForbidNew))
           && newDoc)){
      if (tplList) {
        CHECK(tplCount < size);
        tplList[tplCount] = tpl;
      }
      tplCount++;
    }
  }
  return tplCount;
}
Exemplo n.º 22
0
//
/// Sets the document path for Open and Save operations.
//
bool
TDocument::SetDocPath(LPCTSTR path)
{
  // Path has been set already
  //
  if (path && (path == DocPath)) {
    TRACEX(OwlDocView, 0, _T("SetDocPath(): path [") << tstring(path).c_str() << _T("] ")\
                          _T("already set!"));
    return true;
  }

  delete[] DocPath;
  DocPath = (path && *path) ? strnewdup(path) : 0;

  tchar title[_MAX_PATH] = _T("Unknown");  // Never used - but just in case!
  if (!DocPath || TCommDlg::GetFileTitle(DocPath, title, COUNTOF(title)) != 0) {
    CHECK(DocManager);
    CHECK(DocManager->GetApplication());

    int len = DocManager->GetApplication()->LoadString(IDS_UNTITLED,
                                                       title, COUNTOF(title));
    if (DocManager->IsFlagSet(dmMDI))
      wsprintf(title+len, _T("%d"), ++(DocManager->GetUntitledIndex()));
  }
  SetTitle(title);
  return true;  // derived classes may validate path
}
Exemplo n.º 23
0
//
/// Creates a copy of the given cursor object.  The 32bit version (for compiling a
/// Win32 application) uses CopyIcon() and does a cast to get to HICON.
//
TCursor::TCursor(HINSTANCE, const TCursor& cursor)
{
  Handle = (HCURSOR)::CopyIcon((HICON)(HCURSOR)cursor);
  CheckValid();
  TRACEX(OwlGDI, OWL_CDLEVEL, "TCursor @" << (void*)this <<
    " copied from TCursor " << (void*)&cursor);
}
Exemplo n.º 24
0
//
/// Creates a TCursor object and sets the Handle data member to the given borrowed
/// handle. The ShouldDelete data member defaults to false, ensuring that the
/// borrowed handle will not be deleted when the C++ object is destroyed.
//
TCursor::TCursor(HCURSOR handle, TAutoDelete autoDelete)
:
  TGdiBase(handle, autoDelete)
{
  TRACEX(OwlGDI, OWL_CDLEVEL, "TCursor constructed @" << (void*)this <<
    " from handle " << static_cast<void*>(handle));
}
Exemplo n.º 25
0
//
/// Creates a TBitmap object with values from the given Clipboard.
//
TBitmap::TBitmap(const TClipboard& clipboard)
:
  TGdiObject(clipboard.GetClipboardData(CF_BITMAP))
{
  RefAdd(Handle, Bitmap);
  RefInc(Handle);
  TRACEX(OwlGDI, OWL_CDLEVEL, "TBitmap constructed @" << (void*)this << " from clipboard.");
}
Exemplo n.º 26
0
//
/// Handles initialization for each executing instance of the message thread.
/// Derived classes can override this to perform initialization for each instance.
//
void
TMsgThread::InitInstance()
{
  TRACEX(MsgThreads, 1, "TMsgThread::InitInstance() called @" << (void*)this);

  // Override to perform initialization prior to running
  // Call TMsgThread::InitInstance() before body
}
Exemplo n.º 27
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);
}
Exemplo n.º 28
0
//
/// Creates a TCursor object from the specified ICONINFO structure information.
//
TCursor::TCursor(const ICONINFO& iconInfo)
{
  WARN(iconInfo.fIcon, "TCursor constructor called with ICONINFO::fIcon == true"); // Turn this into a precondition?
  ICONINFO i = iconInfo; // Make a clone, since CreateIconIndirect is not const-correct.
  Handle = CreateIconIndirect(&i);
  CheckValid();
  TRACEX(OwlGDI, OWL_CDLEVEL, "TCursor constructed indirectly @" << static_cast<void*>(this));
}
Exemplo n.º 29
0
//
/// Constructs a TCursor object from the specified resource.
//
TCursor::TCursor(const void* resBits, uint32 resSize)
{
  PRECONDITION(resBits && resSize);
  Handle = ::CreateIconFromResource((PBYTE)resBits, resSize, false, 0x00030000);
  CheckValid();
  TRACEX(OwlGDI, OWL_CDLEVEL, "TCursor @" << (void*)this <<
    " created from bits (32)");
}
Exemplo n.º 30
0
//
/// Creates a TCursor object from the specified ICONINFO structure information.
/// This overload is deprecated. Use the overload that takes a reference instead.
//
TCursor::TCursor(const ICONINFO* iconInfo)
{
  PRECONDITION(iconInfo);
  //iconInfo->fIcon = false;
  Handle = ::CreateIconIndirect((PICONINFO)iconInfo);
  CheckValid();
  TRACEX(OwlGDI, OWL_CDLEVEL, "TCursor constructed indirectly @" << (void*)this);
}