Esempio n. 1
0
void TTreeView::SetSelect(uint32 sel)
{
	TableEntryRecord *t;
	TableEntryRecord *s;
	
	t = (TableEntryRecord *)sel;
	if (fSelect != t) {
		if (fDrawFlag == false) {
			fSelect = t;
			Update();
		} else {
			XGDraw draw(this);
			draw.SetFont(XGFont::LoadFont(1));
			
			/*
			 *	We're drawing; change selection now.
			 */
			
			s = fSelect;
			fSelect = t;
			RedrawItem(draw,s);
			RedrawItem(draw,t);
		}
	}
}
bool CTestListCtrl::OnItemButtonClicked( CRhinoUiOptionsListCtrlCheckBox& item )
{
  CRhinoUiOptionsListCtrl::OnItemButtonClicked( item );

  CTestOptionsListCtrlDialog* pDlg = static_cast<CTestOptionsListCtrlDialog*>( GetParent());
  if( item.ItemID() == m_VerticalCheckBox.ItemID())
  {
    //pDlg->GetTabCtrl()->SetExpandableTabFlag( CRhinoUiExpandableTabCtrl::etf_vertical_tabs, BST_CHECKED != m_VerticalCheckBox.GetCheck());
  }
  else if( item.ItemID() == m_HideTabCheckBox.ItemID())
  {
    bool bHide = BST_UNCHECKED == m_HideTabCheckBox.GetCheck();
    //CRhinoUiExpandableTabCtrl* pTabCtrl = pDlg->GetTabCtrl();
    //if( pTabCtrl)
    //{
    //  pTabCtrl->HideTab( 1, bHide);
    //}
  }
  else if( item.ItemID() == m_HasIsoCurves.ItemID())
  {
    bool bEnable = BST_UNCHECKED != m_HasIsoCurves.GetCheck();
    m_ShowIsoCurves.SetIsEnabled( bEnable);
    m_IsoCurveDinsity.SetIsEnabled( bEnable);
    RedrawItem( ItemIndex( m_ShowIsoCurves));
    RedrawItem( m_IsoCurveDinsity);
  }
  return true;
}
Esempio n. 3
0
void SListBoxEx::NotifySelChange( int nOldSel,int nNewSel)
{
    EventLBSelChanging evt1(this);
    
    evt1.nOldSel=nOldSel;
    evt1.nNewSel=nNewSel;
    FireEvent(evt1);
    
    if(evt1.bCancel) return ;

    m_iSelItem=nNewSel;
    if(nOldSel!=-1)
    {
        m_arrItems[nOldSel]->ModifyItemState(0,WndState_Check);
        RedrawItem(nOldSel);
    }
    if(m_iSelItem!=-1)
    {
        m_arrItems[m_iSelItem]->ModifyItemState(WndState_Check,0);
        RedrawItem(m_iSelItem);
    }
    
    EventLBSelChanged evt2(this);
    evt2.nOldSel=nOldSel;
    evt2.nNewSel=nNewSel;
    FireEvent(evt2);
}
Esempio n. 4
0
void CDuiListBox::NotifySelChange( int nOldSel,int nNewSel ,UINT uMsg)
{
    DUINMLBSELCHANGE nms;
	nms.hdr.code=DUINM_LBSELCHANGING;
    nms.hdr.hDuiWnd=m_hDuiWnd;
    nms.hdr.idFrom=GetCmdID();
	nms.hdr.pszNameFrom=GetName();
    nms.nOldSel=nOldSel;
    nms.nNewSel=nNewSel;
    nms.uMsg=uMsg;
    nms.uHoverID=0;

    if(S_OK!=DuiNotify((LPDUINMHDR)&nms)) return ;

    m_iSelItem=nNewSel;
    if(nOldSel!=-1)
        RedrawItem(nOldSel);

    if(m_iSelItem!=-1)
        RedrawItem(m_iSelItem);

    nms.hdr.idFrom=GetCmdID();
    nms.hdr.code=DUINM_LBSELCHANGED;
    DuiNotify((LPDUINMHDR)&nms);
}
Esempio n. 5
0
void CDuiListBox::OnMouseMove(UINT nFlags,CPoint pt)
{
	int nOldHover=m_iHoverItem;
    m_iHoverItem = HitTest(pt);
	
    if(m_bHotTrack && nOldHover!=m_iHoverItem)
	{
		if(nOldHover!=-1) RedrawItem(nOldHover);
		if(m_iHoverItem!=-1) RedrawItem(m_iHoverItem);
	}
}
Esempio n. 6
0
void TTreeView::SetSelected( uint32 item, bool select )
{
	if (!item) return;
	TableEntryRecord *entry = (TableEntryRecord *)item;
	if (entry->fSelected == select) return;
	entry->fSelected = select;
	if (select) {
		entry->nextSelected = fSelection;
		if (fSelection) {
			fSelection->prevSelected = entry;
		}
		entry->prevSelected = 0;
		fSelection = entry;
		++fSelectedCount;
	} else {
		if (entry->nextSelected) {
			entry->nextSelected->prevSelected = entry->prevSelected;
		}
		if (entry->prevSelected) {
			entry->prevSelected->nextSelected = entry->nextSelected;
		} else {
			fSelection = entry->nextSelected;
		}
		--fSelectedCount;
	}
	
	if (fDrawFlag) {
		XGDraw draw(this);
		draw.SetFont(XGFont::LoadFont(1));
		RedrawItem( draw, entry );
	} else {
		fUpdateFlag = true;
	}
}
Esempio n. 7
0
LRESULT SListBoxEx::OnMouseEvent( UINT uMsg,WPARAM wParam,LPARAM lParam )
{
    LRESULT lRet=0;
    CPoint pt(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));

    if(uMsg==WM_LBUTTONUP && m_iHoverItem!=m_iSelItem)
        NotifySelChange(m_iSelItem,m_iHoverItem);

    if(m_pCapturedFrame)
    {
        CRect rcItem=m_pCapturedFrame->GetItemRect();
        pt.Offset(-rcItem.TopLeft());
        lRet = m_pCapturedFrame->DoFrameEvent(uMsg,wParam,MAKELPARAM(pt.x,pt.y));
    }
    else
    {
        if(m_bFocusable && (uMsg==WM_LBUTTONDOWN || uMsg== WM_RBUTTONDOWN || uMsg==WM_LBUTTONDBLCLK))
            SetFocus();

        int iHover=HitTest(pt);
        if(iHover!=m_iHoverItem)
        {
            int nOldHover=m_iHoverItem;
            m_iHoverItem=iHover;
            if(nOldHover!=-1)
            {
                RedrawItem(nOldHover);
                m_arrItems[nOldHover]->DoFrameEvent(WM_MOUSELEAVE,0,0);
            }
            if(m_iHoverItem!=-1)
            {
                RedrawItem(m_iHoverItem);
                m_arrItems[m_iHoverItem]->DoFrameEvent(WM_MOUSEHOVER,wParam,MAKELPARAM(pt.x,pt.y));
            }
        }
        if(uMsg==WM_LBUTTONDOWN && m_iSelItem!=-1 && m_iSelItem != m_iHoverItem )
        {//选择一个新行的时候原有行失去焦点
            m_arrItems[m_iSelItem]->GetFocusManager()->SetFocusedHwnd(0);
        }
        if(m_iHoverItem!=-1)
        {
            m_arrItems[m_iHoverItem]->DoFrameEvent(uMsg,wParam,MAKELPARAM(pt.x,pt.y));
        }
    }
    return 0;
}
Esempio n. 8
0
/* Note that tab, return, linefeed, ^n, all do the same thing
   except when it comes to matching a command button hotkey.

   Return 1 to redraw, 0 for no redraw */
