示例#1
0
void Window::set_array(const std::string &aname, const int pane_id,
		       void *addr, int strd, int cap, bool is_const) 
  throw(COM_exception)
{
  if ( Connectivity::is_element_name( aname)) {
    Pane &pn = pane(pane_id,true);
    Connectivity *con = ((Pane_friend&)pn).connectivity( aname,true);
    
    if ( con==NULL) 
      throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			   (name()+"."+aname,Window::set_array));

    reinit_conn( con, is_const?Pane::OP_SET_CONST:Pane::OP_SET, 
		 &(int*&)addr, strd, cap);
  }
  else {
    Attribute *a = pane( pane_id,true).attribute( aname);
    if ( a==NULL) 
      throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			   (name()+"."+aname,Window::set_array));

    reinit_attr( a, is_const?Pane::OP_SET_CONST:Pane::OP_SET, 
		 &addr, strd, cap);
  }
}
示例#2
0
文件: dlg_tracker.cpp 项目: 4play/xbt
BOOL Cdlg_tracker::OnInitDialog()
{
	ETSLayoutDialog::OnInitDialog();
	CreateRoot(VERTICAL)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< item(IDC_TRACKER_STATIC, NORESIZE)
			<< item(IDC_TRACKER, ABSOLUTE_VERT)
			)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< item(IDC_USER_STATIC, NORESIZE)
			<< item(IDC_USER, ABSOLUTE_VERT)
			)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< item(IDC_PASS_STATIC, NORESIZE)
			<< item(IDC_PASS, ABSOLUTE_VERT)
			)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< itemGrowing(HORIZONTAL)
			<< item(IDOK, NORESIZE)
			<< item(IDCANCEL, NORESIZE)
			)
		;
	UpdateLayout();
	return true;
}
示例#3
0
void ComponentInterface::set_array(const std::string &aname, const int pane_id,
		       void *addr, int strd, int cap, bool is_const) 
  throw(COM_exception)
{
  if ( Connectivity::is_element_name( aname)) {
    Pane &pn = pane(pane_id,true);
    Connectivity *con = ((Pane_friend&)pn).connectivity( aname,true);
    
    if ( con==NULL) 
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			   (name()+"."+aname,ComponentInterface::set_array));

    reinit_conn( con, is_const?Pane::OP_SET_CONST:Pane::OP_SET, 
		 &(int*&)addr, strd, cap);
  }
  else {
    DataItem *a = pane( pane_id,true).dataitem( aname);
    if ( a==NULL) 
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			   (name()+"."+aname,ComponentInterface::set_array));

    reinit_dataitem( a, is_const?Pane::OP_SET_CONST:Pane::OP_SET, 
                     &addr, strd, cap);
  }
}
示例#4
0
void ComponentInterface::set_size( const std::string &aname, int pid,
		       int nitems, int ng) throw( COM_exception) 
{ 
  if ( Connectivity::is_element_name( aname)) {
    Pane_friend &pn = (Pane_friend&)pane(pid,true);
    Connectivity *con = pn.connectivity( aname,true);
    pn.set_size( con, nitems, ng);
  }
  else {
    DataItem *a = dataitem(aname);

    if ( a == NULL)
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST,append_frame
			   (_name+"."+aname,ComponentInterface::set_size));
  
    if ( a->is_windowed()) 
      ((Pane_friend&)_dummy).set_size( a, nitems, ng);
    else if ( pid==0) {
      // Loop through the panes to set the sizes.
      for (Pane_map::iterator it=_pane_map.begin(), iend=_pane_map.end();
	   it != iend; ++it) {
	((Pane_friend*)it->second)->set_size
	  ( it->second->dataitem( a->id()), nitems, ng);
      }
    }
    else 
      ((Pane_friend&)pane(pid,true)).set_size( a, nitems, ng); 
  }
}
示例#5
0
GuiMenu::GuiMenu(const GuiThemeRef& skin, const Rect2D& rect, Array<std::string>* listPtr, const Pointer<int>& indexValue) : 
    GuiWindow("", skin, rect, GuiTheme::MENU_WINDOW_STYLE, NO_CLOSE), m_eventSource(NULL), m_stringListValue(listPtr), 
    m_captionListValue(NULL), m_indexValue(indexValue), m_useStringList(true), m_superior(NULL) {

    pane()->setPosition(Vector2(0, 0));
    m_labelArray.resize(listPtr->size());
    for (int i = 0; i < listPtr->size(); ++i) {
        m_labelArray[i] = pane()->addLabel((*listPtr)[i]);
    }
    pane()->pack();
    m_highlightIndex = *m_indexValue;
}
示例#6
0
BOOL Cdlg_login::OnInitDialog() 
{
	ETSLayoutDialog::OnInitDialog();
	CreateRoot(VERTICAL)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< (pane(VERTICAL, GREEDY)
				<< item(IDC_GAME, GREEDY)
				<< item(IDC_USER, GREEDY)
				)
			<< (pane(VERTICAL, GREEDY)
				<< item(IDOK, NORESIZE)
				<< item(IDCANCEL, NORESIZE)
				)
			)
		<< item(IDC_EDIT, GREEDY)
		;
	UpdateLayout();
	xcc_dirs::load_from_registry();
	add_game("Software\\Westwood\\Emperor", game_ebfd, 0x1f);
	add_game("Software\\Westwood\\Nox", game_nox, 0x25);
	add_game("Software\\Westwood\\Tiberian Sun", game_ts, 0x12);
	add_game("Software\\Westwood\\Tiberian Sun", game_ts_fs, 0x1c);
	add_game("Software\\Westwood\\Red Alert 2", game_ra2, 0x21);
	add_game("Software\\Westwood\\Renegade", game_rg, 0xc);
	add_game("Software\\Westwood\\Yuri's Revenge", game_ra2_yr, 0x29);
	for (int i = 1; i < 26; i++)
	{
		t_nick e;
		Creg_key key;
		if (ERROR_SUCCESS == key.open(HKEY_CLASSES_ROOT, string("Wchat\\Nick" + n(i) + "\\Nick"), KEY_READ)
			&& ERROR_SUCCESS == key.query_value("", e.name)
			&& ERROR_SUCCESS == key.open(HKEY_CLASSES_ROOT, string("Wchat\\Nick" + n(i) + "\\Pass"), KEY_READ)
			&& ERROR_SUCCESS == key.query_value("", e.password)
			&& !e.name.empty() 
			&& e.password.length() == 8)
		{
			m_user.SetItemData(m_user.AddString(e.name.c_str()), m_nicks.size());
			m_nicks.push_back(e);
		}
	}
	if (m_nicks.empty())
	{
		m_user.SetItemData(m_user.AddString(""), m_nicks.size());
		m_nicks.push_back(t_nick());
	}
	m_game.SetCurSel(0);
	m_user.SetCurSel(0);	
	return true;
}
示例#7
0
int ComponentInterface::
get_status( const std::string &aname, int pid) const throw( COM_exception) {
  // If aname is empty, then check the status of the pane.
  if ( aname.empty()) {
    Pane_map::const_iterator pit = _pane_map.find( pid);
    if ( pit == _pane_map.end()) return -1;
    else return 0;
  }

  const Pane_friend *pn;
  try { pn = &(Pane_friend&)pane(pid); }
  catch ( COM_exception ex) {
    ex.msg = append_frame( ex.msg, ComponentInterface::get_status);
    throw ex;
  }
    
  // Special handing for connectivity
  if ( Connectivity::is_element_name( aname)) {
    // Get the corresponding dataitem object.
    const COM::Connectivity *conn = pn->connectivity( aname);
    if ( conn==NULL) return -1;
    else return conn->status();
  }
  else {
    // Get the corresponding dataitem object.
    const COM::DataItem *attr = pn->dataitem( aname);
    if ( attr==NULL) return -1;
    else return attr->status();
  }
}
示例#8
0
void ComponentInterface::
get_parent( const std::string &aname, int pid, 
	    std::string &parent) const throw( COM_exception) {

  const Pane_friend *pn;
  try { 
    pn = &(Pane_friend&)pane(pid); 
    
    // Special handing for connectivity
    if ( Connectivity::is_element_name( aname)) {
      // Get the corresponding dataitem object.
      const COM::Connectivity *conn = pn->connectivity( aname);
      if ( conn==NULL) 
	throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			     (name()+"."+aname,ComponentInterface::get_parent));

      conn = conn->parent();
      if ( conn==NULL) parent.clear();
      else parent = conn->fullname();
    }
    else {
      // Get the corresponding dataitem object.
      const COM::DataItem *attr = pn->dataitem( aname);
      if ( attr==NULL) 
	throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			     (name()+"."+aname,ComponentInterface::get_parent));

      if ( attr==NULL) parent.clear();
      else parent = attr->fullname();
    }
  } catch ( COM_exception ex) {
    ex.msg = append_frame( ex.msg, ComponentInterface::get_parent);
    throw ex;
  }
}
示例#9
0
void Window::copy_array(const std::string &aname, const int pane_id,
			void *val, int v_strd, int v_size, 
			int offset) const throw(COM_exception)
{
  const Pane_friend *pn;
  try { pn = &(Pane_friend&)pane(pane_id); }
  catch ( COM_exception ex) {
    ex.msg = append_frame( ex.msg, Window::copy_array);
    throw ex;
  }

  if ( Connectivity::is_element_name( aname)) {
    const Connectivity *conn = pn->connectivity( aname);
    if ( conn == NULL) 
      throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			   (name()+"."+aname, Window::copy_array));

    copy_array_common( conn, pane_id, 
		       val, v_strd, v_size, offset);
  }
  else {
    const Attribute *attr = pn->attribute( aname);
    if ( attr == NULL) 
      throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			   (name()+"."+aname, Window::copy_array));

    copy_array_common( attr, pane_id, 
		       val, v_strd, v_size, offset);
  }
}
示例#10
0
void Window::
get_parent( const std::string &aname, int pid, 
	    std::string &parent) const throw( COM_exception) {

  const Pane_friend *pn;
  try { 
    pn = &(Pane_friend&)pane(pid); 
    
    // Special handing for connectivity
    if ( Connectivity::is_element_name( aname)) {
      // Get the corresponding attribute object.
      const COM::Connectivity *conn = pn->connectivity( aname);
      if ( conn==NULL) 
	throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			     (name()+"."+aname,Window::get_parent));

      conn = conn->parent();
      if ( conn==NULL) parent.clear();
      else parent = conn->fullname();
    }
    else {
      // Get the corresponding attribute object.
      const COM::Attribute *attr = pn->attribute( aname);
      if ( attr==NULL) 
	throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			     (name()+"."+aname,Window::get_parent));

      if ( attr==NULL) parent.clear();
      else parent = attr->fullname();
    }
  } catch ( COM_exception ex) {
    ex.msg = append_frame( ex.msg, Window::get_parent);
    throw ex;
  }
}
示例#11
0
void Window::
get_size( const std::string &aname, int pid,
	  int *nitem, int *ng) const throw( COM_exception) {
  const Pane_friend *pn;
  try { pn = &(Pane_friend&)pane(pid); }
  catch ( COM_exception ex) {
    ex.msg = append_frame( ex.msg, Window::get_size);
    throw ex;
  }
    
  // Special handing for connectivity
  if ( Connectivity::is_element_name( aname)) {
    // Get the corresponding attribute object.
    const COM::Connectivity *conn = pn->connectivity( aname);
    if ( conn==NULL) 
      throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			   ( name()+"."+aname, Window::get_size));
    get_size_common( conn, pid, nitem, ng);
  }
  else {
    // Get the corresponding attribute object.
    const COM::Attribute *attr = pn->attribute( aname);
    if ( attr==NULL) 
      throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			   ( name()+"."+aname, Window::get_size));

    get_size_common( attr, pid, nitem, ng);
  }
}
示例#12
0
void ComponentInterface::
get_size( const std::string &aname, int pid,
	  int *nitem, int *ng) const throw( COM_exception) {
  const Pane_friend *pn;
  try { pn = &(Pane_friend&)pane(pid); }
  catch ( COM_exception ex) {
    ex.msg = append_frame( ex.msg, ComponentInterface::get_size);
    throw ex;
  }
    
  // Special handing for connectivity
  if ( Connectivity::is_element_name( aname)) {
    // Get the corresponding dataitem object.
    const COM::Connectivity *conn = pn->connectivity( aname);
    if ( conn==NULL) 
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			   ( name()+"."+aname, ComponentInterface::get_size));
    get_size_common( conn, pid, nitem, ng);
  }
  else {
    // Get the corresponding dataitem object.
    const COM::DataItem *attr = pn->dataitem( aname);
    if ( attr==NULL) 
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			   ( name()+"."+aname, ComponentInterface::get_size));

    get_size_common( attr, pid, nitem, ng);
  }
}
示例#13
0
void Window::append_array( const std::string &aname, const int pane_id,
			   const void *val, int v_strd, int v_size) throw(COM_exception)
{
  COM_assertion_msg( !Connectivity::is_element_name( aname),
		     "append_array supports only window and pane attributes");
  
  Attribute *a = pane( pane_id,true).attribute( aname);

  if ( a==NULL) 
    throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			 (name()+"."+aname,Window::append_array));
  try {
    // Set size to 0 if not yet set.
    if ( !a->size_set()) a->set_size(0); 
    // resize the target attribute.
    reinit_attr( a, Pane::OP_RESIZE, NULL, a->stride(), 
		 a->size_of_items()+v_size);
  }
  catch ( COM_exception ex) {
    ex.msg = append_frame( ex.msg, Window::append_array);
    throw ex;
  }
  
  // copy the array to the back of the target array
  a->append_array( val, v_strd, v_size);
}
int AW_CMultiViewSplitter::AddView(int nRow, int nCol, CRuntimeClass * pViewClass, 
								   CCreateContext* pContext)
{
	// hide the current view of the pane
	int PreviousID = HideCurrentView(nRow, nCol);

	// create the new view, if fail, set the previous view current 
	if (CreateView(nRow, nCol, pViewClass, CSize(10,10), pContext) == 0)
	{
		if (PreviousID != -1)
			SetCurrentView(nRow, nCol, PreviousID);
		return -1;
	}

	// get and store the new view
	int NewViewID = m_nIDCounter;
	CWnd* pNewWnd = GetPane(nRow, nCol);
	CPoint pane(nRow, nCol);
	long paneID = MAKELONG(pane.x,pane.y);
	m_mapViewPane.insert(map<int, long>::value_type(NewViewID,paneID));
	m_mapIDViews.insert(map<int, CWnd*>::value_type(NewViewID, pNewWnd));

	// set the new view current
	SetCurrentView(nRow, nCol, NewViewID);

	RedrawWindow();
	m_nIDCounter ++;
	return NewViewID;
}
示例#15
0
void ComponentInterface::copy_array(const std::string &aname, const int pane_id,
			void *val, int v_strd, int v_size, 
			int offset) const throw(COM_exception)
{
  const Pane_friend *pn;
  try { pn = &(Pane_friend&)pane(pane_id); }
  catch ( COM_exception ex) {
    ex.msg = append_frame( ex.msg, ComponentInterface::copy_array);
    throw ex;
  }

  if ( Connectivity::is_element_name( aname)) {
    const Connectivity *conn = pn->connectivity( aname);
    if ( conn == NULL) 
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			   (name()+"."+aname, ComponentInterface::copy_array));

    copy_array_common( conn, pane_id, 
		       val, v_strd, v_size, offset);
  }
  else {
    const DataItem *attr = pn->dataitem( aname);
    if ( attr == NULL) 
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			   (name()+"."+aname, ComponentInterface::copy_array));

    copy_array_common( attr, pane_id, 
		       val, v_strd, v_size, offset);
  }
}
示例#16
0
BOOL Cdlg_profiles::OnInitDialog()
{
	ETSLayoutDialog::OnInitDialog();
	update_controls();
	CreateRoot(VERTICAL)
		<< item(IDC_LIST)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< itemGrowing(HORIZONTAL)
			<< item(IDC_ACTIVATE, NORESIZE)
			<< item(IDC_INSERT, NORESIZE)
			<< item(IDC_EDIT, NORESIZE)
			<< item(IDC_DELETE, NORESIZE)
			<< item(IDOK, NORESIZE)
			<< item(IDCANCEL, NORESIZE)
			)
		;
	UpdateLayout();

	m_list.InsertColumn(0, "Name");
	m_list.InsertColumn(1, "Seeding Ratio", LVCFMT_RIGHT);
	m_list.InsertColumn(2, "Upload Rate", LVCFMT_RIGHT);
	m_list.InsertColumn(3, "Upload Slots", LVCFMT_RIGHT);
	m_list.InsertColumn(4, "Peer Limit", LVCFMT_RIGHT);
	m_list.InsertColumn(5, "Torrent Limit", LVCFMT_RIGHT);
	m_list.InsertColumn(6, "");
	for (t_entries::const_iterator i = m_entries.begin(); i != m_entries.end(); i++)
		m_list.InsertItemData(i->first);
	m_list.auto_size();
	return true;
}
示例#17
0
void ComponentInterface::append_array( const std::string &aname, const int pane_id,
			   const void *val, int v_strd, int v_size) throw(COM_exception)
{
  COM_assertion_msg( !Connectivity::is_element_name( aname),
		     "append_array supports only CI window and pane dataitems");
  
  DataItem *a = pane( pane_id,true).dataitem( aname);

  if ( a==NULL) 
    throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			 (name()+"."+aname,ComponentInterface::append_array));
  try {
    // Set size to 0 if not yet set.
    if ( !a->size_set()) a->set_size(0); 
    // resize the target dataitem.
    reinit_dataitem( a, Pane::OP_RESIZE, NULL, a->stride(), 
		 a->size_of_items()+v_size);
  }
  catch ( COM_exception ex) {
    ex.msg = append_frame( ex.msg, ComponentInterface::append_array);
    throw ex;
  }
  
  // copy the array to the back of the target array
  a->append_array( val, v_strd, v_size);
}
示例#18
0
void ComponentInterface::get_array(const std::string &aname, const int pane_id,
		       Pointer_descriptor &addr,
		       int *strd, int *cap, bool is_const) throw(COM_exception)
{
  Pane_friend *pn;
  try { pn = &(Pane_friend&)pane(pane_id); }
  catch ( COM_exception ex) {
    ex.msg = append_frame( ex.msg, ComponentInterface::get_array);
    throw ex;
  }
    
  if ( Connectivity::is_element_name( aname)) {
    // Define as const reference to avoid exception.
    const Connectivity *con=pn->connectivity( aname);

    if ( con==NULL) 
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST,append_frame
			   (name()+"."+aname,ComponentInterface::get_array));

    get_array_common( con, pane_id, addr, strd, cap, is_const);
  }
  else {
    // Define as const reference to avoid exception.
    const DataItem *a = pn->dataitem( aname);

    if ( a==NULL) 
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST,append_frame
			   (name()+"."+aname,ComponentInterface::get_array));
    get_array_common( a, pane_id, addr, strd, cap, is_const);
  }
}
示例#19
0
void panemore(unsigned  int Start_py,uint8 Start_px,unsigned  int Stop_py,uint8 Stop_px,uint8 width)
 {
  uint8 i;
  for(i=0x00;i<width;i++)
  	{
     pane(Start_py+i,Start_px+i,Stop_py-i, Stop_px-i);
  	}
 }
