Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PopupWinBase: Remove member functions which are no longer in use #418

Merged
merged 1 commit into from
Jul 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 1 addition & 34 deletions src/skeleton/popupwinbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

#include "popupwinbase.h"

#if GTKMM_CHECK_VERSION(3,0,0)
#include "command.h"
#endif


using namespace SKELETON;
Expand All @@ -17,34 +15,17 @@ PopupWinBase::PopupWinBase( bool draw_frame )
: Gtk::Window( Gtk::WINDOW_POPUP )
, m_draw_frame( draw_frame )
{
#ifdef _DEBUG
std::cout << "PopupWinBase::PopupWinBase\n";
#endif

if( m_draw_frame ) set_border_width( 1 );
#if GTKMM_CHECK_VERSION(3,0,0)

if ( auto main_window = CORE::get_mainwindow() ) {
set_transient_for( *main_window );
}
#endif
}


PopupWinBase::~PopupWinBase() noexcept = default;


void PopupWinBase::on_realize()
{
Gtk::Window::on_realize();

#if !GTKMM_CHECK_VERSION(3,0,0)
const Glib::RefPtr< Gdk::Window > window = get_window();
m_gc = Gdk::GC::create( window );
#endif
}


#if GTKMM_CHECK_VERSION(3,0,0)
bool PopupWinBase::on_draw( const Cairo::RefPtr< Cairo::Context >& cr )
{
const bool ret = Gtk::Window::on_draw( cr );
Expand All @@ -56,20 +37,6 @@ bool PopupWinBase::on_draw( const Cairo::RefPtr< Cairo::Context >& cr )
}
return ret;
}
#else
bool PopupWinBase::on_expose_event( GdkEventExpose* event )
{
const bool ret = Gtk::Window::on_expose_event( event );

// 枠の描画
if( m_draw_frame ) {
m_gc->set_foreground( Gdk::Color( "black" ) );
get_window()->draw_rectangle( m_gc, false, 0, 0, get_width()-1, get_height()-1 );
}

return ret;
}
#endif // GTKMM_CHECK_VERSION(3,0,0)


bool PopupWinBase::on_configure_event( GdkEventConfigure* event )
Expand Down
10 changes: 1 addition & 9 deletions src/skeleton/popupwinbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//
// ポップアップウィンドウの基底クラス
//
// TODO: 枠線はcssで設定する

#ifndef POPUPWINBASE_H
#define POPUPWINBASE_H
Expand All @@ -25,10 +26,6 @@ namespace SKELETON
class PopupWinBase : public Gtk::Window
{
SIG_CONFIGURED_POPUP m_sig_configured;
#if !GTKMM_CHECK_VERSION(3,0,0)
Glib::RefPtr< Gdk::GC > m_gc;
#endif

const bool m_draw_frame;

public:
Expand All @@ -41,12 +38,7 @@ namespace SKELETON

protected:

void on_realize() override;
#if GTKMM_CHECK_VERSION(3,0,0)
bool on_draw( const Cairo::RefPtr< Cairo::Context >& cr ) override;
#else
bool on_expose_event( GdkEventExpose* event ) override;
#endif
bool on_configure_event( GdkEventConfigure* event ) override;
};
}
Expand Down