static int process_tabtypes(unsigned char * buf) {
  Item *item, *old_item;
  /* Note: the input field ring used with ^P above
	     could probably make this a lot simpler. dje 12/20/98 */
	  /* Code tracks cursor. */
  item = root_item_ptr;         /* init item ptr */
  if (CF.cur_input != 0) {          /* if in text */
    item = CF.cur_input->header.next; /* move to next item */
  }
  for ( ; item != 0;
	item = item->header.next) {/* find next input item */
    if (item->type == I_INPUT) {
      old_item = CF.cur_input;
      CF.cur_input = item;
      RedrawItem(old_item, 1, NULL);
      CF.rel_cursor = CF.abs_cursor = 0; /* home cursor in new input field */
      return (1);                       /* cause redraw */
    }
  }
  /* end of all text input fields, check for buttons */
  for (item = root_item_ptr; item != 0;
       item = item->header.next) {/* all items */
    myfprintf((stderr, "Button: keypress==%d vs buf %d\n",
	       item->button.keypress, buf[0]));
    if (item->type == I_BUTTON && item->button.keypress == buf[0]) {
      RedrawItem(item, 1, NULL);
      usleep(MICRO_S_FOR_10MS);
      RedrawItem(item, 0, NULL);
      DoCommand(item);
      return (0);                       /* cause no_redraw */
    }
  }
  /* goto the first text input field */
  for (item = root_item_ptr; item != 0;
       item = item->header.next) {/* all items */
    if (item->type == I_INPUT) {
      old_item = CF.cur_input;
      CF.cur_input = item;
      RedrawItem(old_item, 1, NULL);
      CF.abs_cursor = CF.rel_cursor - item->input.left;
      return (1);                       /* goto redraw */
    }
  }
  return (-1);
}
Esempio n. 9
0
void AutoStartPage::EnableTAP( unsigned int index, bool enable )
{
	if ( index < m_taps.size() && m_taps[index].id != __tap_ud__ )
	{
		m_dirty = true;
		m_taps[index].enabled = enable;
		RedrawItem(index);
	}
}
Esempio n. 10
0
BOOL CDuiListBox::SetCurSel(int nIndex)
{
    if(m_iSelItem == nIndex) return 0;

    if(nIndex < 0 && nIndex >= GetCount())
        return FALSE;

    int nOldSelItem = m_iSelItem;
    m_iSelItem = nIndex;

    if(IsVisible(TRUE))
    {
        if(nOldSelItem != -1)
            RedrawItem(nOldSelItem);

        RedrawItem(nIndex);
    }
    return TRUE;
}
Esempio n. 11
0
void CXTPShortcutListBox::RedrawItem(CPoint point)
{
    BOOL bOutSide;
    int nIndex = ItemFromPoint(point, bOutSide);

    if (!bOutSide)
    {
        RedrawItem(nIndex);
    }
}
Esempio n. 12
0
void SListBox::OnMouseLeave()
{
	__super::OnMouseLeave();
	if(m_iHoverItem!=-1)
	{
		int nOldHover=m_iHoverItem;
		m_iHoverItem=-1;
		RedrawItem(nOldHover);
	}
}
Esempio n. 13
0
BOOL SListBoxEx::SetCurSel(int iItem)
{
    if(iItem>=GetItemCount()) return FALSE;
    if(iItem < 0 ) iItem =-1;
    
    if(m_iSelItem==iItem) return FALSE;
    int nOldSel=m_iSelItem;
    m_iSelItem=iItem;
    if(nOldSel!=-1)
    {
        m_arrItems[nOldSel]->ModifyItemState(0,WndState_Check);
        if(IsVisible(TRUE)) RedrawItem(nOldSel);
    }
    if(m_iSelItem!=-1)
    {
        m_arrItems[m_iSelItem]->ModifyItemState(WndState_Check,0);
        if(IsVisible(TRUE)) RedrawItem(m_iSelItem);
    }
    return TRUE;
}
Esempio n. 14
0
bool CInformationPanel::UpdateItem(int Item)
{
	CItem *pItem=GetItem(Item);

	if (pItem==NULL || !pItem->Update())
		return false;

	if (m_hwnd!=NULL && pItem->IsVisible())
		RedrawItem(Item);

	return true;
}
Esempio n. 15
0
	void CDuiHeaderCtrl::OnMouseLeave()
	{
		if(!m_bDragging)
		{
			if(IsItemHover(m_dwHitTest) && m_bSortHeader)
			{
				m_arrItems[LOWORD(m_dwHitTest)].state=0;
				RedrawItem(LOWORD(m_dwHitTest));
			}
			m_dwHitTest=-1;
		}
	}