示例#20
0
BOOL CSearchFileDlg::OnInitDialog() 
{
	CreateRoot(VERTICAL)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< item(IDC_FILENAME_STATIC, NORESIZE)
			<< item(IDC_FILENAME, GREEDY)
			)
		<< item(IDC_LIST, GREEDY)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< itemGrowing(HORIZONTAL)
			<< item(IDOK, NORESIZE)
			<< item(IDCANCEL, NORESIZE)
			);
	ETSLayoutDialog::OnInitDialog();
	m_list.InsertColumn(0, "Name");
	m_list.auto_size();
	return true;
}
示例#21
0
int GuiMenu::labelIndexUnderMouse(Vector2 click) const {
    click += pane()->clientRect().x0y0() - m_clientRect.x0y0();
    for (int i = 0; i < m_labelArray.size(); ++i) {
        if (m_labelArray[i]->rect().contains(click)) {
            return i;
        }
    }

    return -1;
}
示例#22
0
BOOL Cdlg_make_torrent::OnInitDialog()
{
	m_tracker = AfxGetApp()->GetProfileString(m_strRegStore, "tracker");
	m_trackers = AfxGetApp()->GetProfileString(m_strRegStore, "trackers");
	m_use_merkle = AfxGetApp()->GetProfileInt(m_strRegStore, "use_merkle", false);
	ETSLayoutDialog::OnInitDialog();
	CreateRoot(VERTICAL)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< item(IDC_NAME_STATIC, NORESIZE)
			<< item(IDC_NAME, GREEDY)
			)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< item(IDC_TRACKER_STATIC, NORESIZE)
			<< item(IDC_TRACKER, GREEDY)
			)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< item(IDC_TRACKERS_STATIC, NORESIZE)
			<< item(IDC_TRACKERS, GREEDY)
			)
		<< item(IDC_LIST, GREEDY)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< item(IDC_SEED_AFTER_MAKING, NORESIZE)
			<< item(IDC_USE_MERKLE, NORESIZE)
			<< itemGrowing(HORIZONTAL)
			<< item(IDC_LOAD_TRACKERS, NORESIZE)
			<< item(IDC_SAVE, NORESIZE)
			)
		;
	UpdateLayout();

	m_list.InsertColumn(0, "Name");
	m_list.InsertColumn(1, "Size", LVCFMT_RIGHT);
	m_list.InsertColumn(2, "");
	m_sort_column = 0;
	m_sort_reverse = false;

	for (t_map::const_iterator i = m_map.begin(); i != m_map.end(); i++)
		m_list.InsertItemData(i->first);
	post_insert();

	return true;
}
示例#23
0
void ClientWindow::layout()
 {
  Coord dy=menu.getMinSize().dy;

  action_base=Point(dy,dy);

  Pane pane(Null,getSize());

  menu.setPlace(SplitY(dy,pane));
  editor.setPlace(pane);
 }