Esempio n. 16
0
void TTreeView::DoActivate(bool flag)
{
	EnableDrawing();
	
	XGDraw draw(this);
	draw.SetFont(XGFont::LoadFont(1));
	for (uint32 item = GetFirstSelected(); item; item = GetNextSelected( item )) {
		RedrawItem(draw,(TableEntryRecord *)item);
	}

	XGView::DoActivate(flag);
}
Esempio n. 17
0
void SListBox::NotifySelChange( int nOldSel,int nNewSel)
{
    EventLBSelChanging evt1(this);
    evt1.nOldSel=nOldSel;
    evt1.nNewSel=nNewSel;

    FireEvent(evt1);
    if(evt1.bCancel) return;
       
    m_iSelItem=nNewSel;
    if(nOldSel!=-1)
        RedrawItem(nOldSel);

    if(m_iSelItem!=-1)
        RedrawItem(m_iSelItem);
    
    EventLBSelChanged evt2(this);
    evt2.nOldSel=nOldSel;
    evt2.nNewSel=nNewSel;
    FireEvent(evt2);
}
Esempio n. 18
0
static void ToggleChoice (Item *item)
{
  int i;
  Item *sel = item->choice.sel;

  if (sel->selection.key == IS_SINGLE) {
    if (!item->choice.on) {
      for (i = 0; i < sel->selection.n; i++) {
	if (sel->selection.choices[i]->choice.on) {
	  sel->selection.choices[i]->choice.on = 0;
	  RedrawItem(sel->selection.choices[i], 0, NULL);
	}
      }
      item->choice.on = 1;
      RedrawItem(item, 0, NULL);
    }
  } else {  /* IS_MULTIPLE */
    item->choice.on = !item->choice.on;
    RedrawItem(item, 0, NULL);
  }
}
Esempio n. 19
0
void CXTPShortcutListBox::OnMouseMove(UINT /*nFlags*/, CPoint point)
{
    BOOL bOutSide;
    int nIndex = ItemFromPoint (point, bOutSide);

    CRect rcItem;
    GetItemRect(nIndex, &rcItem);

    if ((m_nPrevIndex != -1) && (m_nPrevIndex != nIndex))
    {
        RedrawItem(m_nPrevIndex);
    }

    if (bOutSide || !rcItem.PtInRect(point))
    {
        RedrawItem(nIndex);
        nIndex = -1;
    }

    if (nIndex != GetCurSel())
    {
        SetCurSel(nIndex);

        if (nIndex != -1)
        {
            RedrawItem(nIndex);

            TRACKMOUSEEVENT tme =
            {
                sizeof(TRACKMOUSEEVENT), TME_LEAVE, m_hWnd, 0
            };
            _TrackMouseEvent(&tme);
        }
    }

    m_nPrevIndex = nIndex;
}
Esempio n. 20
0
void CXTPShortcutListBox::OnLButtonUp(UINT nFlags, CPoint point)
{
    CListBox::OnLButtonUp(nFlags, point);
    RedrawItem(point);

    CONTENT_ITEM* pCI = GetMenuItem(GetCurSel());
    if (pCI && !pCI->m_bEnabled)
        return;

    CWnd* pWndOwner = GetOwner();
    ASSERT(pWndOwner);

    if (pWndOwner) pWndOwner->SendMessage(WM_XTP_SHORTCUTLBOX_NOTIFY,
                                              (LPARAM)GetCurSel(), (WPARAM)GetDlgCtrlID());
}
Esempio n. 21
0
	void CDuiHeaderCtrl::OnLButtonDown( UINT nFlags,CPoint pt )
	{
		SetDuiCapture();
		m_ptClick=pt;
		m_dwHitTest=HitTest(pt);
		if(IsItemHover(m_dwHitTest))
		{
			if(m_bSortHeader)
			{
				m_arrItems[LOWORD(m_dwHitTest)].state=2;//pushdown
				RedrawItem(LOWORD(m_dwHitTest));
			}
		}else if(m_dwHitTest!=-1)
		{
			m_nAdjItemOldWidth=m_arrItems[LOWORD(m_dwHitTest)].cx;
		}
	}
Esempio n. 22
0
bool CInformationPanel::ResetItem(int Item)
{
	CItem *pItem=GetItem(Item);

	if (pItem==NULL)
		return false;

	pItem->Reset();

	if (Item==ITEM_PROGRAMINFO) {
		m_ProgramInfoLinkList.clear();
		m_fProgramInfoCursorOverLink=false;
		if (m_hwnd!=NULL)
			::SetWindowText(m_hwndProgramInfo,TEXT(""));
	}

	if (m_hwnd!=NULL && pItem->IsVisible())
		RedrawItem(Item);

	return true;
}
Esempio n. 23
0
void SListBox::OnKeyDown( TCHAR nChar, UINT nRepCnt, UINT nFlags )
{
    int  nNewSelItem = -1;
    int iCurSel=m_iSelItem;
    if(m_bHotTrack && m_iHoverItem!=-1)
        iCurSel=m_iHoverItem;
    if (nChar == VK_DOWN && m_iSelItem < GetCount() - 1)
        nNewSelItem = iCurSel+1;
    else if (nChar == VK_UP && m_iSelItem > 0)
        nNewSelItem = iCurSel-1;

    if(nNewSelItem!=-1)
    {
        int iHover=m_iHoverItem;
        if(m_bHotTrack)
            m_iHoverItem=-1;
        EnsureVisible(nNewSelItem);
        NotifySelChange(m_iSelItem,nNewSelItem);
        if(iHover!=-1 && iHover != m_iSelItem && iHover != nNewSelItem) 
            RedrawItem(iHover);
    }
}
Esempio n. 24
0
	void CDuiHeaderCtrl::OnLButtonUp( UINT nFlags,CPoint pt )
	{
		if(IsItemHover(m_dwHitTest))
		{
			if(m_bDragging)
			{//拖动表头项
				if(m_bItemSwapEnable)
				{
					CDragWnd::EndDrag();
					DeleteObject(m_hDragImg);
					m_hDragImg=NULL;

					if(m_dwDragTo!=m_dwHitTest && IsItemHover(m_dwDragTo))
					{
						DUIHDITEM t=m_arrItems[LOWORD(m_dwHitTest)];
						m_arrItems.RemoveAt(LOWORD(m_dwHitTest));
						int nPos=LOWORD(m_dwDragTo);
						if(nPos>LOWORD(m_dwHitTest)) nPos--;//要考虑将自己移除的影响
						m_arrItems.InsertAt(LOWORD(m_dwDragTo),t);
						//发消息通知宿主表项位置发生变化
						DUINMHDSWAP	nm;
						nm.hdr.hDuiWnd=m_hDuiWnd;
						nm.hdr.code=DUINM_HDSWAP;
						nm.hdr.idFrom=GetCmdID();
						nm.hdr.pszNameFrom=GetName();
						nm.iOldIndex=LOWORD(m_dwHitTest);
						nm.iNewIndex=nPos;
						DuiNotify((LPDUINMHDR)&nm);
					}
					m_dwHitTest=HitTest(pt);
					m_dwDragTo=-1;
					NotifyInvalidate();
				}
			}else
			{//点击表头项
				if(m_bSortHeader)
				{
					m_arrItems[LOWORD(m_dwHitTest)].state=1;//hover
					RedrawItem(LOWORD(m_dwHitTest));
					DUINMHDCLICK	nm;
					nm.hdr.hDuiWnd=m_hDuiWnd;
					nm.hdr.code=DUINM_HDCLICK;
					nm.hdr.idFrom=GetCmdID();
					nm.hdr.pszNameFrom=GetName();
					nm.iItem=LOWORD(m_dwHitTest);
					DuiNotify((LPDUINMHDR)&nm);
				}
			}
		}else if(m_dwHitTest!=-1)
		{//调整表头宽度,发送一个调整完成消息
			DUINMHDSIZECHANGED	nm;
			nm.hdr.hDuiWnd=m_hDuiWnd;
			nm.hdr.code=DUINM_HDSIZECHANGED;
			nm.hdr.idFrom=GetCmdID();
			nm.hdr.pszNameFrom=GetName();
			nm.iItem=LOWORD(m_dwHitTest);
			nm.nWidth=m_arrItems[nm.iItem].cx;
			DuiNotify((LPDUINMHDR)&nm);
		}
		m_bDragging=FALSE;
		ReleaseDuiCapture();
	}