示例#24
0
DataItem *ComponentInterface::inherit( DataItem *from, const std::string &aname,
			    int mode, bool withghost,
			    const DataItem *cond, int val) 
  throw(COM_exception) 
{
  DataItem *a = ((Pane_friend&)_dummy).inherit(from, aname, mode, withghost);
  if ( from->is_windowed()) return a;

  // Copy the panes
  Pane_map &ps = from->window()->_pane_map;

  bool with_conn = from->id()==COM_CONN || from->id()==COM_MESH || 
    from->id()==COM_PMESH || from->id()==COM_ALL;

  bool insert_pane = (mode != Pane::INHERIT_COPY) && with_conn;

  if ( with_conn && aname.size() && from->name() != aname)
    throw COM_exception( COM_ERR_INCOMPATIBLE_DATAITEMS, append_frame
			 (from->fullname()+" and " +aname,
			  ComponentInterface::inherit));

  if ( cond && cond->window()!=from->window()) {
    throw COM_exception( COM_ERR_INCOMPATIBLE_DATAITEMS, append_frame
			 (from->fullname()+" and "+cond->fullname(),
			  ComponentInterface::inherit));
  }

  for ( Pane_map::iterator ppit = ps.begin(); ppit!=ps.end(); ++ppit) {
    Pane *ppn=ppit->second;
    const int *cnd = NULL;
    if ( cond) {
      const DataItem *cond_pn = ppn->dataitem( cond->id());
      cnd = (const int*)cond_pn->pointer();
    }

    // Inherit the pane if the condition was set to an variable (cnd!=NULL),
    // or set to to pane ID (cnd==NULL && val!=0), or not set.
    if ( !cond && (val==0 || val==ppn->id()) || cnd && *cnd == val) {
      // Create new panes only when we are inheriting the mesh.
      Pane_friend *pn;
      if ( insert_pane)
	pn = (Pane_friend*)( &pane( ppit->first, true));
      else {
	Pane_map::iterator it = _pane_map.find( ppit->first);
	pn = ( it!=_pane_map.end())?(Pane_friend*)(it->second):NULL;
      }
 
      if ( pn)
	pn->inherit( ppn->dataitem( from->id()), aname, mode, withghost);
    }
  }
  return a;
}
示例#25
0
void Window::dealloc_array( const std::string &aname, 
			    const int pane_id) throw(COM_exception)
{
  if ( Connectivity::is_element_name( aname)) {
    Pane &pn = pane(pane_id);
    Connectivity *con = ((Pane_friend&)pn).connectivity( aname);
    
    if ( con==NULL) 
      throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			   (name()+"."+aname,Window::dealloc_array));

    reinit_conn( con, Pane::OP_DEALLOC);
  }
  else {
    Attribute *a = pane( pane_id).attribute( aname);

    if ( a==NULL) 
      throw COM_exception( COM_ERR_ATTRIBUTE_NOTEXIST, append_frame
			   (name()+"."+aname,Window::dealloc_array));
    reinit_attr( a, Pane::OP_DEALLOC);
  }
}
示例#26
0
void ComponentInterface::dealloc_array( const std::string &aname, 
			    const int pane_id) throw(COM_exception)
{
  if ( Connectivity::is_element_name( aname)) {
    Pane &pn = pane(pane_id);
    Connectivity *con = ((Pane_friend&)pn).connectivity( aname);
    
    if ( con==NULL) 
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			   (name()+"."+aname,ComponentInterface::dealloc_array));

    reinit_conn( con, Pane::OP_DEALLOC);
  }
  else {
    DataItem *a = pane( pane_id).dataitem( aname);

    if ( a==NULL) 
      throw COM_exception( COM_ERR_DATAITEM_NOTEXIST, append_frame
			   (name()+"."+aname,ComponentInterface::dealloc_array));
    reinit_dataitem( a, Pane::OP_DEALLOC);
  }
}
示例#27
0
BOOL CXSTE_edit_dlg::OnInitDialog() 
{
	CreateRoot(VERTICAL)
		<< item(IDC_NAME, ABSOLUTE_VERT)
		<< item(IDC_VALUE, GREEDY)
		<< item(IDC_EXTRA_VALUE, ABSOLUTE_VERT)
		<< (pane(HORIZONTAL, ABSOLUTE_VERT)
			<< itemGrowing(HORIZONTAL)
			<< item(IDOK, NORESIZE)
			<< item(IDCANCEL, NORESIZE)
			);
	ETSLayoutDialog::OnInitDialog();
	return true;
}
示例#28
0
BOOL Cdlg_peer_connect::OnInitDialog()
{
	ETSLayoutDialog::OnInitDialog();
	CreateRoot(VERTICAL)
		<< (pane(HORIZONTAL)
			<< (pane(VERTICAL)
				<< item(IDC_HOST_STATIC, NORESIZE)
				<< item(IDC_PORT_STATIC, NORESIZE)
				)
			<< (pane(VERTICAL)
				<< item(IDC_HOST, ABSOLUTE_VERT)
				<< item(IDC_PORT, ABSOLUTE_VERT)
				)
			)
		<< (pane(HORIZONTAL)
			<< itemGrowing(HORIZONTAL)
			<< item(IDOK, NORESIZE)
			<< item(IDCANCEL, NORESIZE)
			)
		;
	UpdateLayout();
	return true;
}
示例#29
0
long CALCDigitBox::onPopupMenu(FXObject*,FXSelector sel,void* ptr)
{
#ifdef HAVE_RTTI
  FXString str="";

  //Attemp to get tip text
  switch(FXSELID(sel))
  {
  case FXSpinner::ID_INCREMENT:
  case FXSpinner::ID_DECREMENT:
  case FXSpinner::ID_ENTRY:
  case ID_NUMDIGITS:
    str=DIGITNUMDIGITS_HELP;
    break;
  case ID_DEFAULTDIGITS:
    str=DIGITDEFAULTDIGITS_HELP;
    break;
  }

  if(!str.empty())
  {
    FXEvent* event=(FXEvent*)ptr;
    FXMenuPane pane(this);
    new FXMenuCommand(&pane,"&Huh?",NULL,this,ID_CLARIFY);

    clarify=FALSE;

    pane.create();
    pane.popup(NULL,event->root_x,event->root_y);
    getApp()->runModalWhileShown(&pane);

    if(clarify)
    {
      FXMenuPane clarification(this,FRAME_LINE);

      FXButton* button=new FXButton(&clarification,str,NULL,&clarification,FXWindow::ID_HIDE,JUSTIFY_LEFT);
      button->setFont(getApp()->getNormalFont());
      button->setTextColor(getApp()->getForeColor());
      button->setBackColor(FXRGB(255,255,192));

      clarification.create();
      clarification.popup(NULL,event->root_x,event->root_y);
      getApp()->runModalWhileShown(&clarification);
    }
  }
#endif
  return 1;
}
示例#30
0
long GMSourceView::onSourceContextMenu(FXObject*,FXSelector,void*ptr){
  FXEvent * event =static_cast<FXEvent*>(ptr);
  if (event->moved) return 0;
  GMTreeItem * item = dynamic_cast<GMTreeItem*>(sourcelist->getItemAt(event->win_x,event->win_y));
  GMMenuPane pane(this);
  GMSource * src = item ? static_cast<GMSource*>(item->getData()) : nullptr;
  FXbool src_items = false;

  if (src)
    src_items = src->source_context_menu(&pane);

  if (src && src->canBrowse()) {
    if (src_items) new FXMenuSeparator(&pane);
    new GMMenuCheck(&pane,tr("Show Browser\tCtrl-B\tShow Browser"),GMPlayerManager::instance()->getTrackView(),GMTrackView::ID_TOGGLE_BROWSER);
    new GMMenuCheck(&pane,tr("Show Tags\tCtrl-T\tShow Tags"),GMPlayerManager::instance()->getTrackView(),GMTrackView::ID_TOGGLE_TAGS);
    }

  // Install Source Items (Group by source)
  if (src==nullptr || src_items==false) {
    FXint nadded=(&pane)->numChildren();
    FXint nlast=(&pane)->numChildren();
    for (FXint i=0;i<GMPlayerManager::instance()->getNumSources();i++) {
      if (nadded>1) {
        new FXMenuSeparator(&pane);
        nadded=0;
        nlast+=1;
        }
      if (GMPlayerManager::instance()->getSource(i)->source_menu(&pane)){
        FXint n = (&pane)->numChildren();
        nadded = n - nlast;
        nlast  = n;
        }
      }
    }

  if (item) {
    sourcelist->setCurrentItem(item);
    onCmdSourceSelected(nullptr,0,nullptr); // Simulate SEL_COMMAND
    }

  if (pane.getFirst()){
    pane.create();
    ewmh_change_window_type(&pane,WINDOWTYPE_POPUP_MENU);
    pane.popup(nullptr,event->root_x,event->root_y);
    getApp()->runPopup(&pane);
    }
  return 1;
  }