Esempio n. 25
0
void CXTPShortcutListBox::OnLButtonDown(UINT nFlags, CPoint point)
{
    CListBox::OnLButtonDown(nFlags, point);
    RedrawItem(point);
}
Esempio n. 26
0
void SListBoxEx::OnKillFocus()
{
    __super::OnKillFocus();
    if(m_iSelItem!=-1) m_arrItems[m_iSelItem]->DoFrameEvent(WM_KILLFOCUS,0,0);
    if(m_iSelItem!=-1) RedrawItem(m_iSelItem);
}
Esempio n. 27
0
	void CDuiHeaderCtrl::OnMouseMove( UINT nFlags,CPoint pt )
	{
		if(m_bDragging || nFlags&MK_LBUTTON)
		{
			if(!m_bDragging)
			{
				m_bDragging=TRUE;
				if(IsItemHover(m_dwHitTest) && m_bItemSwapEnable)
				{
					m_dwDragTo=m_dwHitTest;
					CRect rcItem=GetItemRect(LOWORD(m_dwHitTest));
					DrawDraggingState(m_dwDragTo);
					m_hDragImg=CreateDragImage(LOWORD(m_dwHitTest));
					CPoint pt=m_ptClick-rcItem.TopLeft();
					CDragWnd::BeginDrag(m_hDragImg,pt,0,128,LWA_ALPHA|LWA_COLORKEY);
				}
			}
			if(IsItemHover(m_dwHitTest))
			{
				if(m_bItemSwapEnable)
				{
					DWORD dwDragTo=HitTest(pt);
					CPoint pt2(pt.x,m_ptClick.y);
					ClientToScreen(GetContainer()->GetHostHwnd(),&pt2);
					if(IsItemHover(dwDragTo) && m_dwDragTo!=dwDragTo)
					{
						m_dwDragTo=dwDragTo;
						DUITRACE(_T("\n!!! dragto %d"),LOWORD(dwDragTo));
						DrawDraggingState(dwDragTo);
					}
					CDragWnd::DragMove(pt2);
				}
			}else if(m_dwHitTest!=-1)
			{//调节宽度
				int cxNew=m_nAdjItemOldWidth+pt.x-m_ptClick.x;
				if(cxNew<0) cxNew=0;
				m_arrItems[LOWORD(m_dwHitTest)].cx=cxNew;
				NotifyInvalidate();
				GetContainer()->DuiUpdateWindow();//立即更新窗口
				//发出调节宽度消息
				DUINMHDSIZECHANGING	nm;
				nm.hdr.hDuiWnd=m_hDuiWnd;
				nm.hdr.code=DUINM_HDSIZECHANGING;
				nm.hdr.idFrom=GetCmdID();
				nm.hdr.pszNameFrom=GetName();
				nm.nWidth=cxNew;
				DuiNotify((LPDUINMHDR)&nm);
			}
		}else
		{
			DWORD dwHitTest=HitTest(pt);
			if(dwHitTest!=m_dwHitTest)
			{
				if(m_bSortHeader)
				{
					if(IsItemHover(m_dwHitTest))
					{
						WORD iHover=LOWORD(m_dwHitTest);
						m_arrItems[iHover].state=0;
						RedrawItem(iHover);
					}
					if(IsItemHover(dwHitTest))
					{
						WORD iHover=LOWORD(dwHitTest);
						m_arrItems[iHover].state=1;//hover
						RedrawItem(iHover);
					}
				}
				m_dwHitTest=dwHitTest;
			}
		}
		
	}
Esempio n. 28
0
/* read an X event */
void ReadXServer (void)
{
  static XEvent event;
  int old_cursor = 0, keypress;
  Item *item, *old_item;
  KeySym ks;
  char *sp, *dp;
  static unsigned char buf[10];         /* unsigned for international */
  static int n;

  while (FEventsQueued(dpy, QueuedAfterReading)) {
    FNextEvent(dpy, &event);
    if (event.xany.window == CF.frame) {
      switch (event.type) {
      case ClientMessage:
      {
	      if(event.xclient.format == 32 &&
		 event.xclient.data.l[0] == wm_del_win)
	      {
		      exit(0);
	      }
      }
      break;
      case ConfigureNotify:             /* has window be reconfigured */
      {
	      XEvent tmpe;

	      while (FCheckTypedWindowEvent(
		      dpy, CF.frame, ConfigureNotify, &tmpe))
	      {
		      if (!tmpe.xconfigure.send_event)
			      continue;
		      event.xconfigure.x = tmpe.xconfigure.x;
		      event.xconfigure.y = tmpe.xconfigure.y;
		      event.xconfigure.send_event = True;
	      }
	      if (CF.max_width != event.xconfigure.width ||
		  CF.total_height != event.xconfigure.height)
	      {
		      /* adjust yourself... do noting */
		      ResizeFrame();
		      CF.max_width = event.xconfigure.width;
		      CF.total_height = event.xconfigure.height;
		      UpdateRootTransapency(False, True);
		      if (!CSET_IS_TRANSPARENT(colorset))
		      {
			  RedrawFrame(NULL);
		      }
	      }
	      else if (event.xconfigure.send_event)
	      {
		      UpdateRootTransapency(False, True);
	      }
      }
      break;
#if 0
      case SelectionClear:
	 selection_clear ();
	break;
      case SelectionNotify:
	selection_paste ();
	break;
      case SelectionRequest:
	 selection_send ();
	break;
#endif
      case Expose:
      {
	      int ex = event.xexpose.x;
	      int ey = event.xexpose.y;
	      int ex2 = event.xexpose.x + event.xexpose.width;
	      int ey2 = event.xexpose.y + event.xexpose.height;
	      while (FCheckTypedWindowEvent(dpy, CF.frame, Expose, &event))
	      {
		      ex = min(ex, event.xexpose.x);
		      ey = min(ey, event.xexpose.y);
		      ex2 = max(ex2, event.xexpose.x + event.xexpose.width);
		      ey2 = max(ey2 , event.xexpose.y + event.xexpose.height);
	      }
	      event.xexpose.x = ex;
	      event.xexpose.y = ey;
	      event.xexpose.width = ex2 - ex;
	      event.xexpose.height = ey2 - ey;
	      RedrawFrame(&event);
	      if (CF.grab_server && !CF.server_grabbed)
	      {
		      if (GrabSuccess ==
			  XGrabPointer(dpy, CF.frame, True, 0,
				       GrabModeAsync, GrabModeAsync,
				       None, None, CurrentTime))
			      CF.server_grabbed = 1;
	      }
      }
      break;
      case VisibilityNotify:
	if (CF.server_grabbed &&
	    event.xvisibility.state != VisibilityUnobscured)
	{
	  /* raise our window to the top */
	  XRaiseWindow(dpy, CF.frame);
	  XSync(dpy, 0);
	}
	break;
      case KeyPress:  /* we do text input here */
	n = XLookupString(&event.xkey, (char *)buf, sizeof(buf), &ks, NULL);
	keypress = buf[0];
	myfprintf((stderr, "Keypress [%s]\n", buf));
	if (n == 0) {  /* not a regular key, translate it into one */
	  switch (ks) {
	  case XK_Home:
	  case XK_Begin:
	    buf[0] = '\001';  /* ^A */
	    break;
	  case XK_End:
	    buf[0] = '\005';  /* ^E */
	    break;
	  case XK_Left:
	    buf[0] = '\002';  /* ^B */
	    break;
	  case XK_Right:
	    buf[0] = '\006';  /* ^F */
	    break;
	  case XK_Up:
	    buf[0] = '\020';            /* ^P */
	    break;
	  case XK_Down:
	    buf[0] = '\016';  /* ^N */
	    break;
	  default:
	    if (ks >= XK_F1 && ks <= XK_F35) {
	      buf[0] = '\0';
	      keypress = 257 + ks - XK_F1;
	    } else
	      goto no_redraw;  /* no action for this event */
	  }
	}
	switch (ks) {                   /* regular key, may need adjustment */
	case XK_Tab:
#ifdef XK_XKB_KEYS
	case XK_ISO_Left_Tab:
#endif
	  if (event.xkey.state & ShiftMask) { /* shifted key */
	    buf[0] = '\020';          /* chg shift tab to ^P */
	  }
	  break;
	case '>':
	  if (event.xkey.state & Mod1Mask) { /* Meta, shift > */
	    process_history(1);
	    goto redraw_newcursor;
	  }
	  break;
	case '<':
	  if (event.xkey.state & Mod1Mask) { /* Meta, shift < */
	    process_history(-1);
	    goto redraw_newcursor;
	  }
	  break;
	}
	if (!CF.cur_input) {  /* no text input fields */
	  for (item = root_item_ptr; item != 0;
	       item = item->header.next) {/* all items */
	    if (item->type == I_BUTTON && item->button.keypress == keypress) {
	      RedrawItem(item, 1, NULL);
	      usleep(MICRO_S_FOR_10MS);
	      RedrawItem(item, 0, NULL);
	      DoCommand(item);
	      goto no_redraw;
	    }
	  }
	  break;
	} else if (CF.cur_input == CF.cur_input->input.next_input) {
	  /* 1 ip field */
	  switch (buf[0]) {
	  case '\020':                  /* ^P previous field */
	    process_history(-1);
	    goto redraw_newcursor;
	    break;
	  case '\016':                  /* ^N  next field */
	    process_history(1);
	    goto redraw_newcursor;
	    break;
	  } /* end switch */
	} /* end one input field */
	switch (buf[0]) {
	case '\001':  /* ^A */
	  old_cursor = CF.abs_cursor;
	  CF.rel_cursor = 0;
	  CF.abs_cursor = 0;
	  CF.cur_input->input.left = 0;
	  goto redraw_newcursor;
	  break;
	case '\005':  /* ^E */
	  old_cursor = CF.abs_cursor;
	  CF.rel_cursor = CF.cur_input->input.n;
	  if ((CF.cur_input->input.left =
	       CF.rel_cursor - CF.cur_input->input.size) < 0)
	    CF.cur_input->input.left = 0;
	  CF.abs_cursor = CF.rel_cursor - CF.cur_input->input.left;
	  goto redraw_newcursor;
	  break;
	case '\002':  /* ^B */
	  old_cursor = CF.abs_cursor;
	  if (CF.rel_cursor > 0) {
	    CF.rel_cursor--;
	    CF.abs_cursor--;
	    if (CF.abs_cursor <= 0 && CF.rel_cursor > 0) {
	      CF.abs_cursor++;
	      CF.cur_input->input.left--;
	    }
	  }
	  goto redraw_newcursor;
	  break;
	case '\006':  /* ^F */
	  old_cursor = CF.abs_cursor;
	  if (CF.rel_cursor < CF.cur_input->input.n) {
	    CF.rel_cursor++;
	    CF.abs_cursor++;
	    if (CF.abs_cursor >= CF.cur_input->input.size &&
		CF.rel_cursor < CF.cur_input->input.n) {
	      CF.abs_cursor--;
	      CF.cur_input->input.left++;
	    }
	  }
	  goto redraw_newcursor;
	  break;
	case '\010':  /* ^H */
	  old_cursor = CF.abs_cursor;
	  if (CF.rel_cursor > 0) {
	    sp = CF.cur_input->input.value + CF.rel_cursor;
	    dp = sp - 1;
	    for (; *dp = *sp, *sp != '\0'; dp++, sp++);
	    CF.cur_input->input.n--;
	    CF.rel_cursor--;
	    if (CF.rel_cursor < CF.abs_cursor) {
	      CF.abs_cursor--;
	      if (CF.abs_cursor <= 0 && CF.rel_cursor > 0) {
		CF.abs_cursor++;
		CF.cur_input->input.left--;
	      }
	    } else
	      CF.cur_input->input.left--;
	  }
	  goto redraw_newcursor;
	  break;
	case '\177':  /* DEL */
	case '\004':  /* ^D */
	  if (CF.rel_cursor < CF.cur_input->input.n) {
	    sp = CF.cur_input->input.value + CF.rel_cursor + 1;
	    dp = sp - 1;
	    for (; *dp = *sp, *sp != '\0'; dp++, sp++);
	    CF.cur_input->input.n--;
	    goto redraw_newcursor;
	  }
	  break;
	case '\013':  /* ^K */
	  CF.cur_input->input.value[CF.rel_cursor] = '\0';
	  CF.cur_input->input.n = CF.rel_cursor;
	  goto redraw_newcursor;
	case '\025':  /* ^U */
	  CF.cur_input->input.value[0] = '\0';
	  CF.cur_input->input.n = CF.cur_input->input.left = 0;
	  CF.rel_cursor = CF.abs_cursor = 0;
	  goto redraw_newcursor;
	case '\020':                    /* ^P previous field */
	  old_item = CF.cur_input;
	  CF.cur_input = old_item->input.prev_input; /* new current input fld */
	  RedrawItem(old_item, 1, NULL);
	  CF.rel_cursor = CF.abs_cursor = 0; /* home cursor in new input field */
	  goto redraw;
	  break;
	case '\t':
	case '\n':
	case '\015':
	case '\016':  /* LINEFEED, TAB, RETURN, ^N, jump to the next field */
	  switch (process_tabtypes(&buf[0])) {
	    case 0: goto no_redraw;break;
	    case 1: goto redraw;break;
	  }
	  break;
	default:
	  old_cursor = CF.abs_cursor;
	  if((buf[0] >= ' ' &&
	      buf[0] < '\177') ||
	     (buf[0] >= 160)) {         /* regular or intl char */
	    process_regular_char_input(&buf[0]); /* insert into input field */
	    goto redraw_newcursor;
	  }
	  /* unrecognized key press, check for buttons */
	  for (item = root_item_ptr; item != 0; item = item->header.next)
	  {
	    /* all items */
	    myfprintf((stderr, "Button: keypress==%d\n",
		    item->button.keypress));
	    if (item->type == I_BUTTON && item->button.keypress == keypress) {
	      RedrawItem(item, 1, NULL);
	      usleep(MICRO_S_FOR_10MS);  /* .1 seconds */
	      RedrawItem(item, 0, NULL);
	      DoCommand(item);
	      goto no_redraw;
	    }
	  }
	  break;
	}
      redraw_newcursor:
	{
	  XSetForeground(dpy, CF.cur_input->header.dt_ptr->dt_item_GC,
			 CF.cur_input->header.dt_ptr->dt_colors[c_item_bg]);
	  /* Since DrawString is being used, I changed this to clear the
	     entire input field.  dje 10/24/99. */
	  XClearArea(dpy, CF.cur_input->header.win,
		     BOX_SPC + TEXT_SPC - 1, BOX_SPC,
		     CF.cur_input->header.size_x
		     - (2 * BOX_SPC) - 2 - TEXT_SPC,
		     (CF.cur_input->header.size_y - 1)
		     - 2 * BOX_SPC + 1, False);
	}
      redraw:
	{
	  int len, x, dy;
	  len = CF.cur_input->input.n - CF.cur_input->input.left;
	  XSetForeground(dpy, CF.cur_input->header.dt_ptr->dt_item_GC,
			 CF.cur_input->header.dt_ptr->dt_colors[c_item_fg]);
	  if (len > CF.cur_input->input.size)
	    len = CF.cur_input->input.size;
	  CF.cur_input->header.dt_ptr->dt_Fstr->win = CF.cur_input->header.win;
	  CF.cur_input->header.dt_ptr->dt_Fstr->gc  =
	    CF.cur_input->header.dt_ptr->dt_item_GC;
	  CF.cur_input->header.dt_ptr->dt_Fstr->flags.has_colorset = False;
	  if (itemcolorset >= 0)
	  {
	    CF.cur_input->header.dt_ptr->dt_Fstr->colorset =
		    &Colorset[itemcolorset];
	    CF.cur_input->header.dt_ptr->dt_Fstr->flags.has_colorset = True;
	  }
	  CF.cur_input->header.dt_ptr->dt_Fstr->str = CF.cur_input->input.value;
	  CF.cur_input->header.dt_ptr->dt_Fstr->x   = BOX_SPC + TEXT_SPC;
	  CF.cur_input->header.dt_ptr->dt_Fstr->y   = BOX_SPC + TEXT_SPC
	    + CF.cur_input->header.dt_ptr->dt_Ffont->ascent;
	  CF.cur_input->header.dt_ptr->dt_Fstr->len = len;
	  FlocaleDrawString(dpy,
			    CF.cur_input->header.dt_ptr->dt_Ffont,
			    CF.cur_input->header.dt_ptr->dt_Fstr,
			    FWS_HAVE_LENGTH);
	  x = BOX_SPC + TEXT_SPC +
		  FlocaleTextWidth(CF.cur_input->header.dt_ptr->dt_Ffont,
				   CF.cur_input->input.value,CF.abs_cursor)
		  - 1;
	  dy = CF.cur_input->header.size_y - 1;
	  XDrawLine(dpy, CF.cur_input->header.win,
		    CF.cur_input->header.dt_ptr->dt_item_GC,
		    x, BOX_SPC, x, dy - BOX_SPC);
	  myfprintf((stderr,"Line %d/%d - %d/%d (char)\n",
		     x, BOX_SPC, x, dy - BOX_SPC));
	}
      no_redraw:
	break;  /* end of case KeyPress */
      }  /* end of switch (event.type) */
      continue;
    }  /* end of if (event.xany.window == CF.frame) */
    for (item = root_item_ptr; item != 0;
	 item = item->header.next) {    /* all items */
      if (event.xany.window == item->header.win) {
	switch (event.type) {
	case Expose:
	{
		int ex = event.xexpose.x;
		int ey = event.xexpose.y;
		int ex2 = event.xexpose.x + event.xexpose.width;
		int ey2 = event.xexpose.y + event.xexpose.height;
		while (FCheckTypedWindowEvent(
			dpy, item->header.win, Expose, &event))
		{
			ex = min(ex, event.xexpose.x);
			ey = min(ey, event.xexpose.y);
			ex2 = max(ex2, event.xexpose.x + event.xexpose.width);
			ey2 = max(ey2 , event.xexpose.y + event.xexpose.height);
		}
		event.xexpose.x = ex;
		event.xexpose.y = ey;
		event.xexpose.width = ex2 - ex;
		event.xexpose.height = ey2 - ey;
		RedrawItem(item, 0, &event);
	}
	break;
	case ButtonPress:
	  if (item->type == I_INPUT) {
	    old_item = CF.cur_input;
	    CF.cur_input = item;
	    RedrawItem(old_item, 1, NULL);
	    {
	      Bool done = False;

	      CF.abs_cursor = 0;
	      while(CF.abs_cursor <= item->input.size && !done)
	      {
		if (FlocaleTextWidth(item->header.dt_ptr->dt_Ffont,
				     item->input.value,
				     CF.abs_cursor) >=
		    event.xbutton.x - BOX_SPC - TEXT_SPC)
		{
		  done = True;
		  CF.abs_cursor--;
		}
		else
		{
		  CF.abs_cursor++;
		}
	      }
	    }
	    if (CF.abs_cursor < 0)
	      CF.abs_cursor = 0;
	    if (CF.abs_cursor > item->input.size)
	      CF.abs_cursor = item->input.size;
	    CF.rel_cursor = CF.abs_cursor + item->input.left;
	    if (CF.rel_cursor < 0)
	      CF.rel_cursor = 0;
	    if (CF.rel_cursor > item->input.n)
	      CF.rel_cursor = item->input.n;
	    if (CF.rel_cursor > 0 && CF.rel_cursor == item->input.left)
	      item->input.left--;
	    if (CF.rel_cursor < item->input.n &&
		CF.rel_cursor == item->input.left + item->input.size)
	      item->input.left++;
	    CF.abs_cursor = CF.rel_cursor - item->input.left;
	    if (event.xbutton.button == Button2) { /* if paste request */
	      process_paste_request (&event, item);
	    }
	    RedrawItem(item, 0, NULL);
	  }
	  if (item->type == I_CHOICE)
	    ToggleChoice(item);
	  if (item->type == I_BUTTON) {
	    RedrawItem(item, 1, NULL);    /* push button in */
	    if (CF.activate_on_press) {
	      usleep(MICRO_S_FOR_10MS);   /* make sure its visible */
	      RedrawItem(item, 0, NULL);  /* pop button out */
	      DoCommand(item);            /* execute the button command */
	    } else {
	      XGrabPointer(dpy, item->header.win,
			   False,         /* owner of events */
			   ButtonReleaseMask, /* events to report */
			   GrabModeAsync, /* keyboard mode */
			   GrabModeAsync, /* pointer mode */
			   None,          /* confine to */
			   /* I sort of like this, the hand points in
			      the other direction and the color is
			      reversed. I don't know what other GUIs do,
			      Java doesn't do anything, neither does anything
			      else I can find...dje */
			   CF.pointer[button_in_pointer],   /* cursor */
			   CurrentTime);
	    } /* end activate on press */
	  }
	  break;
	case ButtonRelease:
	  if (!CF.activate_on_press) {
	    RedrawItem(item, 0, NULL);
	    if (CF.grab_server && CF.server_grabbed) {
	      /* You have to regrab the pointer, or focus
		 can go to another window.
		 grab...
	      */
	      XGrabPointer(dpy, CF.frame, True, 0, GrabModeAsync, GrabModeAsync,
			   None, None, CurrentTime);
	      XFlush(dpy);
	    } else {
	      XUngrabPointer(dpy, CurrentTime);
	      XFlush(dpy);
	    }
	    if (event.xbutton.x >= 0 &&
		event.xbutton.x < item->header.size_x &&
		event.xbutton.y >= 0 &&
		event.xbutton.y < item->header.size_y) {
	      DoCommand(item);
	    }
	  }
	  break;
	}
      }
    }  /* end of for (i = 0) */
  }  /* while loop */